Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Spring Cloud Azure] Validate tfp/acr claim against configured user-flows in AadB2cResourceServerAutoConfiguration

Aperta
#51,008 0 commenti 1 reazione 3 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@domainname ci sta già lavorando.

Dal 29/10/2026.

  • #51030 di @moarychan — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
azure, java, spring-boot

Direzione di ricerca

Read AadB2cResourceServerAutoConfiguration.java and AadJwtClaimNames.java, then inspect the existing tests in AadB2cResourceServerAutoConfigurationTests.java. Trace how jwtDecoder builds its validators and how configured user flows are represented. Add coverage for matching tfp, the acr fallback, case-insensitive matching, and rejection of unconfigured flows; done when those cases pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

azure-spring azure-spring-aad-b2c Client
Library name and version

com.azure.spring:spring-cloud-azure-autoconfigure 7.4.0

Describe the bug

In AadB2cTrustedIssuerRepository (AadB2cTrustedIssuerRepository.java (lines 43–60)), addB2cUserFlowIssuers() registers policy-specific issuer URIs (<baseUri>/tfp/<tenantId>/<userFlow>/v2.0/) for each configured entry in spring.cloud.azure.active-directory.b2c.user-flows, while addB2cIssuer() also registers the tenant-level issuer URI (<baseUri>/<tenantId>/v2.0/).

When Azure AD B2C tokens use the <baseUri>/<tenantId>/v2.0/ issuer format, the user flow name is carried in the tfp (or acr) claim rather than in the iss path. However, AadB2cResourceServerAutoConfiguration.jwtDecoder (AadB2cResourceServerAutoConfiguration.java (lines 93–118)) only configures validators for aud, tid, iss, and timestamps, and does not check the tfp / acr claim against the configured user-flows when user-flows is populated.

Expected behavior

When spring.cloud.azure.active-directory.b2c.user-flows is configured, AadB2cResourceServerAutoConfiguration.jwtDecoder should validate that the token's tfp (or fallback acr) claim matches one of the configured user flow names in properties.getUserFlows().values(), consistent with how addB2cUserFlowIssuers() scopes /tfp/ issuer URLs to the configured user-flows.

Actual behavior

Tokens using the <baseUri>/<tenantId>/v2.0/ issuer format are only checked against AadJwtIssuerValidator, tid, aud, and timestamps, without checking tfp or acr against properties.getUserFlows().values().

Proposed Improvement
  1. Add TFP ("tfp") and ACR ("acr") constants to AadJwtClaimNames.java.
  2. In AadB2cResourceServerAutoConfiguration.jwtDecoder, when properties.getUserFlows() is non-empty, add a validator checking that tfp (or acr when tfp is absent) matches a configured user flow name (case-insensitively).
  3. Add unit test coverage in AadB2cResourceServerAutoConfigurationTests.java.
Lingua principale
Java
Stelle
2.6k
Fork
2.2k
Merge medio
2g 3h
PR unite (30g)
230

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/azure-sdk-for-java

Tutte le issue di Azure/azure-sdk-for-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.