Package org.apache.shiro.mgt
Interface SubjectDAO
-
- All Known Implementing Classes:
DefaultSubjectDAO
public interface SubjectDAOASubjectDAOis responsible for persisting a Subject instance's internal state such that the Subject instance can be recreated at a later time if necessary. Shiro's defaultSecurityManagerimplementations typically use aSubjectDAOin conjunction with aSubjectFactory: after theSubjectFactorycreates aSubjectinstance, theSubjectDAOis used to persist that subject's state such that it can be accessed later if necessary.Usage
It should be noted that this component is used bySecurityManagerimplementations to manage Subject state persistence. It does not make Subject instances accessible to the application (e.g. viaSecurityUtils.getSubject()).- Since:
- 1.2
- See Also:
DefaultSubjectDAO
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddelete(Subject subject)Removes any persisted state for the specifiedSubjectinstance.Subjectsave(Subject subject)Persists the specified Subject's state for later access.
-
-
-
Method Detail
-
save
Subject save(Subject subject)
Persists the specified Subject's state for later access. If there is a no existing state persisted, this persists it if possible (i.e. a create operation). If there is existing state for the specifiedSubject, this method updates the existing state to reflect the current state (i.e. an update operation).- Parameters:
subject- the Subject instance for which its state will be created or updated.- Returns:
- the Subject instance to use after persistence is complete. This can be the same as the method argument if the underlying implementation does not need to make any Subject changes.
-
delete
void delete(Subject subject)
Removes any persisted state for the specifiedSubjectinstance. This is a delete operation such that the Subject's state will not be accessible at a later time.- Parameters:
subject- the Subject instance for which any persistent state should be deleted.
-
-