Uses of Interface
org.apache.shiro.subject.Subject
Packages that use Subject
Package
Description
This package primarily exists as a root classpath distinction, but it does contain two core classes widely used
by applications,
SecurityUtils and
ShiroException.Components used to support the framework's AOP/interception support classes.
Executor, ExecutorService,
and ScheduledExecutorService implementations for transparent
Subject association with threads in an asynchronous execution environment.Provides the master
SecurityManager interface and a default implementation
hierarchy for managing all aspects of Shiro's functionality in an application.Components supporting the
Subject interface, the most important concept in
Shiro's API.Concrete support implementations of most of the
org.apache.shiro.subject interfaces.Your run-of-the-mill 'util' package for components and logic widely used across the framework that can't
find their home into a proper OO hierarchy (or, most likely for things used across many hierarchies).
-
Uses of Subject in org.apache.shiro
Methods in org.apache.shiro that return SubjectModifier and TypeMethodDescriptionstatic SubjectSecurityUtils.getSubject()Returns the currently accessibleSubjectavailable to the calling code depending on runtime environment. -
Uses of Subject in org.apache.shiro.aop
Methods in org.apache.shiro.aop that return SubjectModifier and TypeMethodDescriptionprotected SubjectAnnotationHandler.getSubject()Returns theSubjectassociated with the currently-executing code.protected SubjectMethodInterceptorSupport.getSubject()Returns theSubjectassociated with the currently-executing code. -
Uses of Subject in org.apache.shiro.concurrent
Methods in org.apache.shiro.concurrent that return SubjectModifier and TypeMethodDescriptionprotected SubjectSubjectAwareExecutor.getSubject()Returns the currently Subject instance that should be associated with Runnable or Callable instances before being dispatched to the targetExecutorinstance. -
Uses of Subject in org.apache.shiro.mgt
Methods in org.apache.shiro.mgt that return SubjectModifier and TypeMethodDescriptionprotected SubjectDefaultSecurityManager.createSubject(AuthenticationToken token, AuthenticationInfo info, Subject existing) Creates aSubjectinstance for the user represented by the given method arguments.DefaultSecurityManager.createSubject(SubjectContext subjectContext) This implementation functions as follows:DefaultSubjectFactory.createSubject(SubjectContext context) SecurityManager.createSubject(SubjectContext context) Creates aSubjectinstance reflecting the specified contextual data.SubjectFactory.createSubject(SubjectContext context) Creates a new Subject instance reflecting the state of the specified contextual data.protected SubjectDefaultSecurityManager.doCreateSubject(SubjectContext context) Actually creates aSubjectinstance by delegating to the internalsubjectFactory.DefaultSecurityManager.login(Subject subject, AuthenticationToken token) First authenticates theAuthenticationTokenargument, and if successful, constructs aSubjectinstance representing the authenticated account's identity.SecurityManager.login(Subject subject, AuthenticationToken authenticationToken) Logs in the specified Subject using the givenauthenticationToken, returning an updated Subject instance reflecting the authenticated state if successful or throwingAuthenticationExceptionif it is not.protected SubjectDefaultSubjectFactory.newSubjectInstance(PrincipalCollection principals, boolean authenticated, String host, Session session, SecurityManager securityManager) Deprecated.Saves the subject's state to the subject'ssessiononly ifsessionStorageEnabled(subject).Persists the specified Subject's state for later access.Methods in org.apache.shiro.mgt with parameters of type SubjectModifier and TypeMethodDescriptionprotected voidDefaultSecurityManager.beforeLogout(Subject subject) protected voidDeprecated.in favor ofsave(subject).protected SubjectDefaultSecurityManager.createSubject(AuthenticationToken token, AuthenticationInfo info, Subject existing) Creates aSubjectinstance for the user represented by the given method arguments.protected voidRemoves (or 'unbinds') the Subject's state from the application, typically called duringDefaultSecurityManager.logout(org.apache.shiro.subject.Subject)..voidRemoves any existing subject state from the subject's session (if the session exists).voidRemoves any persisted state for the specifiedSubjectinstance.protected abstract voidAbstractRememberMeManager.forgetIdentity(Subject subject) Forgets (removes) any remembered identity data for the specifiedSubjectinstance.protected PrincipalCollectionAbstractRememberMeManager.getIdentityToRemember(Subject subject, AuthenticationInfo info) booleanDefaultSessionStorageEvaluator.isSessionStorageEnabled(Subject subject) This implementation functions as follows: If the specified Subject already has an existingSession(typically because an application developer has calledsubject.getSession()already), Shiro will use that existing session to store subject state. If a Subject does not yet have a Session, this implementation checks thesessionStorageEnabledproperty: IfsessionStorageEnabledis true (the default setting), a new session may be created to persist Subject state if necessary. IfsessionStorageEnabledisfalse, a new session will not be created to persist session state. Most applications use Sessions and are OK with the defaulttruesetting forsessionStorageEnabled.protected booleanDefaultSubjectDAO.isSessionStorageEnabled(Subject subject) Determines if the subject's session will be used to persist subject state or not.booleanSessionStorageEvaluator.isSessionStorageEnabled(Subject subject) Returnstrueif the specifiedSubject'ssessionmay be used to persist that Subject's state,falseotherwise.DefaultSecurityManager.login(Subject subject, AuthenticationToken token) First authenticates theAuthenticationTokenargument, and if successful, constructs aSubjectinstance representing the authenticated account's identity.SecurityManager.login(Subject subject, AuthenticationToken authenticationToken) Logs in the specified Subject using the givenauthenticationToken, returning an updated Subject instance reflecting the authenticated state if successful or throwingAuthenticationExceptionif it is not.voidvoidLogs out the specified Subject from the system.protected voidDefaultSubjectDAO.mergeAuthenticationState(Subject subject) Merges the Subject's current authentication state with whatever may be in any available session.protected voidDefaultSubjectDAO.mergePrincipals(Subject subject) Merges the Subject's currentgetPrincipals()with whatever may be in any available session.voidAbstractRememberMeManager.onFailedLogin(Subject subject, AuthenticationToken token, AuthenticationException ae) Reacts to a failed login by immediatelyforgettingany previously remembered identity.protected voidDefaultSecurityManager.onFailedLogin(AuthenticationToken token, AuthenticationException ae, Subject subject) voidRememberMeManager.onFailedLogin(Subject subject, AuthenticationToken token, AuthenticationException ae) Reacts to a failed authentication attempt, typically by forgetting any previously remembered principals for the Subject.voidReacts to a subject logging out of the application and immediatelyforgetsany previously stored identity and returns.voidReacts to a Subject logging out of the application, typically by forgetting any previously remembered principals for the Subject.voidAbstractRememberMeManager.onSuccessfulLogin(Subject subject, AuthenticationToken token, AuthenticationInfo info) Reacts to the successful login attempt by first alwaysforgettingany previously stored identity.protected voidDefaultSecurityManager.onSuccessfulLogin(AuthenticationToken token, AuthenticationInfo info, Subject subject) voidRememberMeManager.onSuccessfulLogin(Subject subject, AuthenticationToken token, AuthenticationInfo info) Reacts to a successful authentication attempt, typically saving the principals to be retrieved ('remembered') for future system access.voidAbstractRememberMeManager.rememberIdentity(Subject subject, AuthenticationToken token, AuthenticationInfo authcInfo) Remembers a subject-unique identity for retrieval later.protected voidAbstractRememberMeManager.rememberIdentity(Subject subject, PrincipalCollection accountPrincipals) Remembers the specified account principals by firstconvertingthem to a byte array and thenremembersthat byte array.protected voidDefaultSecurityManager.rememberMeFailedLogin(AuthenticationToken token, AuthenticationException ex, Subject subject) protected voidDefaultSecurityManager.rememberMeLogout(Subject subject) protected voidDefaultSecurityManager.rememberMeSuccessfulLogin(AuthenticationToken token, AuthenticationInfo info, Subject subject) protected abstract voidAbstractRememberMeManager.rememberSerializedIdentity(Subject subject, byte[] serialized) Persists the identity bytes to a persistent store for retrieval later via theAbstractRememberMeManager.getRememberedSerializedIdentity(SubjectContext)method.protected voidDefaultSubjectDAO.removeFromSession(Subject subject) Removes any existing subject state from the Subject's session (if the session exists).protected voidSaves the subject's state to a persistent location for future reference if necessary.Saves the subject's state to the subject'ssessiononly ifsessionStorageEnabled(subject).Persists the specified Subject's state for later access.protected voidDefaultSubjectDAO.saveToSession(Subject subject) Saves the subject's state (it's principals and authentication state) to itssession.protected voidDefaultSecurityManager.stopSession(Subject subject) protected voidDeprecated.in Shiro 1.2 in favor ofDefaultSecurityManager.delete(org.apache.shiro.subject.Subject) -
Uses of Subject in org.apache.shiro.subject
Methods in org.apache.shiro.subject that return SubjectModifier and TypeMethodDescriptionSubject.Builder.buildSubject()Creates and returns a newSubjectinstance reflecting the cumulative state acquired by the other methods in this class.SubjectContext.getSubject()Returns any existingSubjectthat may be in use at the time the newSubjectinstance is being created.Methods in org.apache.shiro.subject with parameters of type SubjectModifier and TypeMethodDescriptionvoidSubjectContext.setSubject(Subject subject) Sets the existingSubjectthat may be in use at the time the newSubjectinstance is being created. -
Uses of Subject in org.apache.shiro.subject.support
Classes in org.apache.shiro.subject.support that implement SubjectModifier and TypeClassDescriptionclassImplementation of theSubjectinterface that delegates method calls to an underlyingSecurityManagerinstance for security checks.Methods in org.apache.shiro.subject.support that return SubjectModifier and TypeMethodDescriptionDefaultSubjectContext.getSubject()protected SubjectSubjectThreadState.getSubject()Returns theSubjectinstance managed by thisThreadStateimplementation.Methods in org.apache.shiro.subject.support with parameters of type SubjectConstructors in org.apache.shiro.subject.support with parameters of type SubjectModifierConstructorDescriptionSubjectCallable(Subject subject, Callable<V> delegate) SubjectRunnable(Subject subject, Runnable delegate) Creates a newSubjectRunnablethat, when executed, will execute the targetdelegate, but guarantees that it will run associated with the specifiedSubject.SubjectThreadState(Subject subject) Creates a newSubjectThreadStatethat will bind and unbind the specifiedSubjectto the thread -
Uses of Subject in org.apache.shiro.util
Methods in org.apache.shiro.util that return SubjectModifier and TypeMethodDescriptionstatic SubjectThreadContext.getSubject()Convenience method that simplifies retrieval of a thread-bound Subject.static SubjectThreadContext.unbindSubject()Convenience method that simplifies removal of a thread-local Subject from the thread.Methods in org.apache.shiro.util with parameters of type Subject
DefaultSubjectFactory.createSubject(org.apache.shiro.subject.SubjectContext)directly if you need to instantiate a customSubjectclass.