Skip to content

Commit f494eb1

Browse files
committed
feat: add method IResourceServerContext::getCurrentUserEmail
Change-Id: I32d4437b340b2987f47508168d093d984601e248
1 parent ab5602d commit f494eb1

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

app/Services/OAuth2/ResourceServerContext.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function getCurrentAccessToken()
4343
/**
4444
* @return string
4545
*/
46-
public function getApplicationType()
46+
public function getApplicationType():string
4747
{
4848
return $this->getAuthContextVar('application_type');
4949
}
@@ -85,4 +85,9 @@ public function setAuthorizationContext(array $auth_context)
8585
$this->auth_context = $auth_context;
8686
return $this;
8787
}
88+
89+
public function getCurrentUserEmail(): ?string
90+
{
91+
return $this->getAuthContextVar(IResourceServerContext::UserEmail);
92+
}
8893
}

app/libs/OAuth2/IResourceServerContext.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
*/
77
interface IResourceServerContext {
88

9+
const UserId = 'user_id';
10+
const UserFirstName = 'user_first_name';
11+
const UserLastName = 'user_last_name';
12+
const UserEmail = 'user_email';
13+
const UserEmailVerified = 'user_email_verified';
14+
15+
const ApplicationType_Service = 'SERVICE';
16+
917
/**
1018
* returns given scopes for current request
1119
* @return array
@@ -45,5 +53,11 @@ public function setAuthorizationContext(array $auth_context);
4553
/**
4654
* @return string
4755
*/
48-
public function getApplicationType();
56+
public function getApplicationType():string;
57+
58+
59+
/**
60+
* @return string|null
61+
*/
62+
public function getCurrentUserEmail():?string;
4963
}

0 commit comments

Comments
 (0)