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:
  • Constructor Details

    • OAuth2ScopeSpecification

      protected OAuth2ScopeSpecification(Collection<String> specifiedScopes)
  • 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 class com.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 interface Describable<T extends OAuth2ScopeRequirement>
      Overrides:
      getDescriptor in class AbstractDescribableImpl<com.cloudbees.plugins.credentials.domains.DomainSpecification>