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

Update SecurityConfiguration.java #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,26 @@

@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter{
public class SecurityConfiguration{

@Autowired
private UserService userService;
AuthenticationConfiguration authConfiguration;

@Autowired
private UserDetail userDetail;

@Autowired
private JwtFilter jwtFilter;

@Override
@Autowired
protected void configure(AuthenticationManagerBuilder auth) throws Exception {

auth.userDetailsService(userService);
auth.userDetailsService(userDetail);
}

@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}

@Override
protected void configure(HttpSecurity http) throws Exception {

@Bean
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.csrf()
.disable()
.authorizeRequests()
Expand All @@ -49,5 +47,14 @@ protected void configure(HttpSecurity http) throws Exception {
.sessionCreationPolicy(SessionCreationPolicy.STATELESS);
http.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class);

return http.build();

}


@Bean
public AuthenticationManager authenticationManager() throws Exception {
return authConfiguration.getAuthenticationManager();
}

}