51 parent::__construct(
$config, $reserved);
52 assert(
'is_array($config)');
56 if (!isset(
$config[
'attribute'])) {
59 $this->attribute =
$config[
'attribute'];
61 if (isset(
$config[
'allowUnspecified'])) {
62 $this->allowUnspecified = (bool)
$config[
'allowUnspecified'];
65 if (isset(
$config[
'allowDifferent'])) {
66 $this->allowDifferent = (bool)
$config[
'allowDifferent'];
69 if (isset(
$config[
'alwaysCreate'])) {
70 $this->alwaysCreate = (bool)
$config[
'alwaysCreate'];
86 if (!isset($state[
'saml:NameIDFormat']) && !$this->allowUnspecified) {
88 'SQLPersistentNameID: Request did not specify persistent NameID format, '.
89 'not generating persistent NameID.' 94 $validNameIdFormats = @array_filter(
array(
95 $state[
'saml:NameIDFormat'],
96 $state[
'SPMetadata'][
'NameIDPolicy'],
97 $state[
'SPMetadata'][
'NameIDFormat']
99 if (count($validNameIdFormats) && !in_array($this->
format, $validNameIdFormats,
true) &&
100 !$this->allowDifferent
103 'SQLPersistentNameID: SP expects different NameID format ('.
104 implode(
', ', $validNameIdFormats).
'), not generating persistent NameID.' 109 if (!isset($state[
'Destination'][
'entityid'])) {
115 if (!isset($state[
'Source'][
'entityid'])) {
121 if (!isset($state[
'Attributes'][$this->attribute]) || count($state[
'Attributes'][$this->attribute]) === 0) {
123 'SQLPersistentNameID: Missing attribute '.var_export($this->attribute,
true).
124 ' on user - not generating persistent NameID.' 128 if (count($state[
'Attributes'][$this->attribute]) > 1) {
130 'SQLPersistentNameID: More than one value in attribute '.var_export($this->attribute,
true).
131 ' on user - not generating persistent NameID.' 135 $uid = array_values($state[
'Attributes'][$this->attribute]);
140 'Empty value in attribute '.var_export($this->attribute,
true).
141 ' on user - not generating persistent NameID.' 147 if ($value !== null) {
149 'SQLPersistentNameID: Found persistent NameID '.var_export($value,
true).
' for user '.
150 var_export($uid,
true).
'.' 155 if ((!isset($state[
'saml:AllowCreate']) || !$state[
'saml:AllowCreate']) && !$this->alwaysCreate) {
157 'SQLPersistentNameID: Did not find persistent NameID for user, and not allowed to create new NameID.' 160 \
SAML2\Constants::STATUS_RESPONDER,
161 'urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy' 165 $value = bin2hex(openssl_random_pseudo_bytes(20));
167 'SQLPersistentNameID: Created persistent NameID '.var_export($value,
true).
' for user '.
168 var_export($uid,
true).
'.' static get($idpEntityId, $spEntityId, $user)
Retrieve a NameID into from database.
__construct($config, $reserved)
Initialize this filter, parse configuration.
static add($idpEntityId, $spEntityId, $user, $value)
Add a NameID into the database.
getValue(array &$state)
Get the NameID value.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Create styles array
The data for the language used.
Write to Excel2007 format
const NAMEID_PERSISTENT
Persistent NameID format.