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, returnsUNKNOWN
fromtest(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 returnsPOSITIVE
/NEGATIVE
depending on whetherspecifiedScopes
is a superset of the required scopes.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OAuth2ScopeSpecification.Descriptor<T extends OAuth2ScopeRequirement>
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
Constructors Modifier Constructor Description protected
OAuth2ScopeSpecification(Collection<String> specifiedScopes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.cloudbees.plugins.credentials.domains.DomainSpecification.Result
_test(T requirement)
Surfaces a hook for implementations to override or extend the default functionality of simply matching the set of scopes.OAuth2ScopeSpecification.Descriptor<T>
getDescriptor()
Collection<String>
getSpecifiedScopes()
Surfaces the set of scopes specified by this requirement for jelly roundtripping.com.cloudbees.plugins.credentials.domains.DomainSpecification.Result
test(com.cloudbees.plugins.credentials.domains.DomainRequirement requirement)
Tests the scope against this specification.
-
-
-
Constructor Detail
-
OAuth2ScopeSpecification
protected OAuth2ScopeSpecification(Collection<String> specifiedScopes)
-
-
Method Detail
-
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
protected com.cloudbees.plugins.credentials.domains.DomainSpecification.Result _test(T requirement)
Surfaces a hook for implementations to override or extend the default functionality of simply matching the set of scopes.
-
getSpecifiedScopes
public Collection<String> getSpecifiedScopes()
Surfaces the set of scopes specified by this requirement for jelly roundtripping.
-
getDescriptor
public OAuth2ScopeSpecification.Descriptor<T> getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<T extends OAuth2ScopeRequirement>
- Overrides:
getDescriptor
in classAbstractDescribableImpl<com.cloudbees.plugins.credentials.domains.DomainSpecification>
-
-