Package com.nimbusds.oauth2.sdk
Class Scope
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Scope.Value>
,Collection<Scope.Value>
,Set<Scope.Value>
Authorisation scope.
Example scope from OpenID Connect indicating access to the user's email and profile details:
Scope scope = new Scope(); scope.add(OIDCScopeValue.OPENID); scope.add(OIDCScopeValue.EMAIL); scope.add(OIDCScopeValue.PROFILE);
Related specifications:
- OAuth 2.0 (RFC 6749)
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionScope()
Creates a new empty authorisation scope.Creates a new scope from the specified scope.Scope
(Scope.Value... values) Creates a new authorisation scope with the specified values.Creates a new authorisation scope with the specified string values. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds the specified string value to this scope.boolean
Checks if this scope contains the specified string value.static Scope
Parses a scope from the specified string representation.static Scope
parse
(Collection<String> collection) Parses a scope from the specified string collection representation.toString()
Returns the string representation of this scope.Returns the string list representation of this scope.Methods inherited from class java.util.LinkedHashSet
spliterator
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size, toArray, toArray
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
Scope
public Scope()Creates a new empty authorisation scope. -
Scope
Creates a new scope from the specified scope.- Parameters:
scope
- The scope. May benull
.
-
Scope
Creates a new authorisation scope with the specified string values.- Parameters:
values
- The string values.
-
Scope
Creates a new authorisation scope with the specified values.- Parameters:
values
- The values.
-
-
Method Details
-
add
Adds the specified string value to this scope.- Parameters:
value
- The string value. Must not benull
.- Returns:
true
if this scope did not already contain the specified value.
-
contains
Checks if this scope contains the specified string value.- Parameters:
value
- The string value. Must not benull
.- Returns:
true
if the value is contained, elsefalse
.
-
toString
Returns the string representation of this scope. The scope values will be serialised in the order they were added.- Overrides:
toString
in classAbstractCollection<Scope.Value>
- Returns:
- The string representation.
-
toStringList
Returns the string list representation of this scope. The scope values will be serialised in the order they were added.- Returns:
- The string list representation.
-
parse
Parses a scope from the specified string collection representation.- Parameters:
collection
- The string collection,null
if not specified.- Returns:
- The scope,
null
if not specified.
-
parse
Parses a scope from the specified string representation.- Parameters:
s
- The scope string,null
if not specified.- Returns:
- The scope,
null
if not specified.
-