Class AbstractVaultTokenCredentialWithExpiration

java.lang.Object
com.cloudbees.plugins.credentials.BaseCredentials
com.cloudbees.plugins.credentials.impl.BaseStandardCredentials
com.datapipe.jenkins.vault.credentials.AbstractVaultTokenCredential
com.datapipe.jenkins.vault.credentials.AbstractVaultTokenCredentialWithExpiration
All Implemented Interfaces:
com.cloudbees.plugins.credentials.common.IdCredentials, com.cloudbees.plugins.credentials.common.StandardCredentials, com.cloudbees.plugins.credentials.Credentials, VaultCredential, ExtensionPoint, Describable<com.cloudbees.plugins.credentials.Credentials>, Serializable
Direct Known Subclasses:
AbstractAuthenticatingVaultTokenCredential

public abstract class AbstractVaultTokenCredentialWithExpiration extends AbstractVaultTokenCredential
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.cloudbees.plugins.credentials.impl.BaseStandardCredentials

    com.cloudbees.plugins.credentials.impl.BaseStandardCredentials.BaseStandardCredentialsDescriptor

    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

    Nested classes/interfaces inherited from interface com.datapipe.jenkins.vault.credentials.VaultCredential

    VaultCredential.NameProvider
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final Logger
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractVaultTokenCredentialWithExpiration(com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String description)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.bettercloud.vault.Vault
    authorizeWithVault(com.bettercloud.vault.VaultConfig config, List<String> policies)
     
    protected String
    getChildToken(com.bettercloud.vault.Vault vault, List<String> policies)
    Retrieves a new child token with specific policies if this credential is configured to use policies and a list of requested policies is provided.
    protected abstract String
    getToken(com.bettercloud.vault.Vault vault)
     
    Get if the configured policies should be used or not.
    protected com.bettercloud.vault.Vault
    getVault(com.bettercloud.vault.VaultConfig config)
     
    protected com.bettercloud.vault.api.Auth
    getVaultAuth(com.bettercloud.vault.Vault vault)
    Retrieve the Vault auth client.
    void
    setUsePolicies(Boolean usePolicies)
    Set if the configured policies are used or not.

    Methods inherited from class com.cloudbees.plugins.credentials.impl.BaseStandardCredentials

    equals, getDescription, getId, hashCode

    Methods inherited from class com.cloudbees.plugins.credentials.BaseCredentials

    getDescriptor, getScope

    Methods inherited from class java.lang.Object

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

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

    getDescriptor, getScope

    Methods inherited from interface com.cloudbees.plugins.credentials.common.IdCredentials

    getId

    Methods inherited from interface com.cloudbees.plugins.credentials.common.StandardCredentials

    getDescription
  • Field Details

    • LOGGER

      protected static final Logger LOGGER
  • Constructor Details

    • AbstractVaultTokenCredentialWithExpiration

      protected AbstractVaultTokenCredentialWithExpiration(com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String description)
  • Method Details

    • getUsePolicies

      @CheckForNull public Boolean getUsePolicies()
      Get if the configured policies should be used or not.
      Returns:
      true if the policies should be used, false or null otherwise
    • setUsePolicies

      @DataBoundSetter public void setUsePolicies(Boolean usePolicies)
      Set if the configured policies are used or not.
      Parameters:
      usePolicies - true if policies should be used, false otherwise
    • getToken

      protected abstract String getToken(com.bettercloud.vault.Vault vault)
      Specified by:
      getToken in class AbstractVaultTokenCredential
    • getVaultAuth

      protected com.bettercloud.vault.api.Auth getVaultAuth(@NonNull com.bettercloud.vault.Vault vault)
      Retrieve the Vault auth client. May be overridden in subclasses.
      Parameters:
      vault - the Vault instance
      Returns:
      the Vault auth client
    • getChildToken

      protected String getChildToken(com.bettercloud.vault.Vault vault, List<String> policies)
      Retrieves a new child token with specific policies if this credential is configured to use policies and a list of requested policies is provided.
      Parameters:
      vault - the vault instance
      policies - the policies list
      Returns:
      the new token or null if it cannot be provisioned
    • authorizeWithVault

      public com.bettercloud.vault.Vault authorizeWithVault(com.bettercloud.vault.VaultConfig config, List<String> policies)
      Specified by:
      authorizeWithVault in interface VaultCredential
      Overrides:
      authorizeWithVault in class AbstractVaultTokenCredential
    • getVault

      protected com.bettercloud.vault.Vault getVault(com.bettercloud.vault.VaultConfig config)