Skip to content

Commit

Permalink
Fixed token expiry in cache (#2020)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkyc authored Dec 29, 2022
1 parent 7e24f08 commit 3d61735
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,16 +423,10 @@ static SqlFedAuthToken getMSIAuthToken(String resource, String msiClientId,

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();

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

0 comments on commit 3d61735

Please sign in to comment.