OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
/
vendor
/
kreait
/
firebase-tokens
/
src
/
Firebase
/
Auth
/
Token
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/12/2024 10:36:28 AM
rwxr-xr-x
📁
Cache
-
08/12/2024 10:36:42 AM
rwxr-xr-x
📄
ConvertsDates.php
538 bytes
08/12/2024 10:36:29 AM
rw-r--r--
📁
Domain
-
08/12/2024 10:36:42 AM
rwxr-xr-x
📁
Exception
-
08/12/2024 10:36:42 AM
rwxr-xr-x
📄
Generator.php
1.84 KB
08/12/2024 10:36:29 AM
rw-r--r--
📄
Handler.php
1.15 KB
08/12/2024 10:36:29 AM
rw-r--r--
📄
HttpKeyStore.php
2.68 KB
08/12/2024 10:36:29 AM
rw-r--r--
📄
TenantAwareGenerator.php
2.03 KB
08/12/2024 10:36:29 AM
rw-r--r--
📄
TenantAwareVerifier.php
1.4 KB
08/12/2024 10:36:29 AM
rw-r--r--
📄
Verifier.php
3.89 KB
08/12/2024 10:36:29 AM
rw-r--r--
Editing: TenantAwareGenerator.php
Close
<?php declare(strict_types=1); namespace Firebase\Auth\Token; use BadMethodCallException; use DateInterval; use DateTimeImmutable; use DateTimeInterface; use Firebase\Auth\Token\Domain\Generator; use Lcobucci\JWT\Configuration; use Lcobucci\JWT\Signer; use Lcobucci\JWT\Signer\Key\InMemory; use Lcobucci\JWT\Signer\Rsa\Sha256; use Lcobucci\JWT\Token; final class TenantAwareGenerator implements Generator { use ConvertsDates; private string $tenantId; private string $clientEmail; private Configuration $config; public function __construct( string $tenantId, string $clientEmail, string $privateKey, Signer $signer = null ) { $this->tenantId = $tenantId; $this->clientEmail = $clientEmail; $this->config = Configuration::forSymmetricSigner( $signer ?: new Sha256(), InMemory::plainText($privateKey) ); } /** * Returns a token for the given user and claims. * * @param mixed $uid * * @throws BadMethodCallException when a claim is invalid */ public function createCustomToken($uid, array $claims = [], DateTimeInterface $expiresAt = null): Token { $now = new DateTimeImmutable(); $expiresAt = $expiresAt ? $this->convertExpiryDate($expiresAt) : $now->add(new DateInterval('PT1H')); $builder = $this->config->builder() ->issuedBy($this->clientEmail) ->relatedTo($this->clientEmail) ->permittedFor('https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit') ->withClaim('uid', (string) $uid) ->withClaim('tenant_id', $this->tenantId) ->issuedAt($now) ->expiresAt($expiresAt) ; if (!empty($claims)) { $builder->withClaim('claims', $claims); } return $builder->getToken($this->config->signer(), $this->config->signingKey()); } }