Class ScopeUtils
java.lang.Object
se.swedenconnect.opensaml.saml2.metadata.scope.ScopeUtils
Utility methods for validating a scoped attribute against a
shibmd:Scope element.- Author:
- Martin Lindström (martin@idsec.se)
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetScopedDomain(String attributeValue) Gets the domain part (value@domain) from a scoped attribute value.getScopeExtensions(EntityDescriptor entityDescriptor) Given an (IdP)EntityDescriptor, the method finds allshibmd:Scopeelements.static booleanisAuthorized(Attribute scopedAttribute, List<XMLObject> scopes) Predicate that tells if a scoped attribute is "authorized", i.e., if its scope is listed in the supplied list ofshibmd:Scopeelements (gotten from the IdP metadata).static booleanGiven ashibmd:Scopeelement, the method tests whether the value of the (scoped) attribute matches the scope.static booleanGiven ashibmd:Scopeelement, the method tests whether the value of the (scoped) attribute matches the scope.
-
Method Details
-
getScopeExtensions
Given an (IdP)EntityDescriptor, the method finds allshibmd:Scopeelements.- Parameters:
entityDescriptor- the metadata object- Returns:
- a (possible empty) list of
shibmd:Scopeelements
-
isAuthorized
Predicate that tells if a scoped attribute is "authorized", i.e., if its scope is listed in the supplied list ofshibmd:Scopeelements (gotten from the IdP metadata).If an attribute that is not "scoped" (value@scope) the method returns
false.- Parameters:
scopedAttribute- the attribute to testscopes- the shibmd:Scope elements- Returns:
- true if the attribute scope is listed among the Scope extensions and false otherwise
-
isMatch
Given ashibmd:Scopeelement, the method tests whether the value of the (scoped) attribute matches the scope.If the attribute contains multiple values, all must match the scope.
- Parameters:
scope- the Scope elementattribute- the attribute- Returns:
- true if there is a match and false otherwise
-
isMatch
Given ashibmd:Scopeelement, the method tests whether the value of the (scoped) attribute matches the scope.- Parameters:
scope- the Scope elementattributeValue- the full attribute value- Returns:
- true if there is a match and false otherwise
-
getScopedDomain
Gets the domain part (value@domain) from a scoped attribute value.- Parameters:
attributeValue- the attribute value- Returns:
- the domain part, or null
-