Class SessionContext
- java.lang.Object
-
- com.sun.identity.liberty.ws.security.SessionContext
-
public class SessionContext extends Object
TheSessionContextclass represents session status of an entity to another system entity. It is supplied to a relying party to support policy enforcement.
-
-
Field Summary
Fields Modifier and Type Field Description protected Date_authenticationInstantprotected AuthnContext_authnContextprotected Date_issueInstantprotected String_providerIDprotected SessionSubject_sessionSubject
-
Constructor Summary
Constructors Modifier Constructor Description protectedSessionContext()Default constructorSessionContext(SessionSubject sessionSubject, AuthnContext authnContext, String providerID)Constructs aSessionContextobject from aSessionSubjectobject, aAuthnContextobject and aString.SessionContext(Element element)Constructs anSessionContextobject from a DOM Element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthnContextgetAuthnContext()Returns theAuthnContextwithin theSessionContextobject.StringgetProviderID()Returns theProviderIDin theSessionContextobject.SessionSubjectgetSessionSubject()Returns theSessionSubjectwithin theSessionContextobject.booleansetAuthnContext(AuthnContext authnContext)Sets theAuthnContextin theSessionContext.voidsetSessionSubject(SessionSubject sub)Sets theSessionSubjectobject.StringtoXMLString()Returns a String representation of theSessionContextelement.StringtoXMLString(boolean includeNS, boolean declareNS)Returns a String representation of the<SessionContext>element.
-
-
-
Field Detail
-
_sessionSubject
protected SessionSubject _sessionSubject
-
_authnContext
protected AuthnContext _authnContext
-
_providerID
protected String _providerID
-
_issueInstant
protected Date _issueInstant
-
_authenticationInstant
protected Date _authenticationInstant
-
-
Constructor Detail
-
SessionContext
protected SessionContext()
Default constructor
-
SessionContext
public SessionContext(SessionSubject sessionSubject, AuthnContext authnContext, String providerID) throws SAMLException
Constructs aSessionContextobject from aSessionSubjectobject, aAuthnContextobject and aString.- Parameters:
sessionSubject-SessionSubjectobject.authnContext- authentication context object.providerID- provider ID.- Throws:
SAMLException- ifsessionSubjectis null orproviderIDis null.
-
SessionContext
public SessionContext(Element element) throws SAMLException
Constructs anSessionContextobject from a DOM Element.- Parameters:
element- representing a DOM tree element.- Throws:
SAMLException- if there is an error in the sender or in the element definition.
-
-
Method Detail
-
getSessionSubject
public SessionSubject getSessionSubject()
Returns theSessionSubjectwithin theSessionContextobject.- Returns:
SessionSubjectobject.
-
setSessionSubject
public void setSessionSubject(SessionSubject sub)
Sets theSessionSubjectobject.- Parameters:
sub-SessionSubjectobject.
-
getAuthnContext
public AuthnContext getAuthnContext()
Returns theAuthnContextwithin theSessionContextobject.- Returns:
AuthnContextobject.
-
getProviderID
public String getProviderID()
Returns theProviderIDin theSessionContextobject.- Returns:
ProviderIDobject
-
setAuthnContext
public boolean setAuthnContext(AuthnContext authnContext)
Sets theAuthnContextin theSessionContext.- Parameters:
authnContext-AuthnContextto be set.- Returns:
- true if
AuthnContextwas set.
-
toXMLString
public String toXMLString() throws ParseException, FSMsgException
Returns a String representation of theSessionContextelement.- Returns:
- A string containing the valid XML for this element.
By default name space name is prepended to the element name
example
<saml:Subject>. - Throws:
ParseException- if could not convert String Date expression to Date object.FSMsgException- if could not getAuthnContextXML String representation.
-
toXMLString
public String toXMLString(boolean includeNS, boolean declareNS) throws ParseException, FSMsgException
Returns a String representation of the<SessionContext>element.- Parameters:
includeNS- if true prepends all elements by their Namespace name<saml:Subject>.declareNS- if true includes the namespace within the generated XML.- Returns:
- A string containing the valid XML for this element. Return null if error happened.
- Throws:
ParseException- if could not convert String Date expression to Date object.FSMsgException- if could not getAuthnContextXML String representation.
-
-