|
| __construct (SecretKeyRotation $key_rotation, ?Algorithm $algorithm=null, ?Compression $compression=null, ?Transport $transport=null) |
|
| getSignedStreamToken (FileStream $stream, string $filename, Disposition $disposition, int $user_id, ?\DateTimeImmutable $until=null) |
|
| verifyStreamToken (string $token) |
|
| sign (array $data, string $salt, ?\DateTimeImmutable $until=null) |
|
| verify (string $token, string $salt) |
|
◆ __construct()
Definition at line 50 of file DataSigner.php.
55 {
56 $this->salt_factory =
new Factory();
57 $compression ??= new DeflateCompression();
58 $transport ??= new URLSafeTransport();
59 $algorithm ??= new ShortenedSHA1();
60
62 new KeyRotatingSigner(
63 $key_rotation,
64 new HMACSigner(
65 $algorithm
66 ),
67 new HMACSigningKeyGenerator(
68 $algorithm
69 )
70 ),
71 new JSONSerializer(),
72 $compression,
73 $transport
74 );
75
76 $this->payload_builder =
new Builder();
77 }
The salt is combined with the secret key to derive a unique key for distinguishing different contexts...
◆ getSignedStreamToken()
ILIAS\FileDelivery\Token\DataSigner::getSignedStreamToken |
( |
FileStream |
$stream, |
|
|
string |
$filename, |
|
|
Disposition |
$disposition, |
|
|
int |
$user_id, |
|
|
?\DateTimeImmutable |
$until = null |
|
) |
| |
Definition at line 79 of file DataSigner.php.
85 : string {
86 $payload = $this->payload_builder->shortFile(
87 $stream,
89 );
90
91 if ($until !== null) {
92 $payload->setUntil($until->getTimestamp());
93 }
94
95 return $this->signing_serializer->sign(
97 $this->salt_factory->create('stream')
98 );
99 }
if(count($parts) !=3) $payload
References $payload.
◆ sign()
ILIAS\FileDelivery\Token\DataSigner::sign |
( |
array |
$data, |
|
|
string |
$salt, |
|
|
?\DateTimeImmutable |
$until = null |
|
) |
| |
Definition at line 110 of file DataSigner.php.
114 : string {
116
117 if ($until !== null) {
118 $payload->setUntil($until->getTimestamp());
119 }
120
121 return $this->signing_serializer->sign(
123 $this->salt_factory->create($salt)
124 );
125 }
References $payload.
◆ verify()
ILIAS\FileDelivery\Token\DataSigner::verify |
( |
string |
$token, |
|
|
string |
$salt |
|
) |
| |
Definition at line 127 of file DataSigner.php.
130 : ?array {
131 return $this->signing_serializer->verify(
133 $this->salt_factory->create($salt)
134 )?->get();
135 }
◆ verifyStreamToken()
ILIAS\FileDelivery\Token\DataSigner::verifyStreamToken |
( |
string |
$token | ) |
|
Definition at line 101 of file DataSigner.php.
101 : ?Payload
102 {
104 if (
$data ===
null) {
105 return null;
106 }
107 return $this->payload_builder->shortFileFromRaw(
$data);
108 }
verify(string $token, string $salt)
References $data, and $token.
◆ $payload_builder
Builder ILIAS\FileDelivery\Token\DataSigner::$payload_builder |
|
private |
◆ $salt_factory
Factory ILIAS\FileDelivery\Token\DataSigner::$salt_factory |
|
private |
◆ $signing_serializer
The documentation for this class was generated from the following file: