-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
10 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,9 @@ public function __construct( | |
public readonly array $serverVars = [], | ||
) {} | ||
|
||
/** | ||
* Shibboleth server variables will be retrieved from the request if not provided. | ||
*/ | ||
public static function fromServerVars(?array $serverVars = null): self | ||
{ | ||
if (empty($serverVars)) { | ||
|
@@ -59,12 +62,18 @@ public function isWeillIdP(): bool | |
return str_contains($this->idp, 'med.cornell.edu'); | ||
} | ||
|
||
/** | ||
* Returns the primary email ([email protected]) if available, otherwise the alias email. | ||
*/ | ||
public function email(): string | ||
{ | ||
// eduPersonPrincipal name is [email protected], mail is alias email | ||
return $this->serverVars['eduPersonPrincipalName'] ?? $this->mail; | ||
} | ||
|
||
/** | ||
* Returns the display name if available, otherwise the common name. | ||
*/ | ||
public function name(): string | ||
{ | ||
return $this->serverVars['displayName'] ?? $this->serverVars['cn'] ?? ''; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters