Package org.wildfly.security.http
Class HttpAuthenticator.AuthenticationExchange
- java.lang.Object
-
- org.wildfly.security.http.impl.BaseHttpServerRequest
-
- org.wildfly.security.http.HttpAuthenticator.AuthenticationExchange
-
- All Implemented Interfaces:
HttpServerRequest
,HttpServerResponse
,HttpServerScopes
- Enclosing class:
- HttpAuthenticator
private class HttpAuthenticator.AuthenticationExchange extends BaseHttpServerRequest implements HttpServerRequest, HttpServerResponse
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
authenticationAttempted
private HttpServerAuthenticationMechanism
currentMechanism
private List<HttpServerMechanismsResponder>
responders
private int
statusCode
private boolean
statusCodeAllowed
private HttpServerMechanismsResponder
successResponder
-
Constructor Summary
Constructors Constructor Description AuthenticationExchange()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResponseHeader(String headerName, String headerValue)
Add the specified header and value to the end of the current response headers,private boolean
authenticate()
void
authenticationComplete(HttpServerMechanismsResponder responder)
Notification that authentication is now complete.void
authenticationComplete(HttpServerMechanismsResponder responder, Runnable logoutHandler)
Notification that authentication is now complete.void
authenticationFailed(String message, HttpServerMechanismsResponder responder)
Notification that authentication failes.void
authenticationInProgress(HttpServerMechanismsResponder responder)
Notification that this mechanism has commenced but not completed authentication, typically because another challenge / response round trip is required.void
badRequest(HttpAuthenticationException failure, HttpServerMechanismsResponder responder)
Notification to indicate that this was a bad request.boolean
forward(String path)
Forward the current request to a different path.OutputStream
getOutputStream()
Returns the output stream.Certificate[]
getPeerCertificates()
Get the peer certificates established on the connection.void
noAuthenticationInProgress(HttpServerMechanismsResponder responder)
Notification from the mechanism to state no authentication is in progress whilst evaluating the current request.boolean
resumeRequest()
Resume any previously suspended request.void
setResponseCookie(HttpServerCookie cookie)
Sets a response cookievoid
setStatusCode(int statusCode)
Set the desired status code for the current request.boolean
suspendRequest()
Suspend the current request so that it can be subsequently resumed.-
Methods inherited from class org.wildfly.security.http.impl.BaseHttpServerRequest
getCookies, getFirstParameterValue, getFirstRequestHeaderValue, getInputStream, getParameterNames, getParameters, getParameterValues, getRemoteUser, getRequestHeaderValues, getRequestMethod, getRequestPath, getRequestURI, getScope, getScope, getScopeIds, getSourceAddress, getSSLSession
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.security.http.HttpServerRequest
authenticationComplete, authenticationFailed, badRequest, getCookies, getFirstParameterValue, getFirstRequestHeaderValue, getInputStream, getParameterNames, getParameters, getParameterValues, getRemoteUser, getRequestHeaderValues, getRequestMethod, getRequestPath, getRequestURI, getSourceAddress, getSSLSession, noAuthenticationInProgress, setRequestInputStreamSupplier
-
Methods inherited from interface org.wildfly.security.http.HttpServerScopes
getScope, getScope, getScopeIds
-
-
-
-
Field Detail
-
currentMechanism
private volatile HttpServerAuthenticationMechanism currentMechanism
-
authenticationAttempted
private volatile boolean authenticationAttempted
-
statusCode
private volatile int statusCode
-
statusCodeAllowed
private volatile boolean statusCodeAllowed
-
responders
private volatile List<HttpServerMechanismsResponder> responders
-
successResponder
private volatile HttpServerMechanismsResponder successResponder
-
-
Method Detail
-
authenticate
private boolean authenticate() throws HttpAuthenticationException
- Throws:
HttpAuthenticationException
-
getPeerCertificates
public Certificate[] getPeerCertificates()
Description copied from interface:HttpServerRequest
Get the peer certificates established on the connection.- Specified by:
getPeerCertificates
in interfaceHttpServerRequest
- Overrides:
getPeerCertificates
in classBaseHttpServerRequest
- Returns:
- the peer certificates established on the connection or
null
if none available.
-
noAuthenticationInProgress
public void noAuthenticationInProgress(HttpServerMechanismsResponder responder)
Description copied from interface:HttpServerRequest
Notification from the mechanism to state no authentication is in progress whilst evaluating the current request.- Specified by:
noAuthenticationInProgress
in interfaceHttpServerRequest
- Parameters:
responder
- aHttpServerMechanismsResponder
that can send a challenge should it be required.
-
authenticationInProgress
public void authenticationInProgress(HttpServerMechanismsResponder responder)
Description copied from interface:HttpServerRequest
Notification that this mechanism has commenced but not completed authentication, typically because another challenge / response round trip is required.- Specified by:
authenticationInProgress
in interfaceHttpServerRequest
- Parameters:
responder
- aHttpServerMechanismsResponder
that can send a challenge should it be required.
-
authenticationComplete
public void authenticationComplete(HttpServerMechanismsResponder responder)
Description copied from interface:HttpServerRequest
Notification that authentication is now complete. After this point the framework will perform an authorization check for the authenticated user and if successful establish the identity of the request.- Specified by:
authenticationComplete
in interfaceHttpServerRequest
- Parameters:
responder
- aHttpServerMechanismsResponder
that can send a response.
-
authenticationComplete
public void authenticationComplete(HttpServerMechanismsResponder responder, Runnable logoutHandler)
Description copied from interface:HttpServerRequest
Notification that authentication is now complete.
This method behaves exactly like
{@link #authenticationComplete(HttpServerMechanismsResponder)}
, allowing mechanisms to register a logout handler which should be called when a logout request is received by the underlying container.- Specified by:
authenticationComplete
in interfaceHttpServerRequest
- Parameters:
responder
- aHttpServerMechanismsResponder
that can send a response.logoutHandler
- aRunnable
that can handle logout
-
authenticationFailed
public void authenticationFailed(String message, HttpServerMechanismsResponder responder)
Description copied from interface:HttpServerRequest
Notification that authentication failes.- Specified by:
authenticationFailed
in interfaceHttpServerRequest
- Parameters:
message
- an error message describing the failure.responder
- aHttpServerMechanismsResponder
that can send a challenge should it be required.
-
badRequest
public void badRequest(HttpAuthenticationException failure, HttpServerMechanismsResponder responder)
Description copied from interface:HttpServerRequest
Notification to indicate that this was a bad request.- Specified by:
badRequest
in interfaceHttpServerRequest
- Parameters:
failure
- anHttpAuthenticationException
to describe the error.responder
- aHttpServerMechanismsResponder
that can send a challenge should it be required.
-
addResponseHeader
public void addResponseHeader(String headerName, String headerValue)
Description copied from interface:HttpServerResponse
Add the specified header and value to the end of the current response headers,- Specified by:
addResponseHeader
in interfaceHttpServerResponse
- Parameters:
headerName
- the name of the header.headerValue
- the value of the header.
-
setStatusCode
public void setStatusCode(int statusCode)
Description copied from interface:HttpServerResponse
Set the desired status code for the current request. Note: If multiple mechanisms call this method then a resolution process will begin to decide which one to use.- Specified by:
setStatusCode
in interfaceHttpServerResponse
- Parameters:
statusCode
- the response code.
-
getOutputStream
public OutputStream getOutputStream()
Description copied from interface:HttpServerResponse
Returns the output stream.- Specified by:
getOutputStream
in interfaceHttpServerResponse
- Returns:
- the output stream or
null
if not supported.
-
setResponseCookie
public void setResponseCookie(HttpServerCookie cookie)
Description copied from interface:HttpServerResponse
Sets a response cookie- Specified by:
setResponseCookie
in interfaceHttpServerResponse
- Parameters:
cookie
- the cookie
-
forward
public boolean forward(String path)
Description copied from interface:HttpServerResponse
Forward the current request to a different path.- Specified by:
forward
in interfaceHttpServerResponse
- Returns:
true
if forwarding was supported and successful,false
otherwise.
-
suspendRequest
public boolean suspendRequest()
Description copied from interface:HttpServerRequest
Suspend the current request so that it can be subsequently resumed.- Specified by:
suspendRequest
in interfaceHttpServerRequest
- Returns:
true
if suspending requests is supported,false
otherwise.
-
resumeRequest
public boolean resumeRequest()
Description copied from interface:HttpServerRequest
Resume any previously suspended request.- Specified by:
resumeRequest
in interfaceHttpServerRequest
- Returns:
true
if resuming requests is supported,false
otherwise.
-
-