allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
71
vendor/kreait/firebase-tokens/src/JWT/Action/VerifySessionCookie.php
vendored
Normal file
71
vendor/kreait/firebase-tokens/src/JWT/Action/VerifySessionCookie.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Kreait\Firebase\JWT\Action;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
final class VerifySessionCookie
|
||||
{
|
||||
/**
|
||||
* @param non-empty-string $sessionCookie
|
||||
* @param int<0, max> $leewayInSeconds
|
||||
* @param non-empty-string|null $expectedTenantId
|
||||
*/
|
||||
private function __construct(
|
||||
private readonly string $sessionCookie,
|
||||
private readonly int $leewayInSeconds,
|
||||
private readonly ?string $expectedTenantId,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param non-empty-string $sessionCookie
|
||||
*/
|
||||
public static function withSessionCookie(string $sessionCookie): self
|
||||
{
|
||||
return new self($sessionCookie, 0, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param non-empty-string $tenantId
|
||||
*/
|
||||
public function withExpectedTenantId(string $tenantId): self
|
||||
{
|
||||
return new self($this->sessionCookie, $this->leewayInSeconds, $tenantId);
|
||||
}
|
||||
|
||||
public function withLeewayInSeconds(int $seconds): self
|
||||
{
|
||||
if ($seconds < 0) {
|
||||
throw new InvalidArgumentException('Leeway must not be negative');
|
||||
}
|
||||
|
||||
return new self($this->sessionCookie, $seconds, $this->expectedTenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return non-empty-string
|
||||
*/
|
||||
public function sessionCookie(): string
|
||||
{
|
||||
return $this->sessionCookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return non-empty-string|null
|
||||
*/
|
||||
public function expectedTenantId(): ?string
|
||||
{
|
||||
return $this->expectedTenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int<0, max>
|
||||
*/
|
||||
public function leewayInSeconds(): int
|
||||
{
|
||||
return $this->leewayInSeconds;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user