ILIAS  release_8 Revision v8.24
PlatformNonce.php
Go to the documentation of this file.
1<?php
2
20
29{
33 public const MAX_NONCE_AGE = 30; // in minutes
34
42 public static int $maximumLength = 50;
43
49 public ?int $expires = null;
50
56 private ?Platform $platform = null;
57
63 private ?string $value = null;
64
70 public function __construct(Platform $platform, string $value = null)
71 {
72 $this->platform = $platform;
73 $this->value = substr($value, -self::$maximumLength);
74 $this->expires = time() + (self::MAX_NONCE_AGE * 60);
75 }
76
82 public function load(): bool
83 {
84 return $this->platform->getDataConnector()->loadPlatformNonce($this);
85 }
86
92 public function save(): bool
93 {
94 return $this->platform->getDataConnector()->savePlatformNonce($this);
95 }
96
102 public function delete(): bool
103 {
104 return $this->platform->getDataConnector()->deletePlatformNonce($this);
105 }
106
112 public function getPlatform(): ?Platform
113 {
114 return $this->platform;
115 }
116
122 public function getValue(): ?string
123 {
124 return $this->value;
125 }
126}
Class to represent a platform nonce.
static int $maximumLength
Maximum length which can be stored.
Platform $platform
Platform to which this nonce applies.
int $expires
Timestamp for when the nonce value expires.
const MAX_NONCE_AGE
Maximum age nonce values will be retained for (in minutes).
load()
Load a nonce value from the database.
__construct(Platform $platform, string $value=null)
Class constructor.
save()
Save a nonce value in the database.
Class to represent a platform.
Definition: Platform.php:36
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: AccessToken.php:19