From b23ed35d339b6715b21f3eb2ed5d5ee1792655f7 Mon Sep 17 00:00:00 2001 From: smarcet Date: Wed, 3 Feb 2021 15:52:14 -0300 Subject: [PATCH] Added job_title to get payload Change-Id: Ic456280ef9e0e83619cd23e6e6c069a684d4d9f4 Signed-off-by: smarcet --- app/Models/SSO/Disqus/DisqusUserProfile.php | 3 ++- app/Services/OAuth2/ResourceServer/UserService.php | 3 +++ app/libs/OAuth2/StandardClaims.php | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Models/SSO/Disqus/DisqusUserProfile.php b/app/Models/SSO/Disqus/DisqusUserProfile.php index 68b8bbe7..e2a87c06 100644 --- a/app/Models/SSO/Disqus/DisqusUserProfile.php +++ b/app/Models/SSO/Disqus/DisqusUserProfile.php @@ -13,6 +13,7 @@ **/ use App\Models\SSO\DisqusSSOProfile; use Auth\User; +use Illuminate\Support\Facades\Log; /** * Class DisqusUserProfile @@ -95,7 +96,7 @@ class DisqusUserProfile "email" => $this->user_email, "avatar" => $this->user_avatar ]; - + Log::debug(sprintf("DisqusUserProfile::serialize %s", json_encode($data))); $message = base64_encode(json_encode($data)); $timestamp = time(); $hmac = $this->dsq_hmacsha1($message . ' ' . $timestamp, $this->private_key); diff --git a/app/Services/OAuth2/ResourceServer/UserService.php b/app/Services/OAuth2/ResourceServer/UserService.php index 8082e233..242c7150 100644 --- a/app/Services/OAuth2/ResourceServer/UserService.php +++ b/app/Services/OAuth2/ResourceServer/UserService.php @@ -152,6 +152,7 @@ final class UserService extends OAuth2ProtectedService implements IUserService $data[StandardClaims::WeChatUser] = $current_user->getWechatUser(); $data[StandardClaims::TwitterName] = $current_user->getTwitterName(); $data[StandardClaims::Company] = $current_user->getCompany(); + $data[StandardClaims::JobTitle] = $current_user->getJobTitle(); $data[StandardClaims::ShowPicture] = $current_user->isPublicProfileShowPhoto(); $data[StandardClaims::ShowFullName] = $current_user->isPublicProfileShowFullname(); $user_groups = []; @@ -207,6 +208,8 @@ final class UserService extends OAuth2ProtectedService implements IUserService $claim_set->addClaim(new JWTClaim(StandardClaims::LinkedInProfile, new StringOrURI($user->getLinkedInProfile()))); $claim_set->addClaim(new JWTClaim(StandardClaims::ShowPicture, new JsonValue($user->isPublicProfileShowPhoto()))); $claim_set->addClaim(new JWTClaim(StandardClaims::ShowFullName, new JsonValue($user->isPublicProfileShowFullname()))); + $claim_set->addClaim(new JWTClaim(StandardClaims::Company, new StringOrURI($user->getCompany()))); + $claim_set->addClaim(new JWTClaim(StandardClaims::JobTitle, new StringOrURI($user->getJobTitle()))); $user_groups = []; diff --git a/app/libs/OAuth2/StandardClaims.php b/app/libs/OAuth2/StandardClaims.php index 688a91af..0df0c11d 100644 --- a/app/libs/OAuth2/StandardClaims.php +++ b/app/libs/OAuth2/StandardClaims.php @@ -208,4 +208,10 @@ abstract class StandardClaims * Company */ const Company = 'company'; + + + /** + * Company + */ + const JobTitle = 'job_title'; } \ No newline at end of file