public class AwsCodeCommitCredentialProvider
extends org.eclipse.jgit.transport.CredentialsProvider
CredentialsProvider implementation that can provide the
appropriate credentials to connect to an AWS CodeCommit repository.
From the command line, you can configure git to use AWS code commit with a credential helper. However, jgit does not support credential helper commands, but it does provide a CredentialsProvider abstract class we can extend. Connecting to an AWS CodeCommit (codecommit) repository requires an AWS access key and secret key. These are used to calculate a signature for the git request. The AWS access key is used as the codecommit username, and the calculated signature is used as the password. The process for calculating this signature is documented very well at https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html.
Connecting to an AWS CodeCommit (codecommit) repository requires an AWS access key and secret key. These are used to calculate a signature for the git request. The AWS access key is used as the codecommit username, and the calculated signature is used as the password. The process for calculating this signature is documented very well at https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html.| Modifier and Type | Class and Description |
|---|---|
class |
AwsCodeCommitCredentialProvider.AWSStaticCredentialsProvider
Simple implementation of AWSCredentialsProvider that just wraps static
AWSCredentials.
|
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.logging.Log |
logger |
| Constructor and Description |
|---|
AwsCodeCommitCredentialProvider() |
| Modifier and Type | Method and Description |
|---|---|
protected static String |
calculateCodeCommitPassword(org.eclipse.jgit.transport.URIish uri,
String awsSecretKey)
Calculate the AWS CodeCommit password for the provided URI and AWS secret key.
|
static boolean |
canHandle(String uri)
This provider can handle uris like
https://git-codecommit.$AWS_REGION.amazonaws.com/v1/repos/$REPO .
|
boolean |
get(org.eclipse.jgit.transport.URIish uri,
org.eclipse.jgit.transport.CredentialItem... items)
Get the username and password to use for the given uri.
|
com.amazonaws.auth.AWSCredentialsProvider |
getAwsCredentialProvider() |
String |
getPassword() |
String |
getUsername() |
boolean |
isInteractive()
This credentials provider cannot run interactively.
|
void |
reset(org.eclipse.jgit.transport.URIish uri)
Throw out cached data and force retrieval of AWS credentials.
|
void |
setAwsCredentialProvider(com.amazonaws.auth.AWSCredentialsProvider awsCredentialProvider) |
void |
setPassword(String password) |
void |
setUsername(String username) |
boolean |
supports(org.eclipse.jgit.transport.CredentialItem... items)
We support username and password credential items only.
|
protected static String calculateCodeCommitPassword(org.eclipse.jgit.transport.URIish uri, String awsSecretKey)
uri - the codecommit repository uriawsSecretKey - the aws secret keypublic static boolean canHandle(String uri)
uri - uri to parsetrue if the URI can be handledpublic boolean isInteractive()
isInteractive in class org.eclipse.jgit.transport.CredentialsProviderCredentialsProvider.isInteractive()public boolean supports(org.eclipse.jgit.transport.CredentialItem... items)
supports in class org.eclipse.jgit.transport.CredentialsProviderCredentialsProvider.supports(org.eclipse.jgit.transport.CredentialItem[])public boolean get(org.eclipse.jgit.transport.URIish uri,
org.eclipse.jgit.transport.CredentialItem... items)
throws org.eclipse.jgit.errors.UnsupportedCredentialItem
get in class org.eclipse.jgit.transport.CredentialsProviderorg.eclipse.jgit.errors.UnsupportedCredentialItemCredentialsProvider.get(org.eclipse.jgit.transport.URIish,
org.eclipse.jgit.transport.CredentialItem[])public void reset(org.eclipse.jgit.transport.URIish uri)
reset in class org.eclipse.jgit.transport.CredentialsProvideruri - This parameter is not used in this implementation.public com.amazonaws.auth.AWSCredentialsProvider getAwsCredentialProvider()
public void setAwsCredentialProvider(com.amazonaws.auth.AWSCredentialsProvider awsCredentialProvider)
awsCredentialProvider - the awsCredentialProvider to setpublic String getUsername()
public void setUsername(String username)
username - the username to setpublic String getPassword()
public void setPassword(String password)
password - the password to setCopyright © 2019 Pivotal Software, Inc.. All rights reserved.