@Configuration
@EnableWebSecurity(debug=true)
@EnableGlobalMethodSecurity(prePostEnabled=true)
@Order(value=2147483640)
@ConditionalOnProperty(prefix="auth0",
name="defaultAuth0ApiSecurityEnabled")
public class Auth0SecurityConfig
extends org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
| Modifier and Type | Field and Description |
|---|---|
protected String |
authorityStrategy |
protected boolean |
base64EncodedSecret |
protected String |
clientId |
protected String |
clientSecret |
protected String |
domain |
protected String |
issuer |
protected String |
securedRoute |
| Constructor and Description |
|---|
Auth0SecurityConfig() |
| Modifier and Type | Method and Description |
|---|---|
Auth0AuthenticationEntryPoint |
auth0AuthenticationEntryPoint() |
Auth0AuthenticationFilter |
auth0AuthenticationFilter(Auth0AuthenticationEntryPoint entryPoint) |
Auth0AuthenticationProvider |
auth0AuthenticationProvider() |
org.springframework.security.authentication.AuthenticationManager |
authenticationManagerBean() |
protected void |
authorizeRequests(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
Lightweight default configuration that offers basic authorization checks for authenticated
users on secured endpoint, and sets up a Principal user object with granted authorities
|
protected void |
configure(org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder auth) |
protected void |
configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http) |
Auth0CORSFilter |
simpleCORSFilter() |
authenticationManager, configure, getHttp, init, setApplicationContext, setAuthenticationConfiguration, setContentNegotationStrategy, setObjectPostProcessor, setTrustResolver, userDetailsService, userDetailsServiceBean@Value(value="${auth0.domain}")
protected String domain
@Value(value="${auth0.issuer}")
protected String issuer
@Value(value="${auth0.clientId}")
protected String clientId
@Value(value="${auth0.clientSecret}")
protected String clientSecret
@Value(value="${auth0.securedRoute}")
protected String securedRoute
@Value(value="${auth0.authorityStrategy}")
protected String authorityStrategy
@Value(value="${auth0.base64EncodedSecret}")
protected boolean base64EncodedSecret
@Autowired
@Bean(name="auth0AuthenticationManager")
public org.springframework.security.authentication.AuthenticationManager authenticationManagerBean()
throws Exception
authenticationManagerBean in class org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapterException@Bean public Auth0CORSFilter simpleCORSFilter()
@Bean(name="auth0AuthenticationProvider") public Auth0AuthenticationProvider auth0AuthenticationProvider()
@Bean(name="auth0EntryPoint") public Auth0AuthenticationEntryPoint auth0AuthenticationEntryPoint()
@Bean(name="auth0Filter") public Auth0AuthenticationFilter auth0AuthenticationFilter(Auth0AuthenticationEntryPoint entryPoint)
protected void configure(org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder auth)
throws Exception
configure in class org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapterExceptionprotected void configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
throws Exception
configure in class org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapterExceptionprotected void authorizeRequests(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
throws Exception
For simple apps, this is sufficient, however for applications wishing to specify fine-grained endpoint access restrictions, use Role / Group level endpoint authorization etc, then this configuration should be disabled and a copy, augmented with your own requirements provided. See Sample app for example Override this function in subclass to apply custom authentication / authorization strategies to your application endpoints
ExceptionCopyright © 2016. All Rights Reserved.