Class GoogleRobotCredentials
java.lang.Object
com.cloudbees.plugins.credentials.BaseCredentials
com.cloudbees.plugins.credentials.impl.BaseStandardCredentials
com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials
- 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
,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
- Direct Known Subclasses:
GoogleRobotMetadataCredentials
,GoogleRobotPrivateKeyCredentials
public abstract class GoogleRobotCredentials
extends com.cloudbees.plugins.credentials.impl.BaseStandardCredentials
implements GoogleOAuth2Credentials
The base implementation of service account (aka robot) credentials using OAuth2. These robot
credentials can be used to access Google APIs as the robot user.
- Author:
- Matt Moore
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
The descriptor for Google robot account credential extensionsstatic class
A trivial tuple for wrapping the list box of matched credentials with the requirements that were used to filter them.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
ConstructorsModifierConstructorDescriptionprotected
GoogleRobotCredentials
(com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String projectId, GoogleRobotCredentialsModule module) Deprecated.protected
GoogleRobotCredentials
(com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String projectId, String description, GoogleRobotCredentialsModule module) Base constructor for populating the scope, name, id, and project id for Google credentials.protected
GoogleRobotCredentials
(String projectId, GoogleRobotCredentialsModule module) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionforRemote
(GoogleOAuth2ScopeRequirement requirement) Retrieve a version of the credential that can be used on a remote machine.getAccessToken
(GoogleOAuth2ScopeRequirement requirement) static GoogleRobotCredentials
Retrieves theGoogleRobotCredentials
identified byid
.getCredentialsListBox
(Class<?> clazz) Helper utility for populating a jelly list box with matchingGoogleRobotCredentials
to avoid listing credentials that avoids surfacing those with insufficient permissions.Fetch the module used for instantiating the dependencies of credentialsRetrieve the project id for this credentialMethods 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.google.jenkins.plugins.credentials.oauth.GoogleOAuth2Credentials
getGoogleCredential
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
getUsername, isUsernameSecret
-
Constructor Details
-
GoogleRobotCredentials
Deprecated.Base constructor for populating the name and id for Google credentials.- Parameters:
projectId
- The project id with which this credential is associated.module
- The module to use for instantiating the dependencies of credentials.
-
GoogleRobotCredentials
protected GoogleRobotCredentials(@CheckForNull com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String projectId, String description, GoogleRobotCredentialsModule module) Base constructor for populating the scope, name, id, and project id for Google credentials. Leave the id empty to generate a new one, populate the id when updating an existing credential or migrating from using the project id as the credential id. Use the scope to define the extent to which these credentials are available within Jenkins (i.e., GLOBAL or SYSTEM).- Parameters:
scope
- The scope of the credentials, determining where they can be used in Jenkins. Can be either GLOBAL or SYSTEM.id
- The credential ID to assign.projectId
- The project id with which this credential is associated.description
- The credential descriptionmodule
- The module to use for instantiating the dependencies of credentials.
-
GoogleRobotCredentials
@Deprecated protected GoogleRobotCredentials(@CheckForNull com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String projectId, GoogleRobotCredentialsModule module) Deprecated.
-
-
Method Details
-
getModule
Fetch the module used for instantiating the dependencies of credentials -
getDescriptor
- Specified by:
getDescriptor
in interfacecom.cloudbees.plugins.credentials.Credentials
- Specified by:
getDescriptor
in interfaceDescribable<com.cloudbees.plugins.credentials.Credentials>
- Overrides:
getDescriptor
in classcom.cloudbees.plugins.credentials.BaseCredentials
-
getAccessToken
- Specified by:
getAccessToken
in interfacecom.google.jenkins.plugins.credentials.oauth.OAuth2Credentials<GoogleOAuth2ScopeRequirement>
-
getCredentialsListBox
Helper utility for populating a jelly list box with matchingGoogleRobotCredentials
to avoid listing credentials that avoids surfacing those with insufficient permissions.Modeled after: http://developer-blog.cloudbees.com/2012/10/using-ssh-from-jenkins.html
- Parameters:
clazz
- The class annotated with @RequiresDomain indicating its scope requirements.- Returns:
- a list box populated solely with credentials compatible for the extension being configured.
-
getById
Retrieves theGoogleRobotCredentials
identified byid
. -
forRemote
public GoogleRobotCredentials forRemote(GoogleOAuth2ScopeRequirement requirement) throws GeneralSecurityException Retrieve a version of the credential that can be used on a remote machine.- Throws:
GeneralSecurityException
-
getProjectId
Retrieve the project id for this credential
-