Skip to content

FIX Use Microsoft Graph for GUI authentication and group authorization - #2281

Open
behnam-o wants to merge 10 commits into
microsoft:mainfrom
behnam-o:copyrit-auth
Open

FIX Use Microsoft Graph for GUI authentication and group authorization#2281
behnam-o wants to merge 10 commits into
microsoft:mainfrom
behnam-o:copyrit-auth

Conversation

@behnam-o

@behnam-o behnam-o commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

The GUI previously requested a custom API token that the backend could validate locally, but that token could not be used to query Microsoft Graph for group membership.

This change:

  • Requests a delegated Microsoft Graph token with User.Read
  • Authenticates users through Graph /me
  • Resolves authorization groups through /me/getMemberObjects
  • Requires configured allowed groups when authentication is enabled
  • Adds a short-lived, bounded cache to reduce Graph traffic
  • Updates deployment configuration, documentation, and tests

Graph tokens are treated as opaque by the backend. Authentication and group authorization failures are handled through a typed internal exception and converted to HTTP responses at the middleware boundary.

  • it also fixes the auth flow on the frontend and prevents duplicate MSAL initialization and redirect handling

@behnam-o
behnam-o marked this pull request as draft July 28, 2026 15:58
@behnam-o
behnam-o marked this pull request as ready for review July 28, 2026 17:41
@hannahwestra25 hannahwestra25 self-assigned this Jul 29, 2026
Comment thread infra/main.bicep Outdated
Comment thread infra/DEPLOY_NEW_INSTANCE.md Outdated
Comment thread infra/README.md Outdated
Comment thread infra/deploy_instance.py Outdated
Automates the full deployment of an isolated CoPyRIT GUI instance:
1. Resource group
2. Entra app registration + API scope + group claims
2. Entra app registration + delegated Microsoft Graph permission

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove extra space

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isn't this still indented weirdly ? or am i miss reading it

Comment thread infra/README.md Outdated
Comment thread frontend/src/auth/AuthProvider.test.tsx Outdated
Comment thread frontend/src/auth/AuthProvider.test.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants