title: Ruby Rails Devise and SAML with Office 365
body: <p>I have setup a new Rails application using devise and devise_saml_authenticatable to authenticate against Office 365.</p>
  <p>The login unfortunately shows following error message:</p>
  <pre><code>Sign in
  
  Sorry, but we’re having trouble signing you in.
  
  AADSTS7500522: XML element 'AuthnContextClassRef' in XML namespace 'urn:oasis:names:tc:SAML:2.0:assertion' in the SAML message must be a URI.
  </code></pre>
  <p>My config/decise.rb file looks as follows:</p>
  <pre><code>  config.saml_create_user = true
    config.saml_update_user = true
    config.saml_default_user_key = :email
    config.saml_session_index_key = :session_index
    config.saml_use_subject = true
    config.idp_settings_adapter = nil
    config.saml_configure do |settings|
      settings.assertion_consumer_service_url     = &quot;https://localhost:3000/users/saml/auth&quot;
      settings.assertion_consumer_service_binding = &quot;urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST&quot;
      settings.name_identifier_format             = &quot;urn:oasis:names:tc:SAML:2.0:nameid-format:transient&quot;
      settings.issuer                             = &quot;https://localhost:3000/saml/metadata&quot;
      settings.authn_context                      = &quot;&quot;
      settings.idp_slo_target_url                 = &quot;https://login.microsoftonline.com/common/wsfederation?wa=wsignout1.0&quot;          
      settings.idp_sso_target_url                 = &quot;https://login.microsoftonline.com/xxx/saml2&quot;         
      settings.idp_cert_fingerprint               = &quot;E4:.....&quot;
      settings.idp_cert_fingerprint_algorithm     = &quot;http://www.w3.org/2000/09/xmldsig#sha1&quot;
    end
  </code></pre>
  <p>and the &quot;Reply URL (Assertion Consumer Service URL)&quot; in the Azure configuration is set to</p>
  <pre><code>https://localhost:3000/users/saml/auth
  </code></pre>
  <p>Any ideas how to fix this?</p>