Class OAuth2ScopeSpecification<T extends OAuth2ScopeRequirement>
java.lang.Object
hudson.model.AbstractDescribableImpl<com.cloudbees.plugins.credentials.domains.DomainSpecification>
com.cloudbees.plugins.credentials.domains.DomainSpecification
com.google.jenkins.plugins.credentials.oauth.OAuth2ScopeSpecification<T>
- Type Parameters:
T
- The type of requirements to which this specification may apply
- All Implemented Interfaces:
ExtensionPoint
,Describable<com.cloudbees.plugins.credentials.domains.DomainSpecification>
,Serializable
public abstract class OAuth2ScopeSpecification<T extends OAuth2ScopeRequirement>
extends com.cloudbees.plugins.credentials.domains.DomainSpecification
The base class for provider-specific specifications, instantiated with the
provider-specific requirement type to which the specification should apply.
NOTE: The reason for provider-specific paired implementations of scope /
requirement is due to the fact that an OAuth2 credential is per-provider
(e.g. Google, Facebook, GitHub).
This base implementation, returns
UNKNOWN
from test(com.cloudbees.plugins.credentials.domains.DomainRequirement)
if the passed requirement doesn't match our descriptor's provider
requirement. It then delegates to _test(T)
, a hook that by default
returns POSITIVE
/NEGATIVE
depending on whether
specifiedScopes
is a superset of the required scopes.- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The base descriptor for specification extensions.Nested classes/interfaces inherited from class com.cloudbees.plugins.credentials.domains.DomainSpecification
com.cloudbees.plugins.credentials.domains.DomainSpecification.Result
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Constructor Summary
ModifierConstructorDescriptionprotected
OAuth2ScopeSpecification
(Collection<String> specifiedScopes) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.cloudbees.plugins.credentials.domains.DomainSpecification.Result
Surfaces a hook for implementations to override or extend the default functionality of simply matching the set of scopes.Surfaces the set of scopes specified by this requirement for jelly roundtripping.final com.cloudbees.plugins.credentials.domains.DomainSpecification.Result
test
(com.cloudbees.plugins.credentials.domains.DomainRequirement requirement) Tests the scope against this specification.
-
Constructor Details
-
OAuth2ScopeSpecification
-
-
Method Details
-
test
public final com.cloudbees.plugins.credentials.domains.DomainSpecification.Result test(com.cloudbees.plugins.credentials.domains.DomainRequirement requirement) Tests the scope against this specification.- Specified by:
test
in classcom.cloudbees.plugins.credentials.domains.DomainSpecification
- Parameters:
requirement
- The set of requirements to validate against this specification- Returns:
- the result of the test.
-
_test
Surfaces a hook for implementations to override or extend the default functionality of simply matching the set of scopes. -
getSpecifiedScopes
Surfaces the set of scopes specified by this requirement for jelly roundtripping. -
getDescriptor
- Specified by:
getDescriptor
in interfaceDescribable<T extends OAuth2ScopeRequirement>
- Overrides:
getDescriptor
in classAbstractDescribableImpl<com.cloudbees.plugins.credentials.domains.DomainSpecification>
-