Package org.pac4j.play
Class PlayWebContext
- java.lang.Object
-
- org.pac4j.play.PlayWebContext
-
- All Implemented Interfaces:
org.pac4j.core.context.WebContext
public class PlayWebContext extends Object implements org.pac4j.core.context.WebContext
This class is the web context for Play (used both for Java and Scala).
"Session objects" are managed by the defined
SessionStore
.- Since:
- 1.1.0
- Author:
- Jerome Leleu
-
-
Field Summary
Fields Modifier and Type Field Description protected play.mvc.Http.RequestHeader
javaRequest
protected org.slf4j.Logger
logger
protected static play.libs.typedmap.TypedKey<Map<String,Object>>
PAC4J_REQUEST_ATTRIBUTES
protected String
requestContent
protected String
responseContentType
protected List<play.mvc.Http.Cookie>
responseCookies
protected Map<String,String>
responseHeaders
protected play.api.mvc.RequestHeader
scalaRequest
protected play.mvc.Http.Session
session
protected boolean
sessionHasChanged
protected PlaySessionStore
sessionStore
-
Constructor Summary
Constructors Constructor Description PlayWebContext(play.api.mvc.RequestHeader scalaRequest, PlaySessionStore sessionStore)
PlayWebContext(play.mvc.Http.RequestHeader javaRequest, PlaySessionStore sessionStore)
-
Method Summary
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
-
PAC4J_REQUEST_ATTRIBUTES
protected static final play.libs.typedmap.TypedKey<Map<String,Object>> PAC4J_REQUEST_ATTRIBUTES
-
javaRequest
protected play.mvc.Http.RequestHeader javaRequest
-
scalaRequest
protected play.api.mvc.RequestHeader scalaRequest
-
requestContent
protected String requestContent
-
sessionStore
protected PlaySessionStore sessionStore
-
responseCookies
protected List<play.mvc.Http.Cookie> responseCookies
-
responseContentType
protected String responseContentType
-
sessionHasChanged
protected boolean sessionHasChanged
-
session
protected play.mvc.Http.Session session
-
-
Constructor Detail
-
PlayWebContext
public PlayWebContext(play.mvc.Http.RequestHeader javaRequest, PlaySessionStore sessionStore)
-
PlayWebContext
public PlayWebContext(play.api.mvc.RequestHeader scalaRequest, PlaySessionStore sessionStore)
-
-
Method Detail
-
getSessionStore
public org.pac4j.core.context.session.SessionStore getSessionStore()
- Specified by:
getSessionStore
in interfaceorg.pac4j.core.context.WebContext
-
getRequestHeader
public Optional<String> getRequestHeader(String name)
- Specified by:
getRequestHeader
in interfaceorg.pac4j.core.context.WebContext
-
getRequestMethod
public String getRequestMethod()
- Specified by:
getRequestMethod
in interfaceorg.pac4j.core.context.WebContext
-
getRequestParameter
public Optional<String> getRequestParameter(String name)
- Specified by:
getRequestParameter
in interfaceorg.pac4j.core.context.WebContext
-
getRequestParameters
public Map<String,String[]> getRequestParameters()
- Specified by:
getRequestParameters
in interfaceorg.pac4j.core.context.WebContext
-
getBody
protected Object getBody()
-
setResponseHeader
public void setResponseHeader(String name, String value)
- Specified by:
setResponseHeader
in interfaceorg.pac4j.core.context.WebContext
-
getServerName
public String getServerName()
- Specified by:
getServerName
in interfaceorg.pac4j.core.context.WebContext
-
getServerPort
public int getServerPort()
- Specified by:
getServerPort
in interfaceorg.pac4j.core.context.WebContext
-
getScheme
public String getScheme()
- Specified by:
getScheme
in interfaceorg.pac4j.core.context.WebContext
-
isSecure
public boolean isSecure()
- Specified by:
isSecure
in interfaceorg.pac4j.core.context.WebContext
-
getFullRequestURL
public String getFullRequestURL()
- Specified by:
getFullRequestURL
in interfaceorg.pac4j.core.context.WebContext
-
getRemoteAddr
public String getRemoteAddr()
- Specified by:
getRemoteAddr
in interfaceorg.pac4j.core.context.WebContext
-
getRequestAttribute
public Optional<Object> getRequestAttribute(String name)
- Specified by:
getRequestAttribute
in interfaceorg.pac4j.core.context.WebContext
-
setRequestAttribute
public void setRequestAttribute(String name, Object value)
- Specified by:
setRequestAttribute
in interfaceorg.pac4j.core.context.WebContext
-
getRequestCookies
public Collection<org.pac4j.core.context.Cookie> getRequestCookies()
- Specified by:
getRequestCookies
in interfaceorg.pac4j.core.context.WebContext
-
getPath
public String getPath()
- Specified by:
getPath
in interfaceorg.pac4j.core.context.WebContext
-
addResponseCookie
public void addResponseCookie(org.pac4j.core.context.Cookie cookie)
- Specified by:
addResponseCookie
in interfaceorg.pac4j.core.context.WebContext
-
setResponseContentType
public void setResponseContentType(String contentType)
- Specified by:
setResponseContentType
in interfaceorg.pac4j.core.context.WebContext
-
getRequestContent
public String getRequestContent()
- Specified by:
getRequestContent
in interfaceorg.pac4j.core.context.WebContext
-
getNativeSession
public play.mvc.Http.Session getNativeSession()
-
setNativeSession
public void setNativeSession(play.mvc.Http.Session session)
-
supplementRequest
public play.mvc.Http.Request supplementRequest(play.mvc.Http.Request request)
-
supplementRequest
public play.mvc.Http.RequestHeader supplementRequest(play.mvc.Http.RequestHeader request)
-
supplementResponse
public play.mvc.Result supplementResponse(play.mvc.Result result)
-
-