Class SecurityConfig
java.lang.Object
ch.admin.bit.jeap.oauth.mock.server.security.SecurityConfig
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.web.SecurityFilterChainauthorizationServerSecurityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http) org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettingsauthorizationServerSettings(MockServerConfig mockServerConfig) org.springframework.beans.factory.config.BeanFactoryPostProcessorSpring Auth Server OAuth2ConfigurerUtils#getOptionalBean() does not take @Primary into account when resolving a token customizer.org.springframework.web.cors.CorsConfigurationSourceorg.springframework.security.web.SecurityFilterChaindefaultSecurityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http) com.nimbusds.jose.jwk.source.JWKSource<com.nimbusds.jose.proc.SecurityContext> org.springframework.security.oauth2.jwt.JwtDecoderjwtDecoder(com.nimbusds.jose.jwk.source.JWKSource<com.nimbusds.jose.proc.SecurityContext> jwkSource) org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepositoryregisteredClientRepository(OAuthMockData oAuthMockData) static booleanrequestedScopesMatchingAllowedScopes(Set<String> requestedScopes, Set<String> allowedScopes) Validate the requested scopes of an authentication against the scopes allowed for a client.org.springframework.security.core.userdetails.UserDetailsServiceuserDetailsService(OAuthMockData oAuthMockData)
-
Constructor Details
-
SecurityConfig
public SecurityConfig()
-
-
Method Details
-
authorizationServerSecurityFilterChain
@Bean @Order(1) public org.springframework.security.web.SecurityFilterChain authorizationServerSecurityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception - Throws:
Exception
-
defaultSecurityFilterChain
@Bean @Order(2) public org.springframework.security.web.SecurityFilterChain defaultSecurityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception - Throws:
Exception
-
corsConfigurationSource
@Bean public org.springframework.web.cors.CorsConfigurationSource corsConfigurationSource() -
registeredClientRepository
@Bean public org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository registeredClientRepository(OAuthMockData oAuthMockData) -
userDetailsService
@Bean public org.springframework.security.core.userdetails.UserDetailsService userDetailsService(OAuthMockData oAuthMockData) -
jwkSource
@Bean public com.nimbusds.jose.jwk.source.JWKSource<com.nimbusds.jose.proc.SecurityContext> jwkSource(KeyPair keyPair) throws CertificateException, org.bouncycastle.operator.OperatorCreationException, NoSuchAlgorithmException - Throws:
CertificateExceptionorg.bouncycastle.operator.OperatorCreationExceptionNoSuchAlgorithmException
-
beanFactoryPostProcessor
@Bean public org.springframework.beans.factory.config.BeanFactoryPostProcessor beanFactoryPostProcessor()Spring Auth Server OAuth2ConfigurerUtils#getOptionalBean() does not take @Primary into account when resolving a token customizer. A custom post processor is thus used here, registering the default token customizer only when no other customizer has been provided. -
jwtDecoder
@Bean public org.springframework.security.oauth2.jwt.JwtDecoder jwtDecoder(com.nimbusds.jose.jwk.source.JWKSource<com.nimbusds.jose.proc.SecurityContext> jwkSource) -
authorizationServerSettings
@Bean public org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings authorizationServerSettings(MockServerConfig mockServerConfig) -
requestedScopesMatchingAllowedScopes
public static boolean requestedScopesMatchingAllowedScopes(Set<String> requestedScopes, Set<String> allowedScopes) Validate the requested scopes of an authentication against the scopes allowed for a client. Supports dynamic scopes, i.e. an allowed scope "bproles:*" will match e.g. the requested scope "bproles:1232354".- Parameters:
requestedScopes- The scopes requested by an authenticationallowedScopes- The scopes allowed by the client- Returns:
trueif the requested scopes are contained within the allowed scopes,falseotherwise.
-