Skip to content

Add ProviderMetadata::discover_with_options and "common" Entra example - #183

Open
phy1729 wants to merge 2 commits into
ramosbugs:mainfrom
phy1729:entra
Open

phy1729 wants to merge 2 commits into
ramosbugs:mainfrom
phy1729:entra

Conversation

@phy1729

@phy1729 phy1729 commented Sep 15, 2024

Copy link
Copy Markdown

#179 handles the case for an Entra application that allows signins from a single tenant. For Entra applications that allow signins from personal and enterprise accounts, the https://login.microsoftonline.com/common/v2.0 issuer is used which returns a metadata document with issuer set to https://login.microsoftonline.com/{tenantid}/v2.0.

This PR adds ProviderMetadata::discover_with_options and ProviderMetadata::discover_async_with_options to disable the issuer validation required by the OIDC spec. I think this is more discoverable than the proposed route in #122 of wrapping http_client to munge the response.

In the example require_issuer_match is disabled on the IdTokenVerifier because the ID token has the iss claim set with the specific tenant ID of the account which is not a static value.

@maxammann

maxammann commented Apr 25, 2025 •

Copy link
Copy Markdown

thank you! @ramosbugs this seems required for typical SSO setups with MS

@maxammann

Copy link
Copy Markdown

A workaround is to do:

        let client = CoreClient::new(
            ClientId::new(client_id.to_string()),
            issuer_url,
            JsonWebKeySet::fetch_async(
                &JsonWebKeySetUrl::new("https://login.microsoftonline.com/common/discovery/v2.0/keys".to_string())?,
                &http_client,
            )
            .await?,
        )
        .set_auth_uri(oauth2::AuthUrl::new(
            "https://login.microsoftonline.com/common/oauth2/v2.0/authorize".to_string(),
        )?)
        .set_token_uri(oauth2::TokenUrl::new(
            "https://login.microsoftonline.com/common/oauth2/v2.0/token".to_string(),
        )?)

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