@NameWith(value=GoogleRobotUsernamePassword.NameProvider.class, priority=99) public class GoogleRobotUsernamePassword extends com.cloudbees.plugins.credentials.impl.BaseStandardCredentials implements com.cloudbees.plugins.credentials.domains.DomainRestrictedCredentials, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials
GoogleRobotCredentials
as a username and password for use with a
hudson.scm.SCM
.
BACKGROUND: For Cloud projects with a private repository, Google accepts a username/password combination that is truly email/oauth-refresh-token. For service accounts, for which a refresh token may not be readily available (e.g. with Compute Engine's metadata service) it also supports using: email/oauth-access-token.
This credential wraps a service account credential to provide it in this
manner as a StandardUsernamePasswordCredentials
for usage with the
new Credentials
-aware hudson.scm.SCM
plugins.
Modifier and Type | Class and Description |
---|---|
static class |
GoogleRobotUsernamePassword.EnclosingDomainRequirementProvider
We do not have a descriptor, so that we won't show up in the user interface
as a credential that can be explicitly created, so we will not be
discovered by the DescribableDomainRequirementProvider.
|
static class |
GoogleRobotUsernamePassword.NameProvider
Provide a name that the user will understand, in the dropdown
shown by
hudson.scm.SCM s. |
Constructor and Description |
---|
GoogleRobotUsernamePassword(String credentialsId,
GoogleRobotUsernamePasswordModule module)
Constructs a username and password credential wrapper around the existing
credential, specified by
credentialsId . |
Modifier and Type | Method and Description |
---|---|
com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials |
getCredentials()
Retrieve our wrapped credentials based on the above ID we store.
|
String |
getCredentialsId()
Return the unique ID of the inner
GoogleRobotCredentials that this
Username/Password proxy is wrapping. |
String |
getDescription() |
com.cloudbees.plugins.credentials.CredentialsDescriptor |
getDescriptor() |
hudson.util.Secret |
getPassword() |
String |
getUsername() |
boolean |
matches(List<com.cloudbees.plugins.credentials.domains.DomainRequirement> requirements)
This type of credentials only works for authenticating against
and "source.developers.google.com" hosted repositories, for which
we require "https".
|
equals, getId, hashCode
@DataBoundConstructor public GoogleRobotUsernamePassword(String credentialsId, @Nullable GoogleRobotUsernamePasswordModule module)
credentialsId
.public boolean matches(List<com.cloudbees.plugins.credentials.domains.DomainRequirement> requirements)
matches
in interface com.cloudbees.plugins.credentials.domains.DomainRestrictedCredentials
public String getCredentialsId()
GoogleRobotCredentials
that this
Username/Password proxy is wrapping.@Nullable public com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials getCredentials()
public String getDescription()
getDescription
in interface com.cloudbees.plugins.credentials.common.StandardCredentials
getDescription
in class com.cloudbees.plugins.credentials.impl.BaseStandardCredentials
public com.cloudbees.plugins.credentials.CredentialsDescriptor getDescriptor()
getDescriptor
in interface com.cloudbees.plugins.credentials.Credentials
getDescriptor
in interface hudson.model.Describable<com.cloudbees.plugins.credentials.Credentials>
getDescriptor
in class com.cloudbees.plugins.credentials.BaseCredentials
public String getUsername()
getUsername
in interface com.cloudbees.plugins.credentials.common.UsernameCredentials
public hudson.util.Secret getPassword()
getPassword
in interface com.cloudbees.plugins.credentials.common.PasswordCredentials
Copyright © 2016–2019. All rights reserved.