OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
/
vendor
/
lcobucci
/
jwt
/
test
/
unit
/
Validation
/
Constraint
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/12/2024 10:36:32 AM
rwxr-xr-x
📄
ConstraintTestCase.php
685 bytes
08/12/2024 10:36:32 AM
rw-r--r--
📄
IdentifiedByTest.php
1.97 KB
08/12/2024 10:36:32 AM
rw-r--r--
📄
IssuedByTest.php
2.63 KB
08/12/2024 10:36:32 AM
rw-r--r--
📄
PermittedForTest.php
2.65 KB
08/12/2024 10:36:32 AM
rw-r--r--
📄
RelatedToTest.php
2.01 KB
08/12/2024 10:36:32 AM
rw-r--r--
📄
SignedWithTest.php
3.89 KB
08/12/2024 10:36:32 AM
rw-r--r--
📄
ValidAtTest.php
6.74 KB
08/12/2024 10:36:32 AM
rw-r--r--
Editing: PermittedForTest.php
Close
<?php declare(strict_types=1); namespace Lcobucci\JWT\Validation\Constraint; use Lcobucci\JWT\Token\RegisteredClaims; use Lcobucci\JWT\Validation\ConstraintViolation; /** @coversDefaultClass \Lcobucci\JWT\Validation\Constraint\PermittedFor */ final class PermittedForTest extends ConstraintTestCase { /** * @test * * @covers ::__construct * @covers ::assert * * @uses \Lcobucci\JWT\Token\DataSet * @uses \Lcobucci\JWT\Token\Plain * @uses \Lcobucci\JWT\Token\Signature */ public function assertShouldRaiseExceptionWhenAudienceIsNotSet(): void { $this->expectException(ConstraintViolation::class); $this->expectExceptionMessage('The token is not allowed to be used by this audience'); $constraint = new PermittedFor('test.com'); $constraint->assert($this->buildToken()); } /** * @test * * @covers ::__construct * @covers ::assert * * @uses \Lcobucci\JWT\Token\DataSet * @uses \Lcobucci\JWT\Token\Plain * @uses \Lcobucci\JWT\Token\Signature */ public function assertShouldRaiseExceptionWhenAudienceValueDoesNotMatch(): void { $this->expectException(ConstraintViolation::class); $this->expectExceptionMessage('The token is not allowed to be used by this audience'); $constraint = new PermittedFor('test.com'); $constraint->assert($this->buildToken([RegisteredClaims::AUDIENCE => ['aa.com']])); } /** * @test * * @covers ::__construct * @covers ::assert * * @uses \Lcobucci\JWT\Token\DataSet * @uses \Lcobucci\JWT\Token\Plain * @uses \Lcobucci\JWT\Token\Signature */ public function assertShouldRaiseExceptionWhenAudienceTypeDoesNotMatch(): void { $this->expectException(ConstraintViolation::class); $this->expectExceptionMessage('The token is not allowed to be used by this audience'); $constraint = new PermittedFor('123'); $constraint->assert($this->buildToken([RegisteredClaims::AUDIENCE => [123]])); } /** * @test * * @covers ::__construct * @covers ::assert * * @uses \Lcobucci\JWT\Token\DataSet * @uses \Lcobucci\JWT\Token\Plain * @uses \Lcobucci\JWT\Token\Signature */ public function assertShouldNotRaiseExceptionWhenAudienceMatches(): void { $token = $this->buildToken([RegisteredClaims::AUDIENCE => ['aa.com', 'test.com']]); $constraint = new PermittedFor('test.com'); $constraint->assert($token); $this->addToAssertionCount(1); } }