Skip to content

Commit

Permalink
Fixed token expiry bug with cache (#2025)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkyc authored Jan 3, 2023
1 parent 8538cb1 commit c679a9f
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,16 +408,10 @@ static SqlFedAuthToken getMSIAuthToken(String resource, String msiClientId) thro

int startIndex_ATX;

// Fetch expires_on
if (isAzureFunction) {
startIndex_ATX = result
.indexOf(ActiveDirectoryAuthentication.ACCESS_TOKEN_EXPIRES_ON_IDENTIFIER)
+ ActiveDirectoryAuthentication.ACCESS_TOKEN_EXPIRES_ON_IDENTIFIER.length();
} else {
startIndex_ATX = result
.indexOf(ActiveDirectoryAuthentication.ACCESS_TOKEN_EXPIRES_IN_IDENTIFIER)
+ ActiveDirectoryAuthentication.ACCESS_TOKEN_EXPIRES_IN_IDENTIFIER.length();
}
// Fetch expires_in (this is in seconds)
startIndex_ATX = result
.indexOf(ActiveDirectoryAuthentication.ACCESS_TOKEN_EXPIRES_IN_IDENTIFIER)
+ ActiveDirectoryAuthentication.ACCESS_TOKEN_EXPIRES_IN_IDENTIFIER.length();

String accessTokenExpiry = result.substring(startIndex_ATX,
result.indexOf("\"", startIndex_ATX + 1));
Expand Down

0 comments on commit c679a9f

Please sign in to comment.