hunt.shiro.subject.SubjectContext

Undocumented in source.

Members

Interfaces

SubjectContext
interface SubjectContext

A {@code SubjectContext} is a 'bucket' of data presented to a {@link SecurityManager} which interprets this data to construct {@link hunt.shiro.subject.Subject Subject} instances. It is essentially a Map of data with a few additional type-safe methods for easy retrieval of objects commonly used to construct Subject instances. <p/> While this interface contains type-safe setters and getters for common data types, the map can contain anything additional that might be needed by the {@link SecurityManager} or {@link hunt.shiro.mgt.SubjectFactory SubjectFactory} implementation to construct {@code Subject} instances. <h2>Data Resolution</h2> The {@link SubjectContext} interface also allows for heuristic resolution of data used to construct a subject instance. That is, if an attribute has not been explicitly provided via a setter method, the {@code resolve*} methods can use heuristics to obtain that data in another way from other attributes. <p/> For example, if one calls {@link #getPrincipals()} and no principals are returned, perhaps the principals exist in the {@link #getSession() session} or another attribute in the context. The {@link #resolvePrincipals()} will know how to resolve the principals based on heuristics. If the {@code resolve*} methods return {@code null} then the data could not be achieved by any heuristics and must be considered as not available in the context. <p/> The general idea is that the normal getters can be called to see if the value was explicitly set. The {@code resolve*} methods should be used when actually constructing the {@code Subject} instance to ensure the most specific/accurate data can be used. <p/> <b>USAGE</b>: Most Shiro end-users will never use a {@code SubjectContext} instance directly and instead will use a {@link Subject.Builder} (which internally uses a {@code SubjectContext}) and build {@code Subject} instances that way.

Meta