Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated httpSecurity methods #46

Open
cihancaa opened this issue Aug 21, 2023 · 2 comments
Open

Deprecated httpSecurity methods #46

cihancaa opened this issue Aug 21, 2023 · 2 comments

Comments

@cihancaa
Copy link

I implemented Security Filter Chain to my project. csrf, authorizeHttpRequests, and, sessionManagement methods are deprecated and marked for removal. Can you fix them ?

@wderlansilva
Copy link

great man, UP UP!

@ruskyvisky
Copy link

   @Bean
    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
        http
                .csrf(csrf -> csrf
                        .disable()
                )
                .sessionManagement(session -> session
                        .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                )
                .authorizeHttpRequests(authorize -> authorize
                        .requestMatchers(HttpMethod.POST, "/api/v1/auth/**").permitAll()
                        .anyRequest().authenticated()
                )
                .authenticationProvider(authenticationProvider).addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class);

        return http.build();
    }

I wrote this and worked for me. You can read more in here : Docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants