Package org.apache.tomcat.websocket
Class Authenticator
- java.lang.Object
-
- org.apache.tomcat.websocket.Authenticator
-
- Direct Known Subclasses:
BasicAuthenticator
,DigestAuthenticator
public abstract class Authenticator extends java.lang.Object
Base class for the authentication methods used by the WebSocket client.
-
-
Constructor Summary
Constructors Constructor Description Authenticator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract java.lang.String
getAuthorization(java.lang.String requestUri, java.lang.String authenticateHeader, java.lang.String userName, java.lang.String userPassword, java.lang.String userRealm)
Generate the authorization header value that will be sent to the server.java.lang.String
getAuthorization(java.lang.String requestUri, java.lang.String authenticateHeader, java.util.Map<java.lang.String,java.lang.Object> userProperties)
Deprecated.abstract java.lang.String
getSchemeName()
Get the authentication method.java.util.Map<java.lang.String,java.lang.String>
parseAuthenticateHeader(java.lang.String authenticateHeader)
Utility method to parse the authentication header.java.util.Map<java.lang.String,java.lang.String>
parseWWWAuthenticateHeader(java.lang.String authenticateHeader)
Deprecated.protected void
validatePassword(java.lang.String password)
protected void
validateRealm(java.lang.String userRealm, java.lang.String serverRealm)
protected void
validateUsername(java.lang.String userName)
-
-
-
Method Detail
-
getAuthorization
@Deprecated public java.lang.String getAuthorization(java.lang.String requestUri, java.lang.String authenticateHeader, java.util.Map<java.lang.String,java.lang.Object> userProperties) throws AuthenticationException
Deprecated.UsegetAuthorization(String, String, String, String, String)
. Will be removed in Tomcat 10.1.xGenerate the authorization header value that will be sent to the server.- Parameters:
requestUri
- The request URIauthenticateHeader
- The server authentication header receiveduserProperties
- The user information- Returns:
- The generated authorization header value
- Throws:
AuthenticationException
- When an error occurs
-
getAuthorization
public abstract java.lang.String getAuthorization(java.lang.String requestUri, java.lang.String authenticateHeader, java.lang.String userName, java.lang.String userPassword, java.lang.String userRealm) throws AuthenticationException
Generate the authorization header value that will be sent to the server.- Parameters:
requestUri
- The request URIauthenticateHeader
- The server authentication header receiveduserName
- The user nameuserPassword
- The user passworduserRealm
- The realm for which the provided user name and password are valid.null
to indicate all realms.- Returns:
- The generated authorization header value
- Throws:
AuthenticationException
- When an error occurs
-
getSchemeName
public abstract java.lang.String getSchemeName()
Get the authentication method.- Returns:
- the authentication scheme
-
parseWWWAuthenticateHeader
@Deprecated public java.util.Map<java.lang.String,java.lang.String> parseWWWAuthenticateHeader(java.lang.String authenticateHeader)
Deprecated.UseparseAuthenticateHeader(String)
. Will be removed in Tomcat 10.1.x onwardsUtility method to parse the authentication header.- Parameters:
authenticateHeader
- The server authenticate header received- Returns:
- a map of authentication parameter names and values
-
parseAuthenticateHeader
public java.util.Map<java.lang.String,java.lang.String> parseAuthenticateHeader(java.lang.String authenticateHeader)
Utility method to parse the authentication header.- Parameters:
authenticateHeader
- The server authenticate header received- Returns:
- a map of authentication parameter names and values
-
validateUsername
protected void validateUsername(java.lang.String userName) throws AuthenticationException
- Throws:
AuthenticationException
-
validatePassword
protected void validatePassword(java.lang.String password) throws AuthenticationException
- Throws:
AuthenticationException
-
validateRealm
protected void validateRealm(java.lang.String userRealm, java.lang.String serverRealm) throws AuthenticationException
- Throws:
AuthenticationException
-
-