Skip to content

Commit

Permalink
ShibIdentity improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
woodseowl committed Dec 5, 2024
1 parent 52b7b48 commit 65bd7af
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/CUAuth/DataObjects/ShibIdentity.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
public readonly string $idp,
public readonly string $uid,
public readonly string $displayName = '',
public readonly string $mail = '',
public readonly string $email = '',
public readonly array $serverVars = [],
) {}

Expand All @@ -46,14 +46,18 @@ public static function fromServerVars(?array $serverVars = null): self
displayName: $serverVars['displayName']
?? $serverVars['cn']
?? trim(($serverVars['givenName'] ?? '').' '.($serverVars['sn'] ?? '')),
mail: $serverVars['eduPersonPrincipalName']
email: $serverVars['eduPersonPrincipalName']
?? $serverVars['mail'] ?? '',
serverVars: $serverVars,
);
}

public static function getRemoteUser(Request $request): ?string
public static function getRemoteUser(?Request $request = null): ?string
{
if (empty($request)) {
$request = app('request');
}

// If this is a local development environment, allow the local override.
$remote_user_override = self::getRemoteUserOverride();

Expand Down Expand Up @@ -93,7 +97,7 @@ public function uniqueUid(): string
*/
public function email(): string
{
return $this->mail;
return $this->email;
}

/**
Expand Down

0 comments on commit 65bd7af

Please sign in to comment.