diff --git a/modules/saml/lib/IdP/SAML2.php b/modules/saml/lib/IdP/SAML2.php
index 3e72e1402dca9d7e255ebe9e990fbd2c251ee64e..002c69f6f61f47f1c7453a7f6c2ac9d23ae02ccb 100644
--- a/modules/saml/lib/IdP/SAML2.php
+++ b/modules/saml/lib/IdP/SAML2.php
@@ -896,9 +896,9 @@ class SAML2
         $a->setNotOnOrAfter($now + $assertionLifetime);
 
         if (isset($state['saml:AuthnContextClassRef'])) {
-            $a->setAuthnContext($state['saml:AuthnContextClassRef']);
+            $a->setAuthnContextClassRef($state['saml:AuthnContextClassRef']);
         } else {
-            $a->setAuthnContext(\SAML2\Constants::AC_PASSWORD);
+            $a->setAuthnContextClassRef(\SAML2\Constants::AC_PASSWORD);
         }
 
         $sessionStart = $now;