Package org.wildfly.security.http
Class HttpAuthenticator
- java.lang.Object
-
- org.wildfly.security.http.HttpAuthenticator
-
public class HttpAuthenticator extends Object
A HTTP based authenticator responsible for performing the authentication of the current request based on the policies of the associatedSecurityDomain
.- Author:
- Darran Lofthouse
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
HttpAuthenticator.AuthenticationExchange
static class
HttpAuthenticator.Builder
ABuilder
to configure and create an instance ofHttpAuthenticator
.
-
Field Summary
Fields Modifier and Type Field Description private HttpExchangeSpi
httpExchangeSpi
private IdentityCache
identityCache
private Supplier<IdentityCache>
identityCacheSupplier
private boolean
ignoreOptionalFailures
private Consumer<Runnable>
logoutHandlerConsumer
private Supplier<List<HttpServerAuthenticationMechanism>>
mechanismSupplier
private static String
MY_AUTHENTICATED_IDENTITY_KEY
private String
programmaticMechanismName
private boolean
required
private SecurityDomain
securityDomain
-
Constructor Summary
Constructors Modifier Constructor Description private
HttpAuthenticator(HttpAuthenticator.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
authenticate()
Perform authentication for the request.static HttpAuthenticator.Builder
builder()
Construct and return a newBuilder
to configure and create an instance ofHttpAuthenticator
.private IdentityCache
createIdentityCache(String mechanismName)
private ServerAuthenticationContext
createServerAuthenticationContext()
private HttpScope
getAttachableSessionScope(boolean createSession)
private IdentityCache
getOrCreateIdentityCache()
SecurityIdentity
login(String username, String password)
Perform a login for the supplied username and password using the pre-configured mechanism name.private SecurityIdentity
login(String username, Evidence evidence, String mechanismName)
Perform a login for the supplied username and password using the specified mechanism name.private boolean
restoreIdentity()
-
-
-
Field Detail
-
MY_AUTHENTICATED_IDENTITY_KEY
private static final String MY_AUTHENTICATED_IDENTITY_KEY
-
mechanismSupplier
private final Supplier<List<HttpServerAuthenticationMechanism>> mechanismSupplier
-
identityCacheSupplier
private final Supplier<IdentityCache> identityCacheSupplier
-
securityDomain
private final SecurityDomain securityDomain
-
httpExchangeSpi
private final HttpExchangeSpi httpExchangeSpi
-
required
private final boolean required
-
ignoreOptionalFailures
private final boolean ignoreOptionalFailures
-
programmaticMechanismName
private final String programmaticMechanismName
-
identityCache
private volatile IdentityCache identityCache
-
-
Constructor Detail
-
HttpAuthenticator
private HttpAuthenticator(HttpAuthenticator.Builder builder)
-
-
Method Detail
-
authenticate
public boolean authenticate() throws HttpAuthenticationException
Perform authentication for the request.- Returns:
true
if the call should be allowed to continue within the web server,false
if the call should be returning to the client.- Throws:
HttpAuthenticationException
-
login
public SecurityIdentity login(String username, String password)
Perform a login for the supplied username and password using the pre-configured mechanism name.- Parameters:
username
- the username to use for authentication.password
- the password to use for authentication.- Returns:
- A
SecurityIdentity
is authentication and authorization is successful.
-
login
private SecurityIdentity login(String username, Evidence evidence, String mechanismName)
Perform a login for the supplied username and password using the specified mechanism name.- Parameters:
username
- the username to use for authentication.evidence
- the evidence to use for authentication.- Returns:
- A
SecurityIdentity
is authentication and authorization is successful.
-
createServerAuthenticationContext
private ServerAuthenticationContext createServerAuthenticationContext()
-
restoreIdentity
private boolean restoreIdentity()
-
getOrCreateIdentityCache
private IdentityCache getOrCreateIdentityCache()
-
createIdentityCache
private IdentityCache createIdentityCache(String mechanismName)
-
getAttachableSessionScope
private HttpScope getAttachableSessionScope(boolean createSession)
-
builder
public static HttpAuthenticator.Builder builder()
Construct and return a newBuilder
to configure and create an instance ofHttpAuthenticator
.- Returns:
- a new
Builder
to configure and create an instance ofHttpAuthenticator
.
-
-