Class AadWebSecurityConfigurerAdapter

java.lang.Object
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
com.azure.spring.cloud.autoconfigure.aad.AadWebSecurityConfigurerAdapter
All Implemented Interfaces:
org.springframework.security.config.annotation.SecurityConfigurer<jakarta.servlet.Filter,org.springframework.security.config.annotation.web.builders.WebSecurity>, org.springframework.security.config.annotation.web.WebSecurityConfigurer<org.springframework.security.config.annotation.web.builders.WebSecurity>
Direct Known Subclasses:
AadWebApplicationConfiguration.DefaultAadWebSecurityConfigurerAdapter

public abstract class AadWebSecurityConfigurerAdapter extends org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
Abstract configuration class, used to make AzureClientRegistrationRepository and AuthzCodeGrantRequestEntityConverter take effect.
See Also:
  • WebSecurityConfigurerAdapter
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.springframework.beans.factory.ObjectProvider<com.azure.spring.cloud.autoconfigure.aad.implementation.oauth2.OAuth2ClientAuthenticationJwkResolver>
    JWK resolver implementation for client authentication.
    protected org.springframework.security.oauth2.client.userinfo.OAuth2UserService<org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest,org.springframework.security.oauth2.core.oidc.user.OidcUser>
    OIDC user service.
    AAD authentication properties
    protected org.springframework.security.oauth2.client.registration.ClientRegistrationRepository
    A repository for OAuth 2.0 / OpenID Connect 1.0 ClientRegistration(s).
    protected org.springframework.boot.web.client.RestTemplateBuilder
    restTemplateBuilder bean used to create RestTemplate for Azure AD related http request.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient<org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest>
    Gets the access token response client.
    protected jakarta.servlet.Filter
    Return the filter to handle conditional access exception.
    protected void
    configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
    configure
    protected org.springframework.security.web.authentication.logout.LogoutSuccessHandler
    Gets the OIDC logout success handler.
    protected org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestResolver
    Gets the request resolver.

    Methods inherited from class org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter

    authenticationManager, authenticationManagerBean, configure, configure, getApplicationContext, getHttp, init, setApplicationContext, setAuthenticationConfiguration, setContentNegotationStrategy, setObjectPostProcessor, setTrustResolver, userDetailsService, userDetailsServiceBean

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • repo

      @Autowired protected org.springframework.security.oauth2.client.registration.ClientRegistrationRepository repo
      A repository for OAuth 2.0 / OpenID Connect 1.0 ClientRegistration(s).
    • restTemplateBuilder

      @Autowired protected org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder
      restTemplateBuilder bean used to create RestTemplate for Azure AD related http request.
    • oidcUserService

      @Autowired protected org.springframework.security.oauth2.client.userinfo.OAuth2UserService<org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest,org.springframework.security.oauth2.core.oidc.user.OidcUser> oidcUserService
      OIDC user service.
    • properties

      @Autowired protected AadAuthenticationProperties properties
      AAD authentication properties
    • jwkResolvers

      @Autowired protected org.springframework.beans.factory.ObjectProvider<com.azure.spring.cloud.autoconfigure.aad.implementation.oauth2.OAuth2ClientAuthenticationJwkResolver> jwkResolvers
      JWK resolver implementation for client authentication.
  • Constructor Details

    • AadWebSecurityConfigurerAdapter

      public AadWebSecurityConfigurerAdapter()
  • Method Details

    • configure

      protected void configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception
      configure
      Overrides:
      configure in class org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
      Parameters:
      http - the HttpSecurity to use
      Throws:
      Exception - Configuration failed
    • conditionalAccessFilter

      protected jakarta.servlet.Filter conditionalAccessFilter()
      Return the filter to handle conditional access exception. No conditional access filter is provided by default.
      Returns:
      a filter that handles conditional access exception.
      See Also:
    • oidcLogoutSuccessHandler

      protected org.springframework.security.web.authentication.logout.LogoutSuccessHandler oidcLogoutSuccessHandler()
      Gets the OIDC logout success handler.
      Returns:
      the OIDC logout success handler
    • accessTokenResponseClient

      protected org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient<org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient()
      Gets the access token response client.
      Returns:
      the access token response client
    • requestResolver

      protected org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestResolver requestResolver()
      Gets the request resolver.
      Returns:
      the request resolver