Skip to content

Commit

Permalink
Code reivew comments p2
Browse files Browse the repository at this point in the history
  • Loading branch information
tkyc committed Mar 18, 2024
1 parent a3ba15d commit 5eb8e84
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class SQLServerMSAL4JUtils {
static final String SLASH_DEFAULT = "/.default";
static final String ACCESS_TOKEN_EXPIRE = "access token expires: ";

private static final TokenCacheMap tokenCacheMap = new TokenCacheMap();
private static final TokenCacheMap TOKEN_CACHE_MAP = new TokenCacheMap();

private final static String LOGCONTEXT = "MSAL version "
+ com.microsoft.aad.msal4j.PublicClientApplication.class.getPackage().getImplementationVersion() + ": ";
Expand All @@ -89,11 +89,11 @@ static SqlAuthenticationToken getSqlFedAuthToken(SqlFedAuthInfo fedAuthInfo, Str

try {
String hashedSecret = getHashedSecret(new String[] {fedAuthInfo.stsurl, user, password});
PersistentTokenCacheAccessAspect persistentTokenCacheAccessAspect = tokenCacheMap.getEntry(hashedSecret);
PersistentTokenCacheAccessAspect persistentTokenCacheAccessAspect = TOKEN_CACHE_MAP.getEntry(hashedSecret);

if (null == persistentTokenCacheAccessAspect) {
persistentTokenCacheAccessAspect = new PersistentTokenCacheAccessAspect();
tokenCacheMap.addEntry(hashedSecret, persistentTokenCacheAccessAspect);
TOKEN_CACHE_MAP.addEntry(hashedSecret, persistentTokenCacheAccessAspect);
}

final PublicClientApplication pca = PublicClientApplication
Expand Down Expand Up @@ -145,11 +145,11 @@ static SqlAuthenticationToken getSqlFedAuthTokenPrincipal(SqlFedAuthInfo fedAuth
try {
String hashedSecret = getHashedSecret(
new String[] {fedAuthInfo.stsurl, aadPrincipalID, aadPrincipalSecret});
PersistentTokenCacheAccessAspect persistentTokenCacheAccessAspect = tokenCacheMap.getEntry(hashedSecret);
PersistentTokenCacheAccessAspect persistentTokenCacheAccessAspect = TOKEN_CACHE_MAP.getEntry(hashedSecret);

if (null == persistentTokenCacheAccessAspect) {
persistentTokenCacheAccessAspect = new PersistentTokenCacheAccessAspect();
tokenCacheMap.addEntry(hashedSecret, persistentTokenCacheAccessAspect);
TOKEN_CACHE_MAP.addEntry(hashedSecret, persistentTokenCacheAccessAspect);
}

IClientCredential credential = ClientCredentialFactory.createFromSecret(aadPrincipalSecret);
Expand Down Expand Up @@ -202,11 +202,11 @@ static SqlAuthenticationToken getSqlFedAuthTokenPrincipalCertificate(SqlFedAuthI
try {
String hashedSecret = getHashedSecret(new String[] {fedAuthInfo.stsurl, aadPrincipalID, certFile,
certPassword, certKey, certKeyPassword});
PersistentTokenCacheAccessAspect persistentTokenCacheAccessAspect = tokenCacheMap.getEntry(hashedSecret);
PersistentTokenCacheAccessAspect persistentTokenCacheAccessAspect = TOKEN_CACHE_MAP.getEntry(hashedSecret);

if (null == persistentTokenCacheAccessAspect) {
persistentTokenCacheAccessAspect = new PersistentTokenCacheAccessAspect();
tokenCacheMap.addEntry(hashedSecret, persistentTokenCacheAccessAspect);
TOKEN_CACHE_MAP.addEntry(hashedSecret, persistentTokenCacheAccessAspect);
}

ConfidentialClientApplication clientApplication = null;
Expand Down

0 comments on commit 5eb8e84

Please sign in to comment.