Class CredentialsUtil


  • public class CredentialsUtil
    extends Object
    Provides a library of utility functions for credentials-related work.
    • Constructor Detail

      • CredentialsUtil

        public CredentialsUtil()
    • Method Detail

      • getRobotCredentials

        public static com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials getRobotCredentials​(ItemGroup itemGroup,
                                                                                                              com.google.common.collect.ImmutableList<com.cloudbees.plugins.credentials.domains.DomainRequirement> domainRequirements,
                                                                                                              String credentialsId)
                                                                                                       throws AbortException
        Get the Google Robot Credentials for the given credentialsId.
        Parameters:
        itemGroup - A handle to the Jenkins instance. Must be non-null.
        domainRequirements - A list of domain requirements. Must be non-null.
        credentialsId - The ID of the GoogleRobotCredentials to be retrieved from Jenkins and utilized for authorization. Must be non-empty or non-null and exist in credentials store.
        Returns:
        Google Robot Credential for the given credentialsId.
        Throws:
        AbortException - If there was an issue retrieving the Google Robot Credentials.
      • getGoogleCredential

        public static com.google.api.client.auth.oauth2.Credential getGoogleCredential​(com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials robotCreds)
                                                                                throws AbortException
        Get the Credential from the Google robot credentials for GKE access.
        Parameters:
        robotCreds - Google Robot Credential for desired service account.
        Returns:
        Google Credential for the service account.
        Throws:
        AbortException - if there was an error initializing HTTP transport.