Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Adding CAE to sample #194

Merged
merged 3 commits into from
Aug 18, 2022
Merged

Adding CAE to sample #194

merged 3 commits into from
Aug 18, 2022

Conversation

salman90
Copy link
Contributor

Purpose

  • Adding CAE to sample

Does this introduce a breaking change?

[ x ] Yes
[ ] No

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[ x ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git https://github.com/Azure-Samples/ms-identity-javascript-angular-tutorial.git
cd 2-Authorization-I/1-call-graph/SPA
git checkout  supporting-CAE
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

});
getProfile() {

this.http.get(protectedResources.graphMe.endpoint).subscribe(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's move the http client into the service file (graph.service). the component shouldn't do http calls by itself


addClaimsToStorage(
claimsChallenge,
`cc.${msalConfig.auth.clientId}.${account?.idTokenClaims?.oid}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the key schema also contain something to identify which resource this claims challenge is for?

Copy link
Contributor

@derisen derisen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me -couple of comments to address, but it's working fine. thanks @salman90

@kalyankrishna1
Copy link
Contributor

PS prints the following, please remove

  • Navigate to the Manifest page, find the 'replyUrlsWithType' section and change the type of redirect URI to 'Spa'

@kalyankrishna1
Copy link
Contributor

kalyankrishna1 commented Aug 17, 2022

@derisen , please add a section about cliant capabilities and code handling CAE (as explained in https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/master/2-WebApp-graph-user/2-1-Call-MSGraph/README.md#optional---handle-continuous-access-evaluation-cae-challenge-from-microsoft-graph) in the following tow readme and the code generator

  1. This sample's readme
  2. "D:\github\Azure-Samples\ms-identity-javascript-react-tutorial\2-Authorization-I\1-call-graph\README.md"

In the codegen, please append a task to generate a stub about CAE whenever the "service" in sample.json is MS Graph.

Thanks

@kalyankrishna1
Copy link
Contributor

pressing the login button throws the following error

getPrototypeOf.js:5980 ERROR ServerError: invalid_request: 9002326 - [2022-08-17 11:05:16Z]: AADSTS9002326: Cross-origin token redemption is permitted only for the 'Single-Page Application' client-type. Request origin: 'http://localhost:4200'.
Trace ID: 6d13a6b6-3d2d-44cd-8645-cce70ad55501
Correlation ID: d3d17b46-8c16-4541-87b6-39b23dc9842e
Timestamp: 2022-08-17 11:05:16Z - Correlation ID: d3d17b46-8c16-4541-87b6-39b23dc9842e - Trace ID: 6d13a6b6-3d2d-44cd-8645-cce70ad55501
at ServerError.AuthError [as constructor] (AuthError.ts:40:9)
at new ServerError (ServerError.ts:14:9)
at ResponseHandler.validateTokenResponse (virtual-scroll-strategy.ts:99:19)
at AuthorizationCodeClient. (AuthorizationCodeClient.ts:82:25)
at step (vendor.js:131492:19)
at Object.next (vendor.js:131422:14)
at fulfilled (vendor.js:131376:24)
at ZoneDelegate.invoke (zone.js:386:30)
at Object.onInvoke (getPrototypeOf.js:28301:33)
at ZoneDelegate.invoke (zone.js:385:36)

@derisen
Copy link
Contributor

derisen commented Aug 17, 2022

pressing the login button throws the following error

getPrototypeOf.js:5980 ERROR ServerError: invalid_request: 9002326 - [2022-08-17 11:05:16Z]: AADSTS9002326: Cross-origin token redemption is permitted only for the 'Single-Page Application' client-type. Request origin: 'http://localhost:4200'. Trace ID: 6d13a6b6-3d2d-44cd-8645-cce70ad55501 Correlation ID: d3d17b46-8c16-4541-87b6-39b23dc9842e Timestamp: 2022-08-17 11:05:16Z - Correlation ID: d3d17b46-8c16-4541-87b6-39b23dc9842e - Trace ID: 6d13a6b6-3d2d-44cd-8645-cce70ad55501 at ServerError.AuthError [as constructor] (AuthError.ts:40:9) at new ServerError (ServerError.ts:14:9) at ResponseHandler.validateTokenResponse (virtual-scroll-strategy.ts:99:19) at AuthorizationCodeClient. (AuthorizationCodeClient.ts:82:25) at step (vendor.js:131492:19) at Object.next (vendor.js:131422:14) at fulfilled (vendor.js:131376:24) at ZoneDelegate.invoke (zone.js:386:30) at Object.onInvoke (getPrototypeOf.js:28301:33) at ZoneDelegate.invoke (zone.js:385:36)

This is because the redirect Uri is not of type SPA. The scripts are using Azure AD module, which can't register a SPA, so it needs to be manually changed for now.

Copy link
Contributor

@kalyankrishna1 kalyankrishna1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@salman90 salman90 merged commit bf1bfb8 into main Aug 18, 2022
@derisen derisen deleted the supporting-CAE branch September 22, 2022 02:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants