Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120826183
IdentityEntity.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
IdentityEntity.php
View Options
<?php
namespace
App\Auth
;
use
App\User
;
use
League\OAuth2\Server\Entities\Traits\EntityTrait
;
use
OpenIDConnect\Claims\Traits\WithClaims
;
use
OpenIDConnect\Interfaces\IdentityEntityInterface
;
class
IdentityEntity
implements
IdentityEntityInterface
{
use
EntityTrait
;
use
WithClaims
;
/**
* The user to collect the additional information for
*/
protected
User
$user
;
/**
* The identity repository creates this entity and provides the user id
* @param mixed $identifier
*/
public
function
setIdentifier
(
$identifier
):
void
{
$this
->
identifier
=
$identifier
;
$this
->
user
=
User
::
findOrFail
(
$identifier
);
}
/**
* When building the id_token, this entity's claims are collected
*
* @param string[] $scopes Optional scope filter
*/
public
function
getClaims
(
array
$scopes
=
[]):
array
{
$claims
=
[];
if
(
in_array
(
'email'
,
$scopes
))
{
$claims
[
'email'
]
=
$this
->
user
->
email
;
}
// Short living password for IMAP/SMTP
// We use same TTL as for the OAuth tokens, so clients can get a new password on token refresh
if
(
in_array
(
'auth.token'
,
$scopes
))
{
$ttl
=
config
(
'auth.token_expiry_minutes'
)
*
60
;
$claims
[
'auth.token'
]
=
Utils
::
tokenCreate
((
string
)
$this
->
user
->
id
,
$ttl
);
}
return
$claims
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 10:51 AM (6 d, 4 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18829389
Default Alt Text
IdentityEntity.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline