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
ConstructorDescriptionAadAuthenticationFilter
(AadAuthenticationProperties aadAuthenticationProperties, AadAuthorizationServerEndpoints endpoints, UserPrincipalManager userPrincipalManager, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder) Creates a new instance ofAadAuthenticationFilter
.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 ofAadAuthenticationFilter
.AadAuthenticationFilter
(AadAuthenticationProperties aadAuthenticationProperties, AadAuthorizationServerEndpoints endpoints, com.nimbusds.jose.util.ResourceRetriever resourceRetriever, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder) Creates a new instance ofAadAuthenticationFilter
. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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
-
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 ofAadAuthenticationFilter
.- Parameters:
aadAuthenticationProperties
- the AAD authentication propertiesendpoints
- the AAD authorization server endpointsresourceRetriever
- the resource retrieverrestTemplateBuilder
- 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 ofAadAuthenticationFilter
.- Parameters:
aadAuthenticationProperties
- the AAD authentication propertiesendpoints
- the AAD authorization server endpointsresourceRetriever
- the resource retrieverrestTemplateBuilder
- the RestTemplateBuilderjwkSetCache
- the JWK set cache
-
AadAuthenticationFilter
public AadAuthenticationFilter(AadAuthenticationProperties aadAuthenticationProperties, AadAuthorizationServerEndpoints endpoints, UserPrincipalManager userPrincipalManager, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder) Creates a new instance ofAadAuthenticationFilter
.- Parameters:
aadAuthenticationProperties
- the AAD authentication propertiesendpoints
- the AAD authorization server endpointsuserPrincipalManager
- the user principal managerrestTemplateBuilder
- 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 classorg.springframework.web.filter.OncePerRequestFilter
- Parameters:
httpServletRequest
- the http servlet requesthttpServletResponse
- the http servlet responcefilterChain
- the filter chain- Throws:
jakarta.servlet.ServletException
IOException
-