Skip to content

Commit

Permalink
Revert "wip"
Browse files Browse the repository at this point in the history
This reverts commit 48e5cd6.
  • Loading branch information
snf2ye committed Dec 13, 2024
1 parent 5b45212 commit 1da7fb6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public GoogleCredentials getApplicationDefault() {
*/
public String getAccessToken(GoogleCredentials credentials, List<String> scopes) {
try {
credentials = credentials.createScoped(scopes);
if (credentials.createScopedRequired()) {
credentials = credentials.createScoped(scopes);
}
return credentials.refreshAccessToken().getTokenValue();
} catch (IOException e) {
throw new GoogleResourceException("Could not generate Google access token", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ public boolean canAccess(AuthenticatedUserRequest user, String billingAccountId)
return false;
}
String message =
String.format(
"Could not check permissions on billing account '%s' for user '%s'",
billingAccountId, user.getEmail());
String.format("Could not check permissions on billing account '%s'", billingAccountId);
throw new BillingServiceException(message, e);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/bio/terra/common/auth/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class AuthService {
private static Logger logger = LoggerFactory.getLogger(AuthService.class);
private static ExpirationPolicy<String, GoogleCredentials> TOKEN_CACHE_EXPIRATION_POLICY =
// Make sure this value never returns a negative since that means the entry never expires
(key, value) -> Math.max(0, TimeUnit.MINUTES.toMillis(5));
(key, value) -> Math.max(0, 5 - TimeUnit.MINUTES.toMillis(5));

// the list of scopes we request from end users when they log in.
// this should always match exactly what the UI requests, so our tests represent actual user
Expand Down

0 comments on commit 1da7fb6

Please sign in to comment.