java.lang.Object
org.keycloak.adapters.authorization.integration.elytron.ServletHttpRequest
All Implemented Interfaces:
HttpRequest

public class ServletHttpRequest extends Object implements HttpRequest
Author:
Pedro Igor
  • Constructor Details

    • ServletHttpRequest

      public ServletHttpRequest(jakarta.servlet.http.HttpServletRequest request, TokenPrincipal tokenPrincipal)
  • Method Details

    • getRelativePath

      public String getRelativePath()
      Description copied from interface: HttpRequest
      Get 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:
      getRelativePath in interface HttpRequest
      Returns:
      the relative path
    • getMethod

      public String getMethod()
      Description copied from interface: HttpRequest
      Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
      Specified by:
      getMethod in interface HttpRequest
      Returns:
      a String specifying the name of the method with which this request was made
    • getURI

      public String getURI()
      Description copied from interface: HttpRequest
      Get the URI representation for the current request.
      Specified by:
      getURI in interface HttpRequest
      Returns:
      a String representation for the current request
    • getHeaders

      public List<String> getHeaders(String name)
      Description copied from interface: HttpRequest
      Get a list of all of the values set for the specified header within the HTTP request.
      Specified by:
      getHeaders in interface HttpRequest
      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

      public String getFirstParam(String name)
      Description copied from interface: HttpRequest
      Get the first value for a parameter with the given name
      Specified by:
      getFirstParam in interface HttpRequest
      Parameters:
      name - the parameter name
      Returns:
      the value of the parameter
    • getCookieValue

      public String getCookieValue(String name)
      Description copied from interface: HttpRequest
      Get the first value for a cookie with the given name.
      Specified by:
      getCookieValue in interface HttpRequest
      Parameters:
      name - the parameter name
      Returns:
      the value of the cookie
    • getRemoteAddr

      public String getRemoteAddr()
      Description copied from interface: HttpRequest
      Returns the client address.
      Specified by:
      getRemoteAddr in interface HttpRequest
      Returns:
      the client address.
    • isSecure

      public boolean isSecure()
      Description copied from interface: HttpRequest
      Indicates if the request is coming from a secure channel through HTTPS.
      Specified by:
      isSecure in interface HttpRequest
      Returns:
      true if the HTTP scheme is set to 'https'. Otherwise, false
    • getHeader

      public String getHeader(String name)
      Description copied from interface: HttpRequest
      Get the first value for a HEADER with the given name.
      Specified by:
      getHeader in interface HttpRequest
      Parameters:
      name - the HEADER name
      Returns:
      the value of the HEADER
    • getInputStream

      public InputStream getInputStream(boolean buffered)
      Description copied from interface: HttpRequest
      Returns the request input stream
      Specified by:
      getInputStream in interface HttpRequest
      Parameters:
      buffered - if the input stream should be buffered and support for multiple reads
      Returns:
      the request input stream
    • getPrincipal

      public TokenPrincipal getPrincipal()
      Description copied from interface: HttpRequest
      Returns a TokenPrincipal associated with the request.
      Specified by:
      getPrincipal in interface HttpRequest
      Returns:
      the principal