Class SecurityConfig

java.lang.Object
ch.admin.bit.jeap.oauth.mock.server.security.SecurityConfig

@Configuration public class SecurityConfig extends Object
  • 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:
      CertificateException
      org.bouncycastle.operator.OperatorCreationException
      NoSuchAlgorithmException
    • 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 authentication
      allowedScopes - The scopes allowed by the client
      Returns:
      true if the requested scopes are contained within the allowed scopes, false otherwise.