Package org.wildfly.security.http
Class HttpServerRequestWrapper
- java.lang.Object
-
- org.wildfly.security.http.HttpServerRequestWrapper
-
- All Implemented Interfaces:
HttpServerRequest,HttpServerScopes
public class HttpServerRequestWrapper extends Object implements HttpServerRequest
A wrapper delegating any request to the delegated implementation.Determined to be used as base class for
HttpServerRequestwithout need to implement methods delegating requests to the delegated implementation.- Author:
- Pedro Igor
-
-
Constructor Summary
Constructors Constructor Description HttpServerRequestWrapper(HttpServerRequest delegate)Construct new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidauthenticationComplete(HttpServerMechanismsResponder responder)Notification that authentication is now complete.voidauthenticationComplete(HttpServerMechanismsResponder responder, Runnable logoutHandler)Notification that authentication is now complete.voidauthenticationFailed(String message, HttpServerMechanismsResponder responder)Notification that authentication failes.voidauthenticationInProgress(HttpServerMechanismsResponder responder)Notification that this mechanism has commenced but not completed authentication, typically because another challenge / response round trip is required.voidbadRequest(HttpAuthenticationException failure, HttpServerMechanismsResponder responder)Notification to indicate that this was a bad request.List<HttpServerCookie>getCookies()Returns aListcontaining all of theHttpServerCookieobjects the client sent with this request, or an emptyListif no cookies were included in the request.StringgetFirstParameterValue(String name)Get the first value for the parameter specified.StringgetFirstRequestHeaderValue(String headerName)Get the first value for the header specified in the HTTP request.InputStreamgetInputStream()Returns the request input stream.Set<String>getParameterNames()Returns the names of all parameters either from the query string or from the form data where available.Map<String,List<String>>getParameters()Returns the parameters received in the current request.List<String>getParameterValues(String name)Return the values for the parameter specified, where a parameter is specified both in the query string and in the form data the query string values will be first in theList.Certificate[]getPeerCertificates()Get the peer certificates established on the connection.List<String>getRequestHeaderValues(String headerName)Get a list of all of the values set for the specified header within the HTTP request.StringgetRequestMethod()Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.StringgetRequestPath()Get the request path.URIgetRequestURI()Get the URI representation for the current request.HttpScopegetScope(Scope scope)Get the specifiedHttpScopeif available.HttpScopegetScope(Scope scope, String id)Get the specifiedHttpScopewith the specified ID.Collection<String>getScopeIds(Scope scope)Get the IDs available for the scope specified.InetSocketAddressgetSourceAddress()Get the source address of the HTTP request.SSLSessiongetSSLSession()Get theSSLSession(if any) that has been established for the connection in use.voidnoAuthenticationInProgress(HttpServerMechanismsResponder responder)Notification from the mechanism to state no authentication is in progress whilst evaluating the current request.booleanresumeRequest()Resume any previously suspended request.booleansuspendRequest()Suspend the current request so that it can be subsequently resumed.-
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, getRemoteUser, noAuthenticationInProgress, setRequestInputStreamSupplier
-
-
-
-
Constructor Detail
-
HttpServerRequestWrapper
public HttpServerRequestWrapper(HttpServerRequest delegate)
Construct new instance.- Parameters:
delegate- a request to which will be delegated any requests
-
-
Method Detail
-
getScope
public HttpScope getScope(Scope scope)
Description copied from interface:HttpServerScopesGet the specifiedHttpScopeif available.- Specified by:
getScopein interfaceHttpServerScopes- Parameters:
scope- the type of the scope required.- Returns:
- the scope specified or
nullif not supported.
-
getScopeIds
public Collection<String> getScopeIds(Scope scope)
Description copied from interface:HttpServerScopesGet the IDs available for the scope specified.- Specified by:
getScopeIdsin interfaceHttpServerScopes- Parameters:
scope- the scope the IDs are required for.- Returns:
- The IDs available for the scope specified or
nullif the scope specified does not support obtaining scopes by ID.
-
getScope
public HttpScope getScope(Scope scope, String id)
Description copied from interface:HttpServerScopesGet the specifiedHttpScopewith the specified ID.- Specified by:
getScopein interfaceHttpServerScopes- Parameters:
scope- the type of the scope required.id- the id of the scope instance required.- Returns:
- the scope specified or
nullif not supported or if the scope with that ID does not exist.
-
getRequestHeaderValues
public List<String> getRequestHeaderValues(String headerName)
Description copied from interface:HttpServerRequestGet a list of all of the values set for the specified header within the HTTP request.- Specified by:
getRequestHeaderValuesin interfaceHttpServerRequest- Parameters:
headerName- the notnullname of the header the values are required for.- Returns:
- a list of the values set for this header, if the header is not set on the request then
nullshould be returned.
-
getFirstRequestHeaderValue
public String getFirstRequestHeaderValue(String headerName)
Description copied from interface:HttpServerRequestGet the first value for the header specified in the HTTP request.- Specified by:
getFirstRequestHeaderValuein interfaceHttpServerRequest- Parameters:
headerName- the notnullname of the header the value is required for.- Returns:
- the value for the first instance of the header specified, if the header is not present then
nullshould be returned instead.
-
getSSLSession
public SSLSession getSSLSession()
Description copied from interface:HttpServerRequestGet theSSLSession(if any) that has been established for the connection in use. Note that even if this is nullHttpServerRequest.getPeerCertificates()can still return some certificates, as the certificates may have been provided to the underlying server via some external mechanism (such as headers).- Specified by:
getSSLSessionin interfaceHttpServerRequest- Returns:
- the
SSLSession(if any) that has been established for the connection in use, ornullif none exists.
-
getPeerCertificates
public Certificate[] getPeerCertificates()
Description copied from interface:HttpServerRequestGet the peer certificates established on the connection.- Specified by:
getPeerCertificatesin interfaceHttpServerRequest- Returns:
- the peer certificates established on the connection or
nullif none available.
-
noAuthenticationInProgress
public void noAuthenticationInProgress(HttpServerMechanismsResponder responder)
Description copied from interface:HttpServerRequestNotification from the mechanism to state no authentication is in progress whilst evaluating the current request.- Specified by:
noAuthenticationInProgressin interfaceHttpServerRequest- Parameters:
responder- aHttpServerMechanismsResponderthat can send a challenge should it be required.
-
authenticationInProgress
public void authenticationInProgress(HttpServerMechanismsResponder responder)
Description copied from interface:HttpServerRequestNotification that this mechanism has commenced but not completed authentication, typically because another challenge / response round trip is required.- Specified by:
authenticationInProgressin interfaceHttpServerRequest- Parameters:
responder- aHttpServerMechanismsResponderthat can send a challenge should it be required.
-
authenticationComplete
public void authenticationComplete(HttpServerMechanismsResponder responder)
Description copied from interface:HttpServerRequestNotification 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:
authenticationCompletein interfaceHttpServerRequest- Parameters:
responder- aHttpServerMechanismsResponderthat can send a response.
-
authenticationComplete
public void authenticationComplete(HttpServerMechanismsResponder responder, Runnable logoutHandler)
Description copied from interface:HttpServerRequestNotification 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:
authenticationCompletein interfaceHttpServerRequest- Parameters:
responder- aHttpServerMechanismsResponderthat can send a response.logoutHandler- aRunnablethat can handle logout
-
authenticationFailed
public void authenticationFailed(String message, HttpServerMechanismsResponder responder)
Description copied from interface:HttpServerRequestNotification that authentication failes.- Specified by:
authenticationFailedin interfaceHttpServerRequest- Parameters:
message- an error message describing the failure.responder- aHttpServerMechanismsResponderthat can send a challenge should it be required.
-
badRequest
public void badRequest(HttpAuthenticationException failure, HttpServerMechanismsResponder responder)
Description copied from interface:HttpServerRequestNotification to indicate that this was a bad request.- Specified by:
badRequestin interfaceHttpServerRequest- Parameters:
failure- anHttpAuthenticationExceptionto describe the error.responder- aHttpServerMechanismsResponderthat can send a challenge should it be required.
-
getRequestMethod
public String getRequestMethod()
Description copied from interface:HttpServerRequestReturns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.- Specified by:
getRequestMethodin interfaceHttpServerRequest- Returns:
- a
Stringspecifying the name of the method with which this request was made
-
getRequestURI
public URI getRequestURI()
Description copied from interface:HttpServerRequestGet the URI representation for the current request.- Specified by:
getRequestURIin interfaceHttpServerRequest- Returns:
- the URI representation for the current request.
-
getRequestPath
public String getRequestPath()
Description copied from interface:HttpServerRequestGet the request path. This is the path relative to the context path. E.g.: for a HTTP GET request tohttp://my.appserver.com/my-application/path/sub-paththis method is going to return/path/sub-path.- Specified by:
getRequestPathin interfaceHttpServerRequest- Returns:
- the request path
-
getParameters
public Map<String,List<String>> getParameters()
Description copied from interface:HttpServerRequestReturns the parameters received in the current request. These parameters will be from both the query string and the form data when available. Where a parameter is named both in the query string and in the form data theListwill contain the values from the query string followed by the values from the form data.- Specified by:
getParametersin interfaceHttpServerRequest- Returns:
- the parameters received in the current request.
-
getParameterNames
public Set<String> getParameterNames()
Description copied from interface:HttpServerRequestReturns the names of all parameters either from the query string or from the form data where available.- Specified by:
getParameterNamesin interfaceHttpServerRequest- Returns:
- the names of all parameters either from the query string or from the form data where available.
-
getParameterValues
public List<String> getParameterValues(String name)
Description copied from interface:HttpServerRequestReturn the values for the parameter specified, where a parameter is specified both in the query string and in the form data the query string values will be first in theList.- Specified by:
getParameterValuesin interfaceHttpServerRequest- Parameters:
name- the name of the desires parameter values.- Returns:
- the values for the parameter specified or
nullif the parameter was not in the request.
-
getFirstParameterValue
public String getFirstParameterValue(String name)
Description copied from interface:HttpServerRequestGet the first value for the parameter specified.- Specified by:
getFirstParameterValuein interfaceHttpServerRequest- Parameters:
name- the name of the parameter the first value is required for.- Returns:
- the first value of the named parameter or
nullif the parameter is not available.
-
getCookies
public List<HttpServerCookie> getCookies()
Description copied from interface:HttpServerRequestReturns aListcontaining all of theHttpServerCookieobjects the client sent with this request, or an emptyListif no cookies were included in the request.- Specified by:
getCookiesin interfaceHttpServerRequest- Returns:
- a
Listcontaining all of theHttpServerCookieobjects the client sent with this request, or an emptyListif no cookies were included in the request.
-
getInputStream
public InputStream getInputStream()
Description copied from interface:HttpServerRequestReturns the request input stream.- Specified by:
getInputStreamin interfaceHttpServerRequest- Returns:
- the input stream or
nullif not supported.
-
getSourceAddress
public InetSocketAddress getSourceAddress()
Description copied from interface:HttpServerRequestGet the source address of the HTTP request.- Specified by:
getSourceAddressin interfaceHttpServerRequest- Returns:
- the source address of the HTTP request
-
suspendRequest
public boolean suspendRequest()
Description copied from interface:HttpServerRequestSuspend the current request so that it can be subsequently resumed.- Specified by:
suspendRequestin interfaceHttpServerRequest- Returns:
trueif suspending requests is supported,falseotherwise.
-
resumeRequest
public boolean resumeRequest()
Description copied from interface:HttpServerRequestResume any previously suspended request.- Specified by:
resumeRequestin interfaceHttpServerRequest- Returns:
trueif resuming requests is supported,falseotherwise.
-
-