Skip to content

fix(plugins): support AAD v1 (sts.windows.net) issuer in token validation#483

Open
heyitsaamir wants to merge 2 commits into
mainfrom
fix/aad-v1-issuer-validation
Open

fix(plugins): support AAD v1 (sts.windows.net) issuer in token validation#483
heyitsaamir wants to merge 2 commits into
mainfrom
fix/aad-v1-issuer-validation

Conversation

@heyitsaamir
Copy link
Copy Markdown
Collaborator

@heyitsaamir heyitsaamir commented May 6, 2026

Summary

Mirrors microsoft/teams.ts#556 for teams.net.

Extends tenant-based issuer validation in TeamsValidationSettings.GetValidIssuersForTenant to also accept the Azure AD v1 issuer format (https://sts.windows.net/{tenantId}/) in addition to the v2 issuer ({LoginEndpoint}/{tenantId}/).

Motivation

Some valid Microsoft Entra tokens are issued with the AAD v1 issuer (sts.windows.net) instead of the v2-style login.microsoftonline.com/.../v2.0 issuer. Without this change, tenant-based validation rejects otherwise-valid v1 tokens.

See: https://learn.microsoft.com/en-us/entra/identity-platform/access-tokens

Changes

  • Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/Extensions/TeamsValidationSettings.cs: GetValidIssuersForTenant now returns both the v2 (cloud-specific login endpoint) and v1 (sts.windows.net) issuers for the configured tenant.
  • Tests/Microsoft.Teams.Plugins.AspNetCore.Tests/Extensions/TeamsValidationSettingsTests.cs: updated GetValidIssuersForTenant_UsesCloudLoginEndpoint to expect both issuers and added GetValidIssuersForTenant_IncludesV1StsIssuer.

Notes on scope

Test plan

  • dotnet test Tests/Microsoft.Teams.Plugins.AspNetCore.Tests --filter "FullyQualifiedName~TeamsValidationSettings" — all 10 tests pass on net8.0 and net10.0.
  • dotnet build Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore — succeeds with 0 warnings / 0 errors.

…ation

Tenant-based issuer validation in TeamsValidationSettings now accepts
both the AAD v2 issuer (login endpoint) and the AAD v1 issuer
(https://sts.windows.net/{tenantId}/), since some valid Microsoft Entra
tokens are still issued with the v1 issuer format.

Mirrors microsoft/teams.ts#556.
@heyitsaamir heyitsaamir marked this pull request as ready for review May 6, 2026 18:28
Copilot AI review requested due to automatic review settings May 6, 2026 18:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Extends tenant-scoped issuer validation in the AspNetCore plugin so Entra token validation accepts both the cloud-specific login endpoint issuer and the AAD v1 sts.windows.net/{tenantId}/ issuer, aligning behavior with tokens that still present the v1 issuer format.

Changes:

  • Updated TeamsValidationSettings.GetValidIssuersForTenant to return both the login-endpoint issuer and https://sts.windows.net/{tenantId}/.
  • Adjusted the existing cloud-endpoint unit test to expect two issuers and added a new unit test verifying inclusion of the v1 STS issuer.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore/Extensions/TeamsValidationSettings.cs Adds AAD v1 sts.windows.net issuer to tenant-based issuer list returned for Entra token validation.
Tests/Microsoft.Teams.Plugins.AspNetCore.Tests/Extensions/TeamsValidationSettingsTests.cs Updates issuer expectations and adds coverage for v1 STS issuer inclusion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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