Class ServletHttpRequest
java.lang.Object
org.keycloak.adapters.authorization.integration.elytron.ServletHttpRequest
- All Implemented Interfaces:
HttpRequest
- Author:
- Pedro Igor
-
Constructor Summary
ConstructorsConstructorDescriptionServletHttpRequest(jakarta.servlet.http.HttpServletRequest request, TokenPrincipal tokenPrincipal) -
Method Summary
Modifier and TypeMethodDescriptiongetCookieValue(String name) Get the first value for a cookie with the givenname.getFirstParam(String name) Get the first value for a parameter with the givennameGet the first value for a HEADER with the givenname.getHeaders(String name) Get a list of all of the values set for the specified header within the HTTP request.getInputStream(boolean buffered) Returns the request input streamReturns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.Returns aTokenPrincipalassociated with the request.Get the request path.Returns the client address.getURI()Get the URI representation for the current request.booleanisSecure()Indicates if the request is coming from a secure channel through HTTPS.
-
Constructor Details
-
ServletHttpRequest
public ServletHttpRequest(jakarta.servlet.http.HttpServletRequest request, TokenPrincipal tokenPrincipal)
-
-
Method Details
-
getRelativePath
Description copied from interface:HttpRequestGet the request path. This is the path relative to the context path. E.g.: for a HTTP GET request to http://my.appserver.com/my-application/path/sub-path this method is going to return /path/sub-path.- Specified by:
getRelativePathin interfaceHttpRequest- Returns:
- the relative path
-
getMethod
Description copied from interface:HttpRequestReturns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.- Specified by:
getMethodin interfaceHttpRequest- Returns:
- a
Stringspecifying the name of the method with which this request was made
-
getURI
Description copied from interface:HttpRequestGet the URI representation for the current request.- Specified by:
getURIin interfaceHttpRequest- Returns:
- a
Stringrepresentation for the current request
-
getHeaders
Description copied from interface:HttpRequestGet a list of all of the values set for the specified header within the HTTP request.- Specified by:
getHeadersin interfaceHttpRequest- Parameters:
name- the header name- Returns:
- a list of the values set for this header, if the header is not set on the request then null should be returned
-
getFirstParam
Description copied from interface:HttpRequestGet the first value for a parameter with the givenname- Specified by:
getFirstParamin interfaceHttpRequest- Parameters:
name- the parameter name- Returns:
- the value of the parameter
-
getCookieValue
Description copied from interface:HttpRequestGet the first value for a cookie with the givenname.- Specified by:
getCookieValuein interfaceHttpRequest- Parameters:
name- the parameter name- Returns:
- the value of the cookie
-
getRemoteAddr
Description copied from interface:HttpRequestReturns the client address.- Specified by:
getRemoteAddrin interfaceHttpRequest- Returns:
- the client address.
-
isSecure
public boolean isSecure()Description copied from interface:HttpRequestIndicates if the request is coming from a secure channel through HTTPS.- Specified by:
isSecurein interfaceHttpRequest- Returns:
trueif the HTTP scheme is set to 'https'. Otherwise,false
-
getHeader
Description copied from interface:HttpRequestGet the first value for a HEADER with the givenname.- Specified by:
getHeaderin interfaceHttpRequest- Parameters:
name- the HEADER name- Returns:
- the value of the HEADER
-
getInputStream
Description copied from interface:HttpRequestReturns the request input stream- Specified by:
getInputStreamin interfaceHttpRequest- Parameters:
buffered- if the input stream should be buffered and support for multiple reads- Returns:
- the request input stream
-
getPrincipal
Description copied from interface:HttpRequestReturns aTokenPrincipalassociated with the request.- Specified by:
getPrincipalin interfaceHttpRequest- Returns:
- the principal
-