How to specify an AuthnContextClassRef in a SAML Response

BooneTom-7296 95 Reputation points
2026-01-20T12:21:52.34+00:00

We have implemented a conditional access policy in Microsoft Entra that enforces multi-factor authentication (MFA). However, after successfully authenticating using secure methods such as a Passkey through Microsoft Authenticator or a Smartcard/Certificate, the SAML response still includes the following:

<AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Unspecified</AuthnContextClassRef>

This is causing issues with applications like Salesforce, which require the AuthnContextClassRef to specify a secure authentication method (e.g., MFA, Smartcard, PKI) to validate the authentication and allow authorization. Without this, the authentication is rejected, and access is denied.

Is there a way to manually configure or specify the AuthnContextClassRef in the SAML response to accurately reflect the authentication method used, even if Microsoft Entra does not automatically recognize or report it? If so, what steps or configurations are required to achieve this?

Additional Context

  • We are using conditional access policies to enforce MFA.
  • The issue occurs regardless of whether the authentication method is a Passkey, Smartcard, or Certificate.
  • Applications like Salesforce expect a specific AuthnContextClassRef value to validate secure authentication methods.
Microsoft Security | Microsoft Entra | Microsoft Entra ID

3 answers

Sort by: Most helpful
  1. Dan McLaughlin 10 Reputation points
    2026-03-05T21:11:41.6333333+00:00

    I was able to get Entra ID to return a usable MFA indicator without any special configuration in Entra, using a hint from this Microsoft doc (not obvious from the main SAML protocol docs):

    https://learn.microsoft.com/en-us/entra/identity/authentication/how-to-mfa-expected-inbound-assertions#using-saml-20-federated-idp

    Key takeaway: if you need Entra to return http://schemas.microsoft.com/claims/multipleauthn as the AuthnContextClassRef, you must request it via RequestedAuthnContext, and it must be the first item in the list.

    In my testing, if a custom/unknown AuthnContextClassRef appears before multipleauthn, Entra rejects the AuthnRequest immediately (instead of evaluating subsequent entries). So ordering matters.

    Example AuthnRequest excerpt (works)

    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
      https://mydomain.com/myid
    </saml:Issuer>
    
    <samlp:NameIDPolicy AllowCreate="1" />
    
    <samlp:RequestedAuthnContext Comparison="exact">
      <!-- MUST BE FIRST -->
      <saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
        http://schemas.microsoft.com/claims/multipleauthn
      </saml:AuthnContextClassRef>
    
      <!-- Additional values (including custom ones) can follow -->
      <saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
        urn:pingidentity:pingone:authn:web_login_otp
      </saml:AuthnContextClassRef>
      <saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
        urn:pingidentity:pingone:authn:web_login_fido
      </saml:AuthnContextClassRef>
      <saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
        urn:pingidentity:pingone:authn:web_login_email
      </saml:AuthnContextClassRef>
    
      <saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
        urn:oasis:names:tc:SAML:2.0:ac:classes:SmartcardPKI
      </saml:AuthnContextClassRef>
    
      <saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
        https://refeds.org/profile/mfa
      </saml:AuthnContextClassRef>
    </samlp:RequestedAuthnContext>
    
    

    What Entra returns (important bits)

    With the request above, Entra returned:

    AuthnStatement/AuthnContextClassRef = http://schemas.microsoft.com/claims/multipleauthn

    and also included the authnmethodsreferences attribute showing the methods used, e.g.:

    <Attribute Name="http://schemas.microsoft.com/claims/authnmethodsreferences">
      <AttributeValue>
        http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password
      </AttributeValue>
      <AttributeValue>
        http://schemas.microsoft.com/claims/multipleauthn
      </AttributeValue>
    </Attribute>
    
    <AuthnStatement ...>
      <AuthnContext>
        <AuthnContextClassRef>
          http://schemas.microsoft.com/claims/multipleauthn
        </AuthnContextClassRef>
      </AuthnContext>
    </AuthnStatement>
    
    

    Example Shibboleth SP Apache config

    AuthType shibboleth
    ShibRequestSetting requireSession On
    ShibRequestSetting redirectToSSL 443
    ShibRequestSetting REMOTE_ADDR X-Forwarded-For
    ShibRequestSetting forceAuthn On
    ShibUseEnvironment On
    
    <RequireAll>
      ShibRequestSetting authnContextClassRef "\
        http://schemas.microsoft.com/claims/multipleauthn \
        urn:pingidentity:pingone:authn:web_login_otp \
        urn:pingidentity:pingone:authn:web_login_fido \
        urn:pingidentity:pingone:authn:web_login_email \
        urn:oasis:names:tc:SAML:2.0:ac:classes:SmartcardPKI \
        https://refeds.org/profile/mfa"
    
      ShibRequestSetting authnContextComparison exact
      Require shib-session
    
      # Explicitly deny "unspecified"
      <RequireNone>
        Require authnContextClassRef urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified
      </RequireNone>
    
      # Allow any of the above
      <RequireAny>
        Require authnContextClassRef "http://schemas.microsoft.com/claims/multipleauthn"
        Require authnContextClassRef "urn:pingidentity:pingone:authn:web_login_otp"
        Require authnContextClassRef "urn:pingidentity:pingone:authn:web_login_fido"
        Require authnContextClassRef "urn:pingidentity:pingone:authn:web_login_email"
        Require authnContextClassRef "urn:oasis:names:tc:SAML:2.0:ac:classes:SmartcardPKI"
        Require authnContextClassRef "https://refeds.org/profile/mfa"
      </RequireAny>
    </RequireAll>
    
    

    Bottom line: If your SP/app needs Entra to emit a strong auth signal, requesting http://schemas.microsoft.com/claims/multipleauthn (and putting it first) can cause Entra to return it directly in AuthnContextClassRef, plus the authnmethodsreferences attribute values. This worked for me with Shibboleth SP without making any changes in Entra itself.

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments

  2. Rahul Shah 5 Reputation points
    2026-07-21T18:02:00.3366667+00:00

    We are running into issues with SAML SSO integration with Salesforce. We have the amr attribute claim added as shown in the image below. Additionally, we have Conditional Access Policy setup to enforce MFA when users SSO to Salesforce. But, even with all this configurations, users are enforced to setup Salesforce MFA. Is there anything we are missing? As per Salesforce support, they are only receiving password in SAML response. What additional configuration is needed so users do not have to setup Salesforce MFA and they receive both password and/or MFA? Please advise.

    SF

    Was this answer helpful?

    0 comments No comments

  3. AI answer

    2026-01-20T12:22:07.7033333+00:00

    To specify an AuthnContextClassRef in a SAML response when using Microsoft Entra, you need to ensure that your SAML requests include the appropriate AuthnContext settings. Here are some steps and configurations you can consider:

    1. Include AuthnContext Class References: When you configure your SAML authorization request, you can include the AuthnContext element with specific class references that reflect the authentication methods you want to support. For example, you can specify MFA or Smartcard authentication methods in the request. Example:
         <samlp:AuthnRequest AssertionConsumerServiceURL="https://..."
                             IncludeAuthnContextClassReferences="urn:oasis:names:tc:SAML:2.0:ac:classes:Password,urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport">
             ...
         </samlp:AuthnRequest>
      
    2. Force Authentication: If necessary, you can force a fresh authentication by including the ForceAuthN="true" attribute in your SAML request. This ensures that the user is re-authenticated and that the correct AuthnContext is used in the response. Example:
         <samlp:AuthnRequest AssertionConsumerServiceURL="https://..."
                             ForceAuthN="true">
             ...
         </samlp:AuthnRequest>
      
    3. Check Application Configuration: Ensure that the applications you are integrating with (like Salesforce) are configured to accept the specific AuthnContextClassRef values you are sending. This might involve adjusting settings in those applications to recognize the authentication methods being used.
    4. Review Conditional Access Policies: Make sure that your conditional access policies in Microsoft Entra are set up correctly to enforce the desired authentication methods and that they align with the expectations of the applications accessing them.
    5. Testing and Validation: After making these changes, test the SAML response to ensure that the AuthnContextClassRef reflects the authentication method used. You may need to work with your identity provider to verify that the correct values are being sent in the SAML assertions.

    If Microsoft Entra does not automatically recognize or report the authentication methods correctly, you may need to consult the documentation or support for further assistance on how to configure these settings effectively.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.