@@ -59,18 +59,18 @@ String getKey() {
5959 return String .join (Constants .CACHE_KEY_SEPARATOR , keyParts ).toLowerCase ();
6060 }
6161
62- static AccountCacheEntity create (String clientInfoStr , String environment , IdToken idToken , String policy ) {
62+ static AccountCacheEntity create (String clientInfoStr , Authority requestAuthority , IdToken idToken , String policy ) {
6363
6464 AccountCacheEntity account = new AccountCacheEntity ();
6565 account .authorityType (MSSTS_ACCOUNT_TYPE );
6666 account .clientInfoStr = clientInfoStr ;
6767 account .homeAccountId (policy != null ?
6868 account .clientInfo ().toAccountIdentifier () + Constants .CACHE_KEY_SEPARATOR + policy :
6969 account .clientInfo ().toAccountIdentifier ());
70- account .environment (environment );
70+ account .environment (requestAuthority .host ());
71+ account .realm (requestAuthority .tenant ());
7172
7273 if (idToken != null ) {
73- account .realm (idToken .tenantIdentifier );
7474 String localAccountId = !StringHelper .isBlank (idToken .objectIdentifier )
7575 ? idToken .objectIdentifier : idToken .subject ;
7676 account .localAccountId (localAccountId );
@@ -81,8 +81,8 @@ static AccountCacheEntity create(String clientInfoStr, String environment, IdTok
8181 return account ;
8282 }
8383
84- static AccountCacheEntity create (String clientInfoStr , String environment , IdToken idToken ){
85- return create (clientInfoStr , environment , idToken , null );
84+ static AccountCacheEntity create (String clientInfoStr , Authority requestAuthority , IdToken idToken ){
85+ return create (clientInfoStr , requestAuthority , idToken , null );
8686 }
8787
8888 IAccount toAccount (){
0 commit comments