We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
glued-lib/src/Auth.php
Line 260 in fb2fedf
if ($this->getuser($jwt_claims['sub'])) return false; // else add user $attr['locale'] = $this->utils->get_default_locale($jwt_claims['locale'] ?? 'en') ?? 'en_US'; $transform = new ArrayTransformer(); $transform ->map(destination: 'service.0.uri', source: 'iss') ->map(destination: 'service.0.handle', source: 'preferred_username') ->set(destination: 'service.0.kind', value: 'oidc') ->map(destination: 'service.0._iss', source: 'iss') ->set(destination: 'service.0._iat', value: time()) ->map(destination: 'service.0._sub', source: 'sub') ->set(destination: 'service.0.uuid', value: \Ramsey\Uuid\Uuid::uuid4()->toString()); if (array_key_exists('name', $jwt_claims) and $jwt_claims['email'] != "") { $transform ->map(destination: 'name.0.fn', source: 'name') ->map(destination: 'name.0.given', source: 'given_name') ->map(destination: 'name.0.family', source: 'family_name') ->map(destination: 'name.0._iss', source: 'iss') ->set(destination: 'name.0._iat', value: time()) ->map(destination: 'name.0._sub', source: 'sub') ->set(destination: 'name.0.uuid', value: \Ramsey\Uuid\Uuid::uuid4()->toString()); } if (array_key_exists('email', $jwt_claims) and $jwt_claims['email'] != "") { $transform ->map(destination: 'email.0.value', source: 'email') ->map(destination: 'email.0._iss', source: 'iss') ->set(destination: 'email.0._iat', value: time()) ->map(destination: 'email.0._sub', source: 'sub') ->set(destination: 'email.0._primary', value: 1); ->set(destination: 'email.0.uuid', value: \Ramsey\Uuid\Uuid::uuid4()->toString()) } if (array_key_exists('website', $jwt_claims) and $jwt_claims['website'] != "") { $transform ->map(destination: 'uri.0.value', source: 'website') ->set(destination: 'uri.0.kind', value: 'website') ->map(destination: 'uri.0._iss', source: 'iss') ->set(destination: 'uri.0._iat', value: time()) ->map(destination: 'uri.0._sub', source: 'sub') ->set(destination: 'uri.0.uuid', value: \Ramsey\Uuid\Uuid::uuid4()->toString()); } $profile = $transform->toArray($jwt_claims) ?? []; // TODO log data to shadow profile if ($jwt_claims['sub']) { $data["c_uuid"] = $this->db->func('uuid_to_bin(?, true)', [$jwt_claims['sub']]); $data["c_profile"] = json_encode($profile); $data["c_attr"] = json_encode($attr); $data["c_email"] = $jwt_claims['email'] ?? 'NULL'; $data["c_handle"] = $jwt_claims['preferred_username'] ?? 'NULL'; // catch exception here $domain_uuid = \Ramsey\Uuid\Uuid::uuid4()->toString(); $q = ' INSERT INTO `t_core_domains` (`c_uuid`, `c_primary_owner`, `c_json`, `c_ts_created`, `c_ts_modified`) SELECT uuid_to_bin(?, true), uuid_to_bin(?, true), ?, now(), now() -- no parentheses! FROM DUAL -- DUAL is a built-in table with one row WHERE NOT EXISTS ( select 1 from t_core_domains limit 1 );'; $this->db->rawQuery($q, [ $domain_uuid, $jwt_claims['sub'], json_encode( [ 'uuid' => $domain_uuid, 'name' => 'Main', 'ownership' => [ [ '_sub' => $jwt_claims['sub'], '_iat' => time(), '_primary' => 1 ] ], ]) ]); return $this->db->insert('t_core_users', $data); } return false; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
glued-lib/src/Auth.php
Line 260 in fb2fedf
The text was updated successfully, but these errors were encountered: