Skip to content
Permalink
Browse files
feat: add workload identity federation support (#547)
Adds new credential types for File/URL based external credentials.
Adds utilities for STS token exchange

See go/guac-3pi-java.

Co-authored-by: Jeff Ching <chingor@google.com>
  • Loading branch information
lsirac and chingor13 committed Feb 18, 2021
1 parent 2142db3 commit b8dde1e43f86a0a00741790c12d73f6cbda6251d
Showing with 5,159 additions and 7 deletions.
  1. +56 −0 oauth2_http/java/com/google/auth/oauth2/ActingParty.java
  2. +349 −0 oauth2_http/java/com/google/auth/oauth2/AwsCredentials.java
  3. +99 −0 oauth2_http/java/com/google/auth/oauth2/AwsDates.java
  4. +191 −0 oauth2_http/java/com/google/auth/oauth2/AwsRequestSignature.java
  5. +336 −0 oauth2_http/java/com/google/auth/oauth2/AwsRequestSigner.java
  6. +65 −0 oauth2_http/java/com/google/auth/oauth2/AwsSecurityCredentials.java
  7. +41 −0 oauth2_http/java/com/google/auth/oauth2/CredentialFormatException.java
  8. +456 −0 oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java
  9. +4 −1 oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java
  10. +318 −0 oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentials.java
  11. +81 −0 oauth2_http/java/com/google/auth/oauth2/OAuthException.java
  12. +226 −0 oauth2_http/java/com/google/auth/oauth2/StsRequestHandler.java
  13. +184 −0 oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeRequest.java
  14. +139 −0 oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeResponse.java
  15. +35 −6 oauth2_http/javatests/com/google/auth/TestUtils.java
  16. +539 −0 oauth2_http/javatests/com/google/auth/oauth2/AwsCredentialsTest.java
  17. +544 −0 oauth2_http/javatests/com/google/auth/oauth2/AwsRequestSignerTest.java
  18. +358 −0 oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java
  19. +40 −0 oauth2_http/javatests/com/google/auth/oauth2/GoogleCredentialsTest.java
  20. +488 −0 oauth2_http/javatests/com/google/auth/oauth2/IdentityPoolCredentialsTest.java
  21. +263 −0 oauth2_http/javatests/com/google/auth/oauth2/MockExternalAccountCredentialsTransport.java
  22. +87 −0 oauth2_http/javatests/com/google/auth/oauth2/OAuthExceptionTest.java
  23. +251 −0 oauth2_http/javatests/com/google/auth/oauth2/StsRequestHandlerTest.java
  24. +9 −0 oauth2_http/testresources/aws_security_credentials.json
@@ -0,0 +1,56 @@
/*
* Copyright 2021 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Google LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package com.google.auth.oauth2;

import static com.google.common.base.Preconditions.checkNotNull;

/**
* The acting party as defined in <a href="https://tools.ietf.org/html/rfc8693">OAuth 2.0 Token
* Exchange</a>.
*/
final class ActingParty {
private final String actorToken;
private final String actorTokenType;

ActingParty(String actorToken, String actorTokenType) {
this.actorToken = checkNotNull(actorToken);
this.actorTokenType = checkNotNull(actorTokenType);
}

String getActorToken() {
return actorToken;
}

String getActorTokenType() {
return actorTokenType;
}
}

0 comments on commit b8dde1e

Please sign in to comment.