Class TenantAwareBasicAuthenticationFilter
java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.web.filter.OncePerRequestFilter
org.springframework.security.web.authentication.www.BasicAuthenticationFilter
org.apache.fineract.infrastructure.security.filter.TenantAwareBasicAuthenticationFilter
- 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 TenantAwareBasicAuthenticationFilter
extends org.springframework.security.web.authentication.www.BasicAuthenticationFilter
A customised version of spring security's
BasicAuthenticationFilter.
This filter is responsible for extracting multi-tenant and basic auth credentials from the request and checking that
the details provided are valid.
If multi-tenant and basic auth credentials are valid, the details of the tenant are stored in
FineractPlatformTenant and stored in a ThreadLocal variable for this request using
ThreadLocalContextUtil.
If multi-tenant and basic auth credentials are invalid, a http error response is returned.-
Field Summary
Fields inherited from class org.springframework.web.filter.OncePerRequestFilter
ALREADY_FILTERED_SUFFIXFields inherited from class org.springframework.web.filter.GenericFilterBean
logger -
Constructor Summary
ConstructorsConstructorDescriptionTenantAwareBasicAuthenticationFilter(org.springframework.security.authentication.AuthenticationManager authenticationManager, org.springframework.security.web.AuthenticationEntryPoint authenticationEntryPoint, org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer<PlatformRequestLog> toApiJsonSerializer, org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService configurationDomainService, org.apache.fineract.infrastructure.cache.service.CacheWritePlatformService cacheWritePlatformService, UserNotificationService userNotificationService, BasicAuthTenantDetailsService basicAuthTenantDetailsService, org.apache.fineract.infrastructure.businessdate.service.BusinessDateReadPlatformService businessDateReadPlatformService) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoFilterInternal(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain filterChain) protected voidonSuccessfulAuthentication(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authResult) Methods inherited from class org.springframework.security.web.authentication.www.BasicAuthenticationFilter
afterPropertiesSet, authenticationIsRequired, getAuthenticationEntryPoint, getAuthenticationManager, getCredentialsCharset, isIgnoreFailure, onUnsuccessfulAuthentication, setAuthenticationConverter, setAuthenticationDetailsSource, setCredentialsCharset, setRememberMeServices, setSecurityContextHolderStrategy, setSecurityContextRepositoryMethods inherited from class org.springframework.web.filter.OncePerRequestFilter
doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatchMethods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
-
Constructor Details
-
TenantAwareBasicAuthenticationFilter
public TenantAwareBasicAuthenticationFilter(org.springframework.security.authentication.AuthenticationManager authenticationManager, org.springframework.security.web.AuthenticationEntryPoint authenticationEntryPoint, org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer<PlatformRequestLog> toApiJsonSerializer, org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService configurationDomainService, org.apache.fineract.infrastructure.cache.service.CacheWritePlatformService cacheWritePlatformService, UserNotificationService userNotificationService, BasicAuthTenantDetailsService basicAuthTenantDetailsService, org.apache.fineract.infrastructure.businessdate.service.BusinessDateReadPlatformService businessDateReadPlatformService)
-
-
Method Details
-
doFilterInternal
protected void doFilterInternal(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain filterChain) throws jakarta.servlet.ServletException, IOException - Overrides:
doFilterInternalin classorg.springframework.security.web.authentication.www.BasicAuthenticationFilter- Throws:
jakarta.servlet.ServletExceptionIOException
-
onSuccessfulAuthentication
protected void onSuccessfulAuthentication(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authResult) throws IOException - Overrides:
onSuccessfulAuthenticationin classorg.springframework.security.web.authentication.www.BasicAuthenticationFilter- Throws:
IOException
-