Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mock test cases for CAE auth in mgmt client #32351

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

MaryGao
Copy link
Member

@MaryGao MaryGao commented Dec 24, 2024

fixes #31754

@MaryGao MaryGao requested a review from qiaozha as a code owner December 24, 2024 09:25
@github-actions github-actions bot added the Mgmt This issue is related to a management-plane library. label Dec 24, 2024
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@MaryGao MaryGao requested review from ckairen, jeremymeng and a team as code owners January 7, 2025 06:43
@MaryGao MaryGao requested a review from mpodwysocki January 7, 2025 06:44
describe("Mock test for CAE with ResourceManagementClient", () => {
// this is not a real token, does not contain any sensitive info, just for test.
const caeChallenge = `Bearer realm="", error_description="Continuous access evaluation resulted in challenge", error="insufficient_claims", claims="eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTcyNjI1ODEyMiJ9fX0=" `;
const invalidCAEChallenge = `Bearer realm="", error_description="", error="insufficient_claims", claims=""`;
Copy link
Member

@qiaozha qiaozha Jan 8, 2025

Choose a reason for hiding this comment

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

just curious what decides if the caeChallenge is valid or not? maybe we should add some description for it?

Copy link
Member Author

@MaryGao MaryGao Jan 9, 2025

Choose a reason for hiding this comment

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

Added a comment for that: regarding CAE challenge string you could refer the link https://learn.microsoft.com/entra/identity-platform/claims-challenge.

Our code implementation is aligned with that doc: https://github.com/azure/azure-sdk-for-js/blob/main/sdk/core/core-rest-pipeline/src/policies/bearerTokenAuthenticationPolicy.ts#L375.

@MaryGao MaryGao requested a review from qiaozha January 9, 2025 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mgmt This issue is related to a management-plane library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Mock Test To Verify CAE Support In Mgmt SDK
4 participants