Package net.shibboleth.idp.ui.csrf
Class BaseCSRFTokenPredicate
java.lang.Object
net.shibboleth.idp.ui.csrf.BaseCSRFTokenPredicate
- Direct Known Subclasses:
DefaultEventRequiresCSRFTokenValidationPredicate
,DefaultViewRequiresCSRFTokenPredicate
A base helper class for predicates that determine if CSRF protection is required per state.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Name of the metadata attribute that, if true, excludes a view from CSRF protection. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
safeGetBooleanStateAttribute
(StateDefinition state, String attributeName, boolean defaultValue) Safe get theboolean
value of the attribute from the attributes annotating theStateDefinition
.
-
Field Details
-
CSRF_EXCLUDED_ATTRIBUTE_NAME
Name of the metadata attribute that, if true, excludes a view from CSRF protection.- See Also:
-
-
Constructor Details
-
BaseCSRFTokenPredicate
public BaseCSRFTokenPredicate()
-
-
Method Details
-
safeGetBooleanStateAttribute
@Nonnull protected boolean safeGetBooleanStateAttribute(@Nullable StateDefinition state, @Nullable String attributeName, @Nonnull boolean defaultValue) Safe get theboolean
value of the attribute from the attributes annotating theStateDefinition
. Returns thedefaultValue
if either:- the
state
is null. attributeName
is null or no value is found.- the value is found but is not a
Boolean
.
- Parameters:
state
- the state definition to find the attribute from.attributeName
- the name of the attribute to find.defaultValue
- a default value.- Returns:
- the boolean value of the attribute on the state definition.
- the
-