Skip to content

Commit bd7af8d

Browse files
committed
refactor: consolidate token type constants using OAuth2Utils
1 parent 06982d4 commit bd7af8d

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

oauth2_http/java/com/google/auth/oauth2/GdchCredentials.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,8 @@ public class GdchCredentials extends GoogleCredentials {
7676
private static final String PARSE_ERROR_PREFIX = "Error parsing token refresh response. ";
7777
@VisibleForTesting static final String SUPPORTED_FORMAT_VERSION = "1";
7878

79-
private static final String ACCESS_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:access_token";
8079
private static final String SERVICE_ACCOUNT_TOKEN_TYPE =
8180
"urn:k8s:params:oauth:token-type:serviceaccount";
82-
private static final String TOKEN_TYPE_TOKEN_EXCHANGE =
83-
"urn:ietf:params:oauth:token-type:token-exchange";
8481

8582
private static final int DEFAULT_LIFETIME_IN_SECONDS = 3600;
8683

@@ -288,8 +285,8 @@ public AccessToken refreshAccessToken() throws IOException {
288285

289286
GenericData tokenRequest = new GenericData();
290287
tokenRequest.set("audience", apiAudience);
291-
tokenRequest.set("grant_type", TOKEN_TYPE_TOKEN_EXCHANGE);
292-
tokenRequest.set("requested_token_type", ACCESS_TOKEN_TYPE);
288+
tokenRequest.set("grant_type", OAuth2Utils.TOKEN_TYPE_TOKEN_EXCHANGE);
289+
tokenRequest.set("requested_token_type", OAuth2Utils.TOKEN_TYPE_ACCESS_TOKEN);
293290
tokenRequest.set("subject_token", assertion);
294291
tokenRequest.set("subject_token_type", SERVICE_ACCOUNT_TOKEN_TYPE);
295292

0 commit comments

Comments
 (0)