Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f3b6117
Port changes from msal-core
tnorling Jun 5, 2020
7ae8baf
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
tnorling Jun 18, 2020
6025e84
Add support for preferred_cache and preferred_network
tnorling Jun 18, 2020
7872ca2
Update references to old temp constant
tnorling Jun 18, 2020
dcaff8e
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
tnorling Jun 18, 2020
a71e396
Cleanup getInstanceMetadata
tnorling Jun 18, 2020
b9d4e62
Cleanup
tnorling Jun 18, 2020
9d10e65
Update node and browser
tnorling Jun 18, 2020
2600876
Adding code for instance_aware authentication in msal-browser
pkanher617 Jun 19, 2020
5307fa8
Adding graph hostname and graph host to the auth result
pkanher617 Jun 19, 2020
710075d
Adding AuthCodePayload object
pkanher617 Jun 19, 2020
d96595f
Rename AuthCodeResponse file
pkanher617 Jun 19, 2020
b2c6aa7
Update PublicClientApplication.ts
pkanher617 Jun 19, 2020
53de8da
adding instance aware sample
pkanher617 Jun 19, 2020
171d4d0
Remove policy from createAccount
tnorling Jun 19, 2020
570b361
Update environment for adfs
tnorling Jun 19, 2020
55f7be5
All common tests passing
tnorling Jun 19, 2020
4aead0a
Browser tests passing
tnorling Jun 19, 2020
4f15a91
Add tests
tnorling Jun 19, 2020
4662361
Merge branch 'instance-aware-2.0' of https://github.com/AzureAD/micro…
tnorling Jun 19, 2020
0dddb02
Add error
tnorling Jun 19, 2020
ed17743
Update untrustedAuthority error message
tnorling Jun 19, 2020
27b0530
Address feedback
tnorling Jun 20, 2020
f939af1
Address feedback
tnorling Jun 20, 2020
045acbe
Revert VScode settings
tnorling Jun 20, 2020
da430bd
Revert VScode settings
tnorling Jun 20, 2020
663e604
Add performance doc
tnorling Jun 22, 2020
4d35732
Add performance doc
tnorling Jun 22, 2020
811121a
Revert "Add performance doc"
tnorling Jun 22, 2020
d4686bd
Revert "Add performance doc"
tnorling Jun 22, 2020
5552d53
Revert "Revert VScode settings"
tnorling Jun 22, 2020
d678d50
Revert "Revert VScode settings"
tnorling Jun 22, 2020
30a8394
Revert "Address feedback"
tnorling Jun 22, 2020
c5a88a9
Revert "Address feedback"
tnorling Jun 22, 2020
842a292
Revert "Update untrustedAuthority error message"
tnorling Jun 22, 2020
d89d5c6
Revert "Add error"
tnorling Jun 22, 2020
c326777
Revert "Merge branch 'instance-aware-2.0' of https://github.com/Azure…
tnorling Jun 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding graph hostname and graph host to the auth result
  • Loading branch information
pkanher617 committed Jun 19, 2020
commit 5307fa80da287c566dc1ce3e848df9b73b6fadeb
8 changes: 4 additions & 4 deletions lib/msal-common/src/client/AuthorizationCodeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { UrlString } from "../url/UrlString";
import { ServerAuthorizationCodeResponse } from "../server/ServerAuthorizationCodeResponse";
import { AccountEntity } from "../cache/entities/AccountEntity";
import { EndSessionRequest } from "../request/EndSessionRequest";
import { AuthorizationCodeResponse } from "../response/AuthorizationCodeResponse";
import { AuthorizationCodePayload } from "../response/AuthorizationCodeResponse";

/**
* Oauth2.0 Authorization Code client
Expand Down Expand Up @@ -52,7 +52,7 @@ export class AuthorizationCodeClient extends BaseClient {
* authorization_code_grant
* @param request
*/
async acquireToken(request: AuthorizationCodeRequest, cachedNonce?: string, cachedState?: string): Promise<AuthenticationResult> {
async acquireToken(request: AuthorizationCodeRequest, authCodePayload?: AuthorizationCodePayload): Promise<AuthenticationResult> {
this.logger.info("in acquireToken call");
// If no code response is given, we cannot acquire a token.
if (!request || StringUtils.isEmpty(request.code)) {
Expand All @@ -70,7 +70,7 @@ export class AuthorizationCodeClient extends BaseClient {

// Validate response. This function throws a server error if an error is returned by the server.
responseHandler.validateTokenResponse(response.body);
const tokenResponse = responseHandler.generateAuthenticationResult(response.body, this.authority, cachedNonce, cachedState);
const tokenResponse = responseHandler.generateAuthenticationResult(response.body, this.authority, authCodePayload);

return tokenResponse;
}
Expand All @@ -80,7 +80,7 @@ export class AuthorizationCodeClient extends BaseClient {
* the client to exchange for a token in acquireToken.
* @param hashFragment
*/
handleFragmentResponse(hashFragment: string, cachedState: string): AuthorizationCodeResponse {
handleFragmentResponse(hashFragment: string, cachedState: string): AuthorizationCodePayload {
// Handle responses.
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger);

Expand Down
2 changes: 1 addition & 1 deletion lib/msal-common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export { SilentFlowRequest } from "./request/SilentFlowRequest";
export { DeviceCodeRequest } from "./request/DeviceCodeRequest";
export { EndSessionRequest } from "./request/EndSessionRequest";
export { AuthenticationResult } from "./response/AuthenticationResult";
export { AuthorizationCodeResponse } from "./response/AuthorizationCodeResponse";
export { AuthorizationCodePayload as AuthorizationCodeResponse } from "./response/AuthorizationCodeResponse";
// Logger Callback
export { ILoggerCallback, LogLevel, Logger } from "./logger/Logger";
// Errors
Expand Down
2 changes: 2 additions & 0 deletions lib/msal-common/src/response/AuthenticationResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ export type AuthenticationResult = {
extExpiresOn?: Date;
state?: string;
familyId?: string;
cloudGraphHostName?: string;
msGraphHost?: string;
};
4 changes: 3 additions & 1 deletion lib/msal-common/src/response/AuthorizationCodeResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
/**
* Response returned after processing the code response query string or fragment.
*/
export type AuthorizationCodeResponse = {
export type AuthorizationCodePayload = {
code: string,
cloud_instance_name?: string;
cloud_instance_host_name?: string;
cloud_graph_host_name?: string;
msgraph_host?: string;
state?: string;
nonce?: string
};
10 changes: 8 additions & 2 deletions lib/msal-common/src/response/ResponseHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { CacheRecord } from "../cache/entities/CacheRecord";
import { EnvironmentAliases, PreferredCacheEnvironment } from "../utils/Constants";
import { CacheManager } from "../cache/CacheManager";
import { ProtocolUtils, LibraryStateObject, RequestStateObject } from "../utils/ProtocolUtils";
import { AuthorizationCodePayload } from "./AuthorizationCodeResponse";

/**
* Class that handles response parsing.
Expand Down Expand Up @@ -98,7 +99,10 @@ export class ResponseHandler {
* @param serverTokenResponse
* @param authority
*/
generateAuthenticationResult(serverTokenResponse: ServerAuthorizationTokenResponse, authority: Authority, cachedNonce?: string, cachedState?: string): AuthenticationResult {
generateAuthenticationResult(serverTokenResponse: ServerAuthorizationTokenResponse, authority: Authority, authCodePayload?: AuthorizationCodePayload): AuthenticationResult {
const cachedNonce = authCodePayload ? authCodePayload.nonce : "";
const cachedState = authCodePayload ? authCodePayload.state : "";

// create an idToken object (not entity)
const idTokenObj = new IdToken(serverTokenResponse.id_token, this.cryptoObj);

Expand Down Expand Up @@ -132,7 +136,9 @@ export class ResponseHandler {
expiresOn: new Date(cacheRecord.accessToken.expiresOn),
extExpiresOn: new Date(cacheRecord.accessToken.extendedExpiresOn),
familyId: serverTokenResponse.foci || null,
state: requestStateObj ? requestStateObj.userRequestState : ""
state: requestStateObj ? requestStateObj.userRequestState : "",
cloudGraphHostName: authCodePayload.cloud_graph_host_name,
msGraphHost: authCodePayload.msgraph_host
};

return authenticationResult;
Expand Down