Class GoogleRobotMetadataCredentials
java.lang.Object
com.cloudbees.plugins.credentials.BaseCredentials
com.cloudbees.plugins.credentials.impl.BaseStandardCredentials
com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials
com.google.jenkins.plugins.credentials.oauth.GoogleRobotMetadataCredentials
- All Implemented Interfaces:
com.cloudbees.plugins.credentials.common.IdCredentials
,com.cloudbees.plugins.credentials.common.StandardCredentials
,com.cloudbees.plugins.credentials.common.StandardUsernameCredentials
,com.cloudbees.plugins.credentials.common.UsernameCredentials
,com.cloudbees.plugins.credentials.Credentials
,com.cloudbees.plugins.credentials.domains.DomainRestrictedCredentials
,GoogleOAuth2Credentials
,com.google.jenkins.plugins.credentials.oauth.OAuth2Credentials<GoogleOAuth2ScopeRequirement>
,com.google.jenkins.plugins.credentials.oauth.StandardUsernameOAuth2Credentials<GoogleOAuth2ScopeRequirement>
,ExtensionPoint
,Describable<com.cloudbees.plugins.credentials.Credentials>
,Serializable
@NameWith(value=GoogleRobotNameProvider.class,
priority=50)
public final class GoogleRobotMetadataCredentials
extends GoogleRobotCredentials
implements com.cloudbees.plugins.credentials.domains.DomainRestrictedCredentials
An implementation of
GoogleRobotCredentials
that produces OAuth2 access tokens using the
metadata service attached to Google Compute instances. These Credentials are inherently limited
to the set of OAuth2 scopes that a Google Compute instance is bound to at startup.
NOTE: This plugin is only available to Jenkins masters running on a Google Compute Engine virtual machine.
- Author:
- Matt Moore
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Descriptor for our unlimited service account extension.Nested classes/interfaces inherited from class com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials
GoogleRobotCredentials.AbstractGoogleRobotCredentialsDescriptor, GoogleRobotCredentials.CredentialsListBoxModel
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.cloudbees.plugins.credentials.common.StandardUsernameCredentials
com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.NameProvider
-
Constructor Summary
ConstructorsConstructorDescriptionGoogleRobotMetadataCredentials
(com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String projectId, GoogleRobotMetadataCredentialsModule module) Deprecated.GoogleRobotMetadataCredentials
(com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String projectId, String description, GoogleRobotMetadataCredentialsModule module) Construct a set of service account credentials with a specific id.GoogleRobotMetadataCredentials
(String projectId, GoogleRobotMetadataCredentialsModule module) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptioncom.google.api.client.googleapis.compute.ComputeCredential
getGoogleCredential
(GoogleOAuth2ScopeRequirement requirement) Fetches a Credential for the set of OAuth 2.0 scopes required.Fetch the module used for instantiating the dependencies of credentialsboolean
Methods inherited from class com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials
forRemote, getAccessToken, getById, getCredentialsListBox, getProjectId
Methods inherited from class com.cloudbees.plugins.credentials.impl.BaseStandardCredentials
equals, getDescription, getId, hashCode
Methods inherited from class com.cloudbees.plugins.credentials.BaseCredentials
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
forRun, getScope
Methods inherited from interface com.cloudbees.plugins.credentials.common.IdCredentials
getId
Methods inherited from interface com.cloudbees.plugins.credentials.common.StandardCredentials
getDescription
Methods inherited from interface com.cloudbees.plugins.credentials.common.UsernameCredentials
isUsernameSecret
-
Constructor Details
-
GoogleRobotMetadataCredentials
@Deprecated public GoogleRobotMetadataCredentials(String projectId, @Nullable GoogleRobotMetadataCredentialsModule module) throws Exception Deprecated.Construct a set of service account credentials.- Parameters:
projectId
- The Pantheon project id associated with this service accountmodule
- The module for instantiating dependent objects, or null.- Throws:
Exception
-
GoogleRobotMetadataCredentials
@Deprecated public GoogleRobotMetadataCredentials(@CheckForNull com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String projectId, @Nullable GoogleRobotMetadataCredentialsModule module) throws Exception Deprecated.- Throws:
Exception
-
GoogleRobotMetadataCredentials
@DataBoundConstructor public GoogleRobotMetadataCredentials(@CheckForNull com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String projectId, String description, @Nullable GoogleRobotMetadataCredentialsModule module) throws Exception Construct a set of service account credentials with a specific id. It helps for updating credentials, as well as for migrating old credentials that had no id and relied on the project id.- Parameters:
scope
- The scope of the credentials, determining where they can be used in Jenkins. Can be either GLOBAL or SYSTEM.id
- the id to assignprojectId
- The Pantheon project id associated with this service accountdescription
- The credential descriptionmodule
- The module for instantiating dependent objects, or null.- Throws:
Exception
-
-
Method Details
-
getModule
Fetch the module used for instantiating the dependencies of credentials- Overrides:
getModule
in classGoogleRobotCredentials
-
matches
public boolean matches(List<com.cloudbees.plugins.credentials.domains.DomainRequirement> requirements) - Specified by:
matches
in interfacecom.cloudbees.plugins.credentials.domains.DomainRestrictedCredentials
-
getUsername
- Specified by:
getUsername
in interfacecom.cloudbees.plugins.credentials.common.UsernameCredentials
-
getGoogleCredential
public com.google.api.client.googleapis.compute.ComputeCredential getGoogleCredential(GoogleOAuth2ScopeRequirement requirement) throws GeneralSecurityException Fetches a Credential for the set of OAuth 2.0 scopes required.- Specified by:
getGoogleCredential
in interfaceGoogleOAuth2Credentials
- Parameters:
requirement
- The set of required OAuth 2.0 scopes- Returns:
- The Credential authorizing usage of the API scopes
- Throws:
GeneralSecurityException
- when the authentication fails
-
getDescriptor
- Specified by:
getDescriptor
in interfacecom.cloudbees.plugins.credentials.Credentials
- Specified by:
getDescriptor
in interfaceDescribable<com.cloudbees.plugins.credentials.Credentials>
- Overrides:
getDescriptor
in classGoogleRobotCredentials
-