Class AuthenticationProviderToken
java.lang.Object
org.apache.pulsar.broker.authentication.AuthenticationProviderToken
- All Implemented Interfaces:
Closeable,AutoCloseable,AuthenticationProvider
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(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()static StringgetToken(AuthenticationDataSource authData) 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.static voidMethods 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
authenticateAsync, authenticateHttpRequestAsync, incrementFailureMetric
-
Constructor Details
-
AuthenticationProviderToken
public AuthenticationProviderToken()
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
resetMetrics
public static void resetMetrics() -
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 failsIllegalArgumentException
-
getAuthMethodName
- Specified by:
getAuthMethodNamein interfaceAuthenticationProvider- Returns:
- the authentication method name supported by this provider
-
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
-
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
-
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
-
getToken
- Throws:
AuthenticationException
-