Interface ScopeMap
public interface ScopeMap
A Map of scopes which can be used to verify scopes requested by OAuth clients
as well as obtain sub-sets of scope configurations that belong to different Sets
(e.g. OAuth profile and client scope config).
Verified scopes, which are passed in as simple Strings, are returned as ScopeValue instances,
which keep a link to the @link{ScopeConfig} which matched it when checked against this Map.
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleanareAllIn(Collection<String> requestedScopes) Check if the scopes in this map are all included in the given Set of requested scopes.Get the raw scope specifications.booleanCheck whether this scopes Map includes a match for the single requested scope.booleancontainsAll(@Nullable String requestedScopes) Check whether this scopes Map includes matches for all of the requested scopes.filter(Set<ScopeValue> scopeValues) Filter only those scopes that are present in the given Set.filterContainingAllClaims(ClaimSet claims) Filter only those scopes that contain all the claims of the provided claimsetfiltered(Predicate<ScopeConfig> predicate) Filter only those scopes that satisfy the provided filter function.findMatching(String requestedScope) Find a scope that matches the given scope name.getAll()getAllForClaim(String claimName) getAllMatching(String requestedScopes) Get a Set of all scope values that match at least one scope within this map.getAllMatching(Collection<String> requestedScopeNames) Get a Set of all scope values that match at least one scope within this map.Returns the set of all claims entitled by this set of scopes.Get a scopes Map containing only required scopes, as defined byScopeConfig.isRequired().getRawSpecificationsMatching(Collection<String> scopes) Keep all scopes that have the exact same specification as the ones in the given Set.intersection(ScopeMap other) Compute the intersection between this map and the other map.booleanisEmpty()intsize()Compute the union of this map and the other map.with(ScopeConfig scopeConfig) Create a copy of this scopes map that includes the provided scope.
-
Method Details
-
contains
Check whether this scopes Map includes a match for the single requested scope.- Parameters:
requestedScope- a single scope requested by a client- Returns:
- true if the scope is included in this scopes map, false otherwise
-
containsAll
Check whether this scopes Map includes matches for all of the requested scopes.- Parameters:
requestedScopes- whitespace-separated scopes requested by a client- Returns:
- true if all of the scopes are included in this scopes map, false otherwise
-
getRawSpecificationsMatching
Keep all scopes that have the exact same specification as the ones in the given Set.Notice that this means that prefix scopes, for example, should be matched exactly (i.e. direct String comparison), not as prefixes.
- Parameters:
scopes- scopes specifications, usually from configuration- Returns:
- a map containing only those scopes that match exactly the raw specification of the given scopes
-
intersection
Compute the intersection between this map and the other map.The result of this operation is a map that contains only the scope configurations that are present in both maps.
- Parameters:
other- scopes map- Returns:
- a scopes map that contains all scopes that are both in this map and in the other map.
-
union
Compute the union of this map and the other map.The result of this operation is a map that contains only the scope configurations that are present in both maps.
- Parameters:
other- scopes map- Returns:
- a scopes map that contains all scopes that are both in this map and in the other map.
-
getAll
Set<ScopeConfig> getAll()- Returns:
- all
ScopeConfigin this Map.
-
getScopeValues
Set<ScopeValue> getScopeValues()- Returns:
- all as
ScopeValuein this Map
-
getAllMatching
Get a Set of all scope values that match at least one scope within this map.- Parameters:
requestedScopes- the requested scope names (whitespace separated list)- Returns:
- scope values for those requested scopes that match a scope in this map
-
getAllForClaim
- Parameters:
claimName- name of the claim- Returns:
- all scopes mapped to the given claim
- Since:
- 4.0.0
-
getAllMatching
Get a Set of all scope values that match at least one scope within this map.- Parameters:
requestedScopeNames- the requested scope names- Returns:
- scope values for those requested scopes that match a scope in this map
-
getOnlyRequiredScopes
ScopeMap getOnlyRequiredScopes()Get a scopes Map containing only required scopes, as defined byScopeConfig.isRequired().- Returns:
- required scopes
-
size
int size()- Returns:
- number of scopes in this map
-
isEmpty
boolean isEmpty()- Returns:
- true if this Map is empty, false otherwise
-
areAllIn
Check if the scopes in this map are all included in the given Set of requested scopes.- Parameters:
requestedScopes- the requested scopes- Returns:
- true if this scopes map is a subSet of the requested scopes
-
with
Create a copy of this scopes map that includes the provided scope.- Parameters:
scopeConfig- to add to the Map- Returns:
- copy of this Map with the given scope included
-
findMatching
Find a scope that matches the given scope name.- Parameters:
requestedScope- single scope name- Returns:
- the scope, or null if none is found.
-
asRawScopeSpecifications
Get the raw scope specifications.Do not use this method to check requested scopes!
- Returns:
- the raw scope specifications contained in this Map.
-
getClaims
Returns the set of all claims entitled by this set of scopes.- Returns:
- claim names
-
filter
Filter only those scopes that are present in the given Set.- Parameters:
scopeValues- scope values to keep- Returns:
- filtered ScopeMap
-
filtered
Filter only those scopes that satisfy the provided filter function. All scope types are evaluated, OAuthScopes as well as Prefix Scopes- Parameters:
predicate- filter method, that returns true when the ScopeConfig must be present in the output- Returns:
- filtered ScopeMap
-
filterContainingAllClaims
Filter only those scopes that contain all the claims of the provided claimset- Parameters:
claims- claims to find scopes of- Returns:
- a scopemap with only the scopes that have all their claims present in the provided claimset
-