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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
GoogleRobotCredentials.AbstractGoogleRobotCredentialsDescriptor
The descriptor for Google robot account credential extensionsstatic class
GoogleRobotCredentials.CredentialsListBoxModel
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
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GoogleRobotCredentials
forRemote(GoogleOAuth2ScopeRequirement requirement)
Retrieve a version of the credential that can be used on a remote machine.Secret
getAccessToken(GoogleOAuth2ScopeRequirement requirement)
static GoogleRobotCredentials
getById(String id)
Retrieves theGoogleRobotCredentials
identified byid
.static GoogleRobotCredentials.CredentialsListBoxModel
getCredentialsListBox(Class<?> clazz)
Helper utility for populating a jelly list box with matchingGoogleRobotCredentials
to avoid listing credentials that avoids surfacing those with insufficient permissions.GoogleRobotCredentials.AbstractGoogleRobotCredentialsDescriptor
getDescriptor()
GoogleRobotCredentialsModule
getModule()
Fetch the module used for instantiating the dependencies of credentialsString
getProjectId()
Retrieve the project id for this credential-
Methods inherited from class com.cloudbees.plugins.credentials.impl.BaseStandardCredentials
equals, getDescription, getId, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.jenkins.plugins.credentials.oauth.GoogleOAuth2Credentials
getGoogleCredential
-
-
-
-
Constructor Detail
-
GoogleRobotCredentials
@Deprecated protected GoogleRobotCredentials(String projectId, GoogleRobotCredentialsModule module)
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 Detail
-
getModule
public GoogleRobotCredentialsModule getModule()
Fetch the module used for instantiating the dependencies of credentials
-
getDescriptor
public GoogleRobotCredentials.AbstractGoogleRobotCredentialsDescriptor 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
public Secret getAccessToken(GoogleOAuth2ScopeRequirement requirement)
- Specified by:
getAccessToken
in interfacecom.google.jenkins.plugins.credentials.oauth.OAuth2Credentials<GoogleOAuth2ScopeRequirement>
-
getCredentialsListBox
public static GoogleRobotCredentials.CredentialsListBoxModel getCredentialsListBox(Class<?> clazz)
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
public static GoogleRobotCredentials getById(String id)
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
public String getProjectId()
Retrieve the project id for this credential
-
-