Class ScopedCredentials

java.lang.Object
io.jenkins.plugins.credentials.secretsmanager.ScopedCredentials
All Implemented Interfaces:
com.cloudbees.plugins.credentials.common.IdCredentials, com.cloudbees.plugins.credentials.common.StandardCredentials, com.cloudbees.plugins.credentials.Credentials, ExtensionPoint, Describable<com.cloudbees.plugins.credentials.Credentials>, Serializable

public class ScopedCredentials extends Object implements com.cloudbees.plugins.credentials.common.StandardCredentials
Wrapper that adds folder scope metadata to any StandardCredentials. This allows credentials to be filtered based on the requesting folder context without modifying the individual credential type implementations.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface hudson.ExtensionPoint

    ExtensionPoint.LegacyInstancesAreScopedToHudson

    Nested classes/interfaces inherited from interface com.cloudbees.plugins.credentials.common.IdCredentials

    com.cloudbees.plugins.credentials.common.IdCredentials.Helpers

    Nested classes/interfaces inherited from interface com.cloudbees.plugins.credentials.common.StandardCredentials

    com.cloudbees.plugins.credentials.common.StandardCredentials.NameProvider
  • Constructor Summary

    Constructors
    Constructor
    Description
    ScopedCredentials(com.cloudbees.plugins.credentials.common.StandardCredentials delegate, FolderScope folderScope)
    Creates a scoped credential wrapper.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    as(Class<T> type)
    Gets the underlying credential cast to the specified type.
    boolean
     
    com.cloudbees.plugins.credentials.common.StandardCredentials
    Gets the underlying delegate credential.
     
    com.cloudbees.plugins.credentials.CredentialsDescriptor
     
    Gets the folder scope for this credential.
     
    com.cloudbees.plugins.credentials.CredentialsScope
     
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.cloudbees.plugins.credentials.Credentials

    forRun
  • Constructor Details

    • ScopedCredentials

      public ScopedCredentials(@NonNull com.cloudbees.plugins.credentials.common.StandardCredentials delegate, @NonNull FolderScope folderScope)
      Creates a scoped credential wrapper.
      Parameters:
      delegate - the underlying credential
      folderScope - the folder scope for this credential
  • Method Details

    • getFolderScope

      @NonNull public FolderScope getFolderScope()
      Gets the folder scope for this credential.
      Returns:
      the folder scope
    • as

      @CheckForNull public <T> T as(@NonNull Class<T> type)
      Gets the underlying credential cast to the specified type.
      Type Parameters:
      T - the credential type
      Parameters:
      type - the type to cast to
      Returns:
      the credential as the specified type, or null if not compatible
    • getDelegate

      @NonNull public com.cloudbees.plugins.credentials.common.StandardCredentials getDelegate()
      Gets the underlying delegate credential.
      Returns:
      the delegate credential
    • getId

      @NonNull public String getId()
      Specified by:
      getId in interface com.cloudbees.plugins.credentials.common.IdCredentials
    • getDescription

      @NonNull public String getDescription()
      Specified by:
      getDescription in interface com.cloudbees.plugins.credentials.common.StandardCredentials
    • getScope

      @NonNull public com.cloudbees.plugins.credentials.CredentialsScope getScope()
      Specified by:
      getScope in interface com.cloudbees.plugins.credentials.Credentials
    • getDescriptor

      @NonNull public com.cloudbees.plugins.credentials.CredentialsDescriptor getDescriptor()
      Specified by:
      getDescriptor in interface com.cloudbees.plugins.credentials.Credentials
      Specified by:
      getDescriptor in interface Describable<com.cloudbees.plugins.credentials.Credentials>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object