Package org.forgerock.openig.filter
Class AuthRedirectContext
java.lang.Object
org.forgerock.services.context.AbstractContext
org.forgerock.openig.filter.AuthRedirectContext
- All Implemented Interfaces:
Context
Used by the
FragmentFilter
and the DataPreservationFilter
to know if a filter has attempted an
impending IG redirection. Note: there should only ever be one instance of the AuthRedirectContext
in the
context hierarchy for any given request. It is important to validate if one is already present before adding a
new instance, or when needing to add query parameters.
For example:
final Context authRedirectAwareContext =
context.as(AuthRedirectContext.class)
.map(authRedirectContext -> {
authRedirectContext.addQueryParameter("foo", "bar");
return context;
})
.orElseGet(() -> {
AuthRedirectContext authRedirectContext = new AuthRedirectContext(context);
authRedirectContext.addQueryParameter("foo", "bar");
return authRedirectContext;
});
-
Field Summary
FieldsFields inherited from class org.forgerock.services.context.AbstractContext
data
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addQueryParameter
(String name, String value) Add a query parameter to the context.boolean
Returns whether an impending IG redirect has been performed or not.Warn that an impending IG redirection has been attempted and if any query parameters have been added to this context, apply them to the uri and return an updated uri.Methods inherited from class org.forgerock.services.context.AbstractContext
as, asContext, containsContext, containsContext, get, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
-
Field Details
-
NAME
Context's name.- See Also:
-
-
Constructor Details
-
AuthRedirectContext
Create an AuthRedirectContext instance.- Parameters:
parent
- the parent context.
-
-
Method Details
-
isImpendingIgRedirectNotified
public boolean isImpendingIgRedirectNotified()Returns whether an impending IG redirect has been performed or not.- Returns:
true
if this context is aware of a impending IG redirect attempt.
-
notifyImpendingIgRedirectAndUpdateUri
Warn that an impending IG redirection has been attempted and if any query parameters have been added to this context, apply them to the uri and return an updated uri. Any existing parameters of the same name will be replaced. -
addQueryParameter
Add a query parameter to the context. This will be used to tag the originalUri with a query parameter as part of thenotifyImpendingIgRedirectAndUpdateUri(URI)
call.- Parameters:
name
- The query parameter name.value
- The query parameter value.
-