Class AuthenticationProviderList
java.lang.Object
org.apache.pulsar.broker.authentication.AuthenticationProviderList
- All Implemented Interfaces:
Closeable,AutoCloseable,AuthenticationProvider
An authentication provider wraps a list of auth providers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(AuthenticationDataSource authData) Validate the authentication for the given credentials with the specified authentication data.authenticateAsync(AuthenticationDataSource authData) Validate the authentication for the given credentials with the specified authentication data.booleanauthenticateHttpRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Set response, according to passed in request.voidclose()voidinitialize(ServiceConfiguration config) Perform initialization for the authentication provider.newAuthState(org.apache.pulsar.common.api.AuthData authData, SocketAddress remoteAddress, SSLSession sslSession) Create an authentication data State use passed in AuthenticationDataSource.newHttpAuthState(javax.servlet.http.HttpServletRequest request) Create an http authentication data State use passed in AuthenticationDataSource.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.pulsar.broker.authentication.AuthenticationProvider
authenticateHttpRequestAsync, incrementFailureMetric
-
Constructor Details
-
AuthenticationProviderList
-
-
Method Details
-
getProviders
-
initialize
Description copied from interface:AuthenticationProviderPerform initialization for the authentication provider.- Specified by:
initializein interfaceAuthenticationProvider- Parameters:
config- broker config object- Throws:
IOException- if the initialization fails
-
getAuthMethodName
- Specified by:
getAuthMethodNamein interfaceAuthenticationProvider- Returns:
- the authentication method name supported by this provider
-
authenticateAsync
Description copied from interface:AuthenticationProviderValidate the authentication for the given credentials with the specified authentication data. This method is useful in one stage authentication, if you're not doing one stage or if you're providing your own state implementation for one stage authentication, it should return a failed future.Warning: the calling thread is an IO thread. Any implementation that relies on blocking behavior must ensure that the execution is completed using a separate thread pool to ensure IO threads are never blocked.
- Specified by:
authenticateAsyncin interfaceAuthenticationProvider- Parameters:
authData- authentication data generated while initiating a connection. There are several types, including, but not strictly limited to,AuthenticationDataHttp,AuthenticationDataHttps, andAuthenticationDataCommand.- Returns:
- A completed future with the "role" string for the authenticated connection, if authentication is successful, or a failed future if the authData is not valid.
-
authenticate
Description copied from interface:AuthenticationProviderValidate the authentication for the given credentials with the specified authentication data. This method is useful in one stage authn, if you're not doing one stage or if you're providing your own state implementation for one stage authn, it should throw an exception.- Specified by:
authenticatein interfaceAuthenticationProvider- Parameters:
authData- provider specific authentication data- Returns:
- the "role" string for the authenticated connection, if the authentication was successful
- Throws:
AuthenticationException- if the credentials are not valid
-
newAuthState
public AuthenticationState newAuthState(org.apache.pulsar.common.api.AuthData authData, SocketAddress remoteAddress, SSLSession sslSession) throws AuthenticationException Description copied from interface:AuthenticationProviderCreate an authentication data State use passed in AuthenticationDataSource.- Specified by:
newAuthStatein interfaceAuthenticationProvider- Throws:
AuthenticationException
-
newHttpAuthState
public AuthenticationState newHttpAuthState(javax.servlet.http.HttpServletRequest request) throws AuthenticationException Description copied from interface:AuthenticationProviderCreate an http authentication data State use passed in AuthenticationDataSource.- Specified by:
newHttpAuthStatein interfaceAuthenticationProvider- Throws:
AuthenticationException
-
authenticateHttpRequest
public boolean authenticateHttpRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception Description copied from interface:AuthenticationProviderSet response, according to passed in request. and return whether we should do following chain.doFilter or not.Implementations of this method MUST modify the request by adding the
AuthenticatedRoleAttributeNameand theAuthenticatedDataAttributeNameattributes.- Specified by:
authenticateHttpRequestin interfaceAuthenticationProvider- Returns:
- Set response, according to passed in request, and return whether we should do following chain.doFilter.
- Throws:
Exception- when authentication failed
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-