Package org.apache.tomcat.websocket
Class Authenticator
java.lang.Object
org.apache.tomcat.websocket.Authenticator
- Direct Known Subclasses:
BasicAuthenticator
,DigestAuthenticator
Base class for the authentication methods used by the WebSocket client.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract String
getAuthorization
(String requestUri, String authenticateHeader, String userName, String userPassword, String userRealm) Generate the authorization header value that will be sent to the server.Deprecated.abstract String
Get the authentication method.parseAuthenticateHeader
(String authenticateHeader) Utility method to parse the authentication header.parseWWWAuthenticateHeader
(String authenticateHeader) Deprecated.protected void
validatePassword
(String password) protected void
validateRealm
(String userRealm, String serverRealm) protected void
validateUsername
(String userName)
-
Constructor Details
-
Authenticator
public Authenticator()
-
-
Method Details
-
getAuthorization
@Deprecated public String getAuthorization(String requestUri, String authenticateHeader, Map<String, Object> userProperties) throws AuthenticationExceptionDeprecated.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 String getAuthorization(String requestUri, String authenticateHeader, String userName, String userPassword, 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
Get the authentication method.- Returns:
- the authentication scheme
-
parseWWWAuthenticateHeader
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
Utility method to parse the authentication header.- Parameters:
authenticateHeader
- The server authenticate header received- Returns:
- a map of authentication parameter names and values
-
validateUsername
- Throws:
AuthenticationException
-
validatePassword
- Throws:
AuthenticationException
-
validateRealm
- Throws:
AuthenticationException
-
getAuthorization(String, String, String, String, String)
.