'idp-name' => array(
...
'message' => 'key1:'.$value1.';key2:'.$value2,
...
),
...
'NameIDFormat' => 'urn:oasis:names:tc:SAML:1.1:nameid-format:persistent',
'simplesaml.nameidattribute' => 'message',
...
在你的代码中,只需要在进行身份验证之前指定$value1和$value2即可。
感谢Anthony的帮助。
``` /* 自定义 NameID */ 'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', 'authproc' => array( 3 => array( 'class' => 'saml:AttributeNameID', 'attribute' => 'uid', 'Format' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', ), ), ```你将在 SAML 响应声明中收到:
<saml:Subject> <saml:NameID SPNameQualifier="http://127.0.0.1:8080/auth/realms/external" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" >student</saml:NameID> <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"> <saml:SubjectConfirmationData NotOnOrAfter="2020-10-07T12:12:25Z" Recipient="http://127.0.0.1:8080/auth/realms/external/broker/simplesaml/endpoint" InResponseTo="ID_8c4e1542-b034-4e42-93db-cec8de2e76e4" /> </saml:SubjectConfirmation> </saml:Subject> ```
'attributes' =>
array (
0 => 'SAML_SUBJECT',
1 => 'NameID',
2 => 'ClientID',
3 => 'FirstName',
4 => 'LastName',
5 => 'Email',
),
一旦我的nameidattibute值由默认的SAML_SUBJECT更改为NameID,我就能够使用持久的nameid-format。希望这能帮助到有需要的人。
NameIDFormat
有关吗?https://simplesamlphp.org/docs/stable/simplesamlphp-reference-sp-remote - Anthony