Package net.shibboleth.sp.state
Interface StateManager
- All Known Implementing Classes:
AbstractStateManager,CookieStateManager,PassthroughStateManager,StorageServiceStateManager
public interface StateManager
Interface to a service that manages "state" tokens, used in most SSO protocols
to manage stateful request/response correlation and to limit exposure of the
resource URLs accessed by clients to allow recovery of the URL for final redirection.
SAML refers to this notion as RelayState, while OpenID Connect just refers to it as state.
There are multiple possible implementations of this concept, all involving cookies to provide CSRF protection.
-
Method Summary
Modifier and TypeMethodDescriptionpreserveToStateToken(Agent agent, Application application, StateData data) Preserves data while transforming it into a state token.<T extends StateData>
TrecoverFromStateToken(Agent agent, Application application, String token, Class<T> type) Recovers stored data from a state token.
-
Method Details
-
preserveToStateToken
@Nonnull String preserveToStateToken(@Nonnull Agent agent, @Nonnull Application application, @Nonnull StateData data) throws IOException Preserves data while transforming it into a state token.- Parameters:
agent- agent owning the stateapplication- application owning the statedata- data to preserve- Returns:
- state token representing value
- Throws:
IOException- if creation of token fails
-
recoverFromStateToken
@Nullable <T extends StateData> T recoverFromStateToken(@Nonnull Agent agent, @Nonnull Application application, @Nonnull String token, @Nonnull Class<T> type) throws IOException Recovers stored data from a state token.In most implementations, the state token mapping should be cleared on successful use of this method.
- Type Parameters:
T- type of state- Parameters:
agent- agent owning the stateapplication- application owning the statetoken- state tokentype- specific subtype ofStateDatato recover- Returns:
- the recovered data, or null if unable to recover without underlying cause
- Throws:
IOException- if recovery from token fails
-