DefaultSubjectContext

Default implementation of the {@link SubjectContext} interface. Note that the getters and setters are not simple pass-through methods to an underlying attribute; the getters will employ numerous heuristics to acquire their data attribute as best as possible (for example, if {@link #getPrincipals} is invoked, if the principals aren't in the backing map, it might check to see if there is a subject or session in the map and attempt to acquire the principals from those objects).

Constructors

this
this()
Undocumented in source.
this
this(SubjectContext ctx)
Undocumented in source.

Members

Functions

getAuthenticationInfo
AuthenticationInfo getAuthenticationInfo()
Undocumented in source. Be warned that the author may not have intended to support it.
getAuthenticationToken
AuthenticationToken getAuthenticationToken()
Undocumented in source. Be warned that the author may not have intended to support it.
getHost
string getHost()
Undocumented in source. Be warned that the author may not have intended to support it.
getPrincipals
PrincipalCollection getPrincipals()
Undocumented in source. Be warned that the author may not have intended to support it.
getSecurityManager
SecurityManager getSecurityManager()
Undocumented in source. Be warned that the author may not have intended to support it.
getSession
Session getSession()
Undocumented in source. Be warned that the author may not have intended to support it.
getSessionId
string getSessionId()
Undocumented in source. Be warned that the author may not have intended to support it.
getSubject
Subject getSubject()
Undocumented in source. Be warned that the author may not have intended to support it.
isAuthenticated
bool isAuthenticated()
Undocumented in source. Be warned that the author may not have intended to support it.
isSessionCreationEnabled
bool isSessionCreationEnabled()
Undocumented in source. Be warned that the author may not have intended to support it.
resolveAuthenticated
bool resolveAuthenticated()
Undocumented in source. Be warned that the author may not have intended to support it.
resolveHost
string resolveHost()
Undocumented in source. Be warned that the author may not have intended to support it.
resolvePrincipals
PrincipalCollection resolvePrincipals()
Undocumented in source. Be warned that the author may not have intended to support it.
resolveSecurityManager
SecurityManager resolveSecurityManager()
Undocumented in source. Be warned that the author may not have intended to support it.
resolveSession
Session resolveSession()
Undocumented in source. Be warned that the author may not have intended to support it.
setAuthenticated
void setAuthenticated(bool authc)
Undocumented in source. Be warned that the author may not have intended to support it.
setAuthenticationInfo
void setAuthenticationInfo(AuthenticationInfo info)
Undocumented in source. Be warned that the author may not have intended to support it.
setAuthenticationToken
void setAuthenticationToken(AuthenticationToken token)
Undocumented in source. Be warned that the author may not have intended to support it.
setHost
void setHost(string host)
Undocumented in source. Be warned that the author may not have intended to support it.
setPrincipals
void setPrincipals(PrincipalCollection principals)
Undocumented in source. Be warned that the author may not have intended to support it.
setSecurityManager
void setSecurityManager(SecurityManager securityManager)
Undocumented in source. Be warned that the author may not have intended to support it.
setSession
void setSession(Session session)
Undocumented in source. Be warned that the author may not have intended to support it.
setSessionCreationEnabled
void setSessionCreationEnabled(bool enabled)
Undocumented in source. Be warned that the author may not have intended to support it.
setSessionId
void setSessionId(string sessionId)
Undocumented in source. Be warned that the author may not have intended to support it.
setSubject
void setSubject(Subject subject)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

AUTHENTICATED_SESSION_KEY
enum string AUTHENTICATED_SESSION_KEY;

The session key that is used to store whether or not the user is authenticated.

PRINCIPALS_SESSION_KEY
enum string PRINCIPALS_SESSION_KEY;

The session key that is used to store subject principals.

SESSION_CREATION_ENABLED
enum string SESSION_CREATION_ENABLED;
Undocumented in source.

Inherited Members

From MapContext

getTypedValue
E getTypedValue(string key)

Performs a {@link #get get} operation but additionally ensures that the value returned is of the specified {@code type}. If there is no value, {@code null} is returned.

nullSafePut
void nullSafePut(string key, Object value)

Places a value in this context map under the given key only if the given {@code value} argument is not null.

size
int size()
Undocumented in source. Be warned that the author may not have intended to support it.
isEmpty
bool isEmpty()
Undocumented in source. Be warned that the author may not have intended to support it.
containsKey
bool containsKey(string o)
Undocumented in source. Be warned that the author may not have intended to support it.
containsValue
bool containsValue(Object o)
Undocumented in source. Be warned that the author may not have intended to support it.
get
Object get(string o)
Undocumented in source. Be warned that the author may not have intended to support it.
put
Object put(string s, Object o)
Undocumented in source. Be warned that the author may not have intended to support it.
remove
Object remove(string o)
Undocumented in source. Be warned that the author may not have intended to support it.
remove
bool remove(string key, Object value)
Undocumented in source. Be warned that the author may not have intended to support it.
putAll
void putAll(Map!(string, Object) map)
Undocumented in source. Be warned that the author may not have intended to support it.
clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
replace
bool replace(string key, Object oldValue, Object newValue)
Undocumented in source. Be warned that the author may not have intended to support it.
replace
Object replace(string key, Object value)
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.
putIfAbsent
Object putIfAbsent(string key, Object value)
Undocumented in source. Be warned that the author may not have intended to support it.
values
Object[] values()
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
Object opIndex(string key)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(ref string, ref Object) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(MapEntry!(string, Object) entry) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
byKey
InputRange!string byKey()
Undocumented in source. Be warned that the author may not have intended to support it.
byValue
InputRange!Object byValue()
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Object o)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(IObject o)
Undocumented in source. Be warned that the author may not have intended to support it.
toHash
size_t toHash()
Undocumented in source. Be warned that the author may not have intended to support it.
__anonymous
mixin CloneMemberTemplate!(typeof(this))
Undocumented in source.

From SubjectContext

getSecurityManager
SecurityManager getSecurityManager()

Returns the SecurityManager instance that should be used to back the constructed {@link Subject} instance or {@code null} if one has not yet been provided to this context.

setSecurityManager
void setSecurityManager(SecurityManager securityManager)

Sets the SecurityManager instance that should be used to back the constructed {@link Subject} instance (typically used to support {@link hunt.shiro.subject.support.DelegatingSubject DelegatingSubject} implementations).

resolveSecurityManager
SecurityManager resolveSecurityManager()

Resolves the {@code SecurityManager} instance that should be used to back the constructed {@link Subject} instance (typically used to support {@link hunt.shiro.subject.support.DelegatingSubject DelegatingSubject} implementations).

getSessionId
string getSessionId()

Returns the session id of the session that should be associated with the constructed {@link Subject} instance. <p/> The construction process is expected to resolve the session with the specified id and then construct the Subject instance based on the resolved session.

setSessionId
void setSessionId(string sessionId)

Sets the session id of the session that should be associated with the constructed {@link Subject} instance. <p/> The construction process is expected to resolve the session with the specified id and then construct the Subject instance based on the resolved session.

getSubject
Subject getSubject()

Returns any existing {@code Subject} that may be in use at the time the new {@code Subject} instance is being created. <p/> This is typically used in the case where the existing {@code Subject} instance returned by this method is unauthenticated and a new {@code Subject} instance is being created to reflect a successful authentication - you want to return most of the state of the previous {@code Subject} instance when creating the newly authenticated instance.

setSubject
void setSubject(Subject subject)

Sets the existing {@code Subject} that may be in use at the time the new {@code Subject} instance is being created. <p/> This is typically used in the case where the existing {@code Subject} instance returned by this method is unauthenticated and a new {@code Subject} instance is being created to reflect a successful authentication - you want to return most of the state of the previous {@code Subject} instance when creating the newly authenticated instance.

getPrincipals
PrincipalCollection getPrincipals()

Returns the principals (aka identity) that the constructed {@code Subject} should reflect.

resolvePrincipals
PrincipalCollection resolvePrincipals()
Undocumented in source.
setPrincipals
void setPrincipals(PrincipalCollection principals)

Sets the principals (aka identity) that the constructed {@code Subject} should reflect.

getSession
Session getSession()

Returns the {@code Session} to use when building the {@code Subject} instance. Note that it is more common to specify a {@link #setSessionId sessionId} to acquire the desired session rather than having to construct a {@code Session} to be returned by this method.

setSession
void setSession(Session session)

Sets the {@code Session} to use when building the {@code Subject} instance. Note that it is more common to specify a {@link #setSessionId sessionId} to automatically resolve the desired session rather than constructing a {@code Session} to call this method.

resolveSession
Session resolveSession()
Undocumented in source.
isAuthenticated
bool isAuthenticated()

Returns {@code true} if the constructed {@code Subject} should be considered authenticated, {@code false} otherwise. Be careful setting this value to {@code true} - you should know what you are doing and have a good reason for ignoring Shiro's default authentication state mechanisms.

setAuthenticated
void setAuthenticated(bool authc)

Sets whether or not the constructed {@code Subject} instance should be considered as authenticated. Be careful when specifying {@code true} - you should know what you are doing and have a good reason for ignoring Shiro's default authentication state mechanisms.

isSessionCreationEnabled
bool isSessionCreationEnabled()

Returns {@code true} if the constructed {@code Subject} should be allowed to create a session, {@code false} otherwise. Shiro's configuration defaults to {@code true} as most applications find value in Sessions.

setSessionCreationEnabled
void setSessionCreationEnabled(bool enabled)

Sets whether or not the constructed {@code Subject} instance should be allowed to create a session, {@code false} otherwise.

resolveAuthenticated
bool resolveAuthenticated()
Undocumented in source.
getAuthenticationInfo
AuthenticationInfo getAuthenticationInfo()
Undocumented in source.
setAuthenticationInfo
void setAuthenticationInfo(AuthenticationInfo info)
Undocumented in source.
getAuthenticationToken
AuthenticationToken getAuthenticationToken()
Undocumented in source.
setAuthenticationToken
void setAuthenticationToken(AuthenticationToken token)
Undocumented in source.
getHost
string getHost()

Returns the host name or IP that should reflect the constructed {@code Subject}'s originating location.

setHost
void setHost(string host)

Sets the host name or IP that should reflect the constructed {@code Subject}'s originating location.

resolveHost
string resolveHost()
Undocumented in source.

Meta