org.apache.shiro.mgt
Interface SubjectDAO

All Known Implementing Classes:
DefaultSubjectDAO

public interface SubjectDAO

A SubjectDAO is 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 default SecurityManager implementations typically use a SubjectDAO in conjunction with a SubjectFactory: after the SubjectFactory creates a Subject instance, the SubjectDAO is 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 by SecurityManager implementations to manage Subject state persistence. It does not make Subject instances accessible to the application (e.g. via SecurityUtils.getSubject()).

Since:
1.2
See Also:
DefaultSubjectDAO

Method Summary
 void delete(Subject subject)
          Removes any persisted state for the specified Subject instance.
 Subject save(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 specified Subject, 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 specified Subject instance. 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.


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.