Class AadAuthenticationFilter

java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.web.filter.OncePerRequestFilter
com.azure.spring.cloud.autoconfigure.aad.filter.AadAuthenticationFilter
All Implemented Interfaces:
jakarta.servlet.Filter, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.EnvironmentAware, org.springframework.core.env.EnvironmentCapable, org.springframework.web.context.ServletContextAware

public class AadAuthenticationFilter extends org.springframework.web.filter.OncePerRequestFilter
A stateful authentication filter which uses Microsoft Graph groups to authorize. Both ID token and access token are supported. In the case of access token, only access token issued for the exact same application this filter used for could be accepted, e.g. access token issued for Microsoft Graph could not be processed by users' application.
See Also:
  • OncePerRequestFilter
  • Field Summary

    Fields inherited from class org.springframework.web.filter.OncePerRequestFilter

    ALREADY_FILTERED_SUFFIX

    Fields inherited from class org.springframework.web.filter.GenericFilterBean

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
    AadAuthenticationFilter(AadAuthenticationProperties aadAuthenticationProperties, AadAuthorizationServerEndpoints endpoints, UserPrincipalManager userPrincipalManager, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder)
    Creates a new instance of AadAuthenticationFilter.
    AadAuthenticationFilter(AadAuthenticationProperties aadAuthenticationProperties, AadAuthorizationServerEndpoints endpoints, com.nimbusds.jose.util.ResourceRetriever resourceRetriever, com.nimbusds.jose.jwk.source.JWKSetCache jwkSetCache, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder)
    Creates a new instance of AadAuthenticationFilter.
    AadAuthenticationFilter(AadAuthenticationProperties aadAuthenticationProperties, AadAuthorizationServerEndpoints endpoints, com.nimbusds.jose.util.ResourceRetriever resourceRetriever, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder)
    Creates a new instance of AadAuthenticationFilter.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doFilterInternal(jakarta.servlet.http.HttpServletRequest httpServletRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse, jakarta.servlet.FilterChain filterChain)
    Do filter.

    Methods inherited from class org.springframework.web.filter.OncePerRequestFilter

    doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatch

    Methods inherited from class org.springframework.web.filter.GenericFilterBean

    addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext

    Methods inherited from class java.lang.Object

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

    • AadAuthenticationFilter

      public AadAuthenticationFilter(AadAuthenticationProperties aadAuthenticationProperties, AadAuthorizationServerEndpoints endpoints, com.nimbusds.jose.util.ResourceRetriever resourceRetriever, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder)
      Creates a new instance of AadAuthenticationFilter.
      Parameters:
      aadAuthenticationProperties - the AAD authentication properties
      endpoints - the AAD authorization server endpoints
      resourceRetriever - the resource retriever
      restTemplateBuilder - the restTemplateBuilder
    • AadAuthenticationFilter

      public AadAuthenticationFilter(AadAuthenticationProperties aadAuthenticationProperties, AadAuthorizationServerEndpoints endpoints, com.nimbusds.jose.util.ResourceRetriever resourceRetriever, com.nimbusds.jose.jwk.source.JWKSetCache jwkSetCache, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder)
      Creates a new instance of AadAuthenticationFilter.
      Parameters:
      aadAuthenticationProperties - the AAD authentication properties
      endpoints - the AAD authorization server endpoints
      resourceRetriever - the resource retriever
      restTemplateBuilder - the RestTemplateBuilder
      jwkSetCache - the JWK set cache
    • AadAuthenticationFilter

      public AadAuthenticationFilter(AadAuthenticationProperties aadAuthenticationProperties, AadAuthorizationServerEndpoints endpoints, UserPrincipalManager userPrincipalManager, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder)
      Creates a new instance of AadAuthenticationFilter.
      Parameters:
      aadAuthenticationProperties - the AAD authentication properties
      endpoints - the AAD authorization server endpoints
      userPrincipalManager - the user principal manager
      restTemplateBuilder - the restTemplateBuilder
  • Method Details

    • doFilterInternal

      protected void doFilterInternal(jakarta.servlet.http.HttpServletRequest httpServletRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse, jakarta.servlet.FilterChain filterChain) throws jakarta.servlet.ServletException, IOException
      Do filter.
      Specified by:
      doFilterInternal in class org.springframework.web.filter.OncePerRequestFilter
      Parameters:
      httpServletRequest - the http servlet request
      httpServletResponse - the http servlet responce
      filterChain - the filter chain
      Throws:
      jakarta.servlet.ServletException
      IOException