Package io.hawt.system
Class Authenticator
java.lang.Object
io.hawt.system.Authenticator
Authenticator performs authentication using JAAS with the
LoginContext for the chosen realm.
Authenticator supports the following authentication methods:
- a set of user name and password
- oidc (bearer) access token
- client certificates
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAuthenticator(AuthenticationConfiguration authConfiguration, String username, String password) Explicit username/password authenticator when authenticating users from login page.Authenticator(jakarta.servlet.http.HttpServletRequest request, AuthenticationConfiguration authConfiguration) Request-based authenticator such as when authenticating direct Jolokia accesses. -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(Consumer<Subject> callback) protected booleancheckRoles(Subject subject, String role, String rolePrincipalClasses) protected Subjectstatic voidextractAuthHeader(jakarta.servlet.http.HttpServletRequest request, BiConsumer<String, String> callback) Extracts username/password from Authorization header.static voidextractAuthHeader(jakarta.servlet.http.HttpServletRequest request, BiConsumer<String, String> callback, boolean checkExtraHeaders) Extracts username/password from Authorization header.booleanbooleanprotected voidlogin(Subject subject, String realm, Configuration configuration) static voidlogout(AuthenticationConfiguration authConfiguration, Subject subject)
-
Field Details
-
HEADER_AUTHORIZATION
- See Also:
-
X_J_HEADER_AUTHORIZATION
- See Also:
-
AUTHENTICATION_SCHEME_BASIC
- See Also:
-
AUTHENTICATION_SCHEME_BEARER
- See Also:
-
ATTRIBUTE_X509_CERTIFICATE
- See Also:
-
-
Constructor Details
-
Authenticator
public Authenticator(AuthenticationConfiguration authConfiguration, String username, String password) Explicit username/password authenticator when authenticating users from login page. -
Authenticator
public Authenticator(jakarta.servlet.http.HttpServletRequest request, AuthenticationConfiguration authConfiguration) Request-based authenticator such as when authenticating direct Jolokia accesses.
-
-
Method Details
-
extractAuthHeader
public static void extractAuthHeader(jakarta.servlet.http.HttpServletRequest request, BiConsumer<String, String> callback) Extracts username/password from Authorization header. Callback is invoked only when Authorization header is present. -
extractAuthHeader
public static void extractAuthHeader(jakarta.servlet.http.HttpServletRequest request, BiConsumer<String, String> callback, boolean checkExtraHeaders) Extracts username/password from Authorization header. Callback is invoked only when Authorization header is present. -
isUsernamePasswordSet
public boolean isUsernamePasswordSet() -
hasNoCredentials
public boolean hasNoCredentials() -
logout
-
authenticate
-
doAuthenticate
-
login
protected void login(Subject subject, String realm, Configuration configuration) throws LoginException - Throws:
LoginException
-
checkRoles
-