Skip to content

Commit 44b782c

Browse files
committed
Make NameID optional
1 parent e857c77 commit 44b782c

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

onelogin-saml-sso/php/functions.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ function saml_acs() {
167167
$attrs = $auth->getAttributes();
168168

169169
if (empty($attrs)) {
170-
$username = $auth->getNameId();
170+
$nameid = $auth->getNameId();
171+
if (empty($nameid)) {
172+
echo __("The SAMLResponse may contain NameID or AttributeStatement");
173+
exit();
174+
}
175+
$username = $nameid;
171176
$email = $username;
172177
} else {
173178
$usernameMapping = get_option('onelogin_saml_attr_mapping_username');

onelogin-saml-sso/php/settings.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
'wantMessagesSigned' => $opt['wantMessagesSigned'] == 'on'? true: false,
9898
'wantAssertionsSigned' => $opt['wantAssertionsSigned'] == 'on'? true: false,
9999
'wantAssertionsEncrypted' => $opt['wantAssertionsEncrypted'] == 'on'? true: false,
100+
'wantNameId' => false,
100101
'requestedAuthnContext' => $opt['requestedAuthnContext'],
101102
'relaxDestinationValidation' => true,
102103
'lowercaseUrlencoding' => get_option('

0 commit comments

Comments
 (0)