Created
July 29, 2017 22:21
-
-
Save diegosilva13/13d09487a859ee5298c078d0d7f0127b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.coderef.delivery.config; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.autoconfigure.security.SecurityProperties; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.core.annotation.Order; | |
import org.springframework.security.authentication.AuthenticationManager; | |
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; | |
import org.springframework.security.config.annotation.web.builders.WebSecurity; | |
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | |
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | |
import org.springframework.security.crypto.password.PasswordEncoder; | |
import com.coderef.delivery.service.UserDetailsService; | |
@Configuration | |
@EnableWebSecurity | |
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) | |
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | |
@Autowired | |
private UserDetailsService userDetailsService; | |
@Autowired | |
PasswordEncoder passwordEncoder; | |
@Override | |
protected void configure(AuthenticationManagerBuilder auth) throws Exception { | |
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder); | |
} | |
@Override | |
@Bean | |
public AuthenticationManager authenticationManagerBean() throws Exception { | |
return super.authenticationManagerBean(); | |
} | |
@Override | |
public void configure(WebSecurity web) throws Exception { | |
web.ignoring().antMatchers("/oauth/register"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment