Credentials
Public and private credential classes are not part of the core JAAS class library. Any class can represent a credential. Developers, however, may elect to have their credential classes implement two interfaces related to credentials: Refreshable and Destroyable
Refreshable
The javax.security.auth.Refreshable interface provides the capability for a credential to refresh itself. For example, a credential with a particular time-restricted lifespan may implement this interface to allow callers to refresh the time period for which it is valid. The interface has two abstract methods:
boolean isCurrent();
This method determines whether the credential is current or valid.
void refresh() throws RefreshFailedException;
This method updates or extends the validity of the credential. The method implementation should perform an AuthPermission("refreshCredential") security check to ensure the caller has permission to refresh the credential.
Destroyable
The javax.security.auth.Destroyable interface provides the capability of destroying the contents within a credential. The interface has two abstract methods:
boolean isDestroyed();
Determines whether the credential has been
destroyed. void destroy() throws DestroyFailedException;
Destroys and clears
the information associated with this credential. Subsequent calls to certain methods on this
credential will result in an IllegalStateException being thrown. The method implementation should
perform an AuthPermission("destroyCredential") security check to ensure the
caller has permission to destroy the credential.