From da59707f3854fb533ab7ff9001bade01b2958f87 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Fri, 9 Feb 2024 14:26:13 +0100 Subject: [PATCH] Added auth client for keycloak --- src/User/AuthClient/Keycloak.php | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/User/AuthClient/Keycloak.php diff --git a/src/User/AuthClient/Keycloak.php b/src/User/AuthClient/Keycloak.php new file mode 100644 index 0000000..42a3cd7 --- /dev/null +++ b/src/User/AuthClient/Keycloak.php @@ -0,0 +1,35 @@ +getUserAttributes()['email'] ?? null; + } + + /** + * {@inheritdoc} + */ + public function getUserName() + { + // claim from profile scope + return $this->getUserAttributes()['preferred_username'] ?? $this->getEmail(); + } + + /** + * {@inheritdoc} + */ + public function getUserId() + { + return $this->getUserAttributes()['sub'] ?? null; + } +}