2626namespace SimpleSAML \Module \casserver \Cas \Ticket ;
2727
2828use SimpleSAML \Configuration ;
29- use SimpleSAML \Utils \ Random ;
29+ use SimpleSAML \Utils ;
3030
3131class TicketFactory
3232{
@@ -58,10 +58,11 @@ public function __construct(Configuration $config)
5858 */
5959 public function createSessionTicket (string $ sessionId , int $ expiresAt ): array
6060 {
61+ $ randomUtils = new Utils \Random ();
6162 return [
6263 'id ' => $ sessionId ,
6364 'validBefore ' => $ expiresAt ,
64- 'renewId ' => Random:: generateID ()
65+ 'renewId ' => $ randomUtils -> generateID ()
6566 ];
6667 }
6768
@@ -72,7 +73,8 @@ public function createSessionTicket(string $sessionId, int $expiresAt): array
7273 */
7374 public function createServiceTicket (array $ content ): array
7475 {
75- $ id = str_replace ('_ ' , 'ST- ' , Random::generateID ());
76+ $ randomUtils = new Utils \Random ();
77+ $ id = str_replace ('_ ' , 'ST- ' , $ randomUtils ->generateID ());
7678 $ expiresAt = time () + $ this ->serviceTicketExpireTime ;
7779
7880 return array_merge (['id ' => $ id , 'validBefore ' => $ expiresAt ], $ content );
@@ -85,8 +87,9 @@ public function createServiceTicket(array $content): array
8587 */
8688 public function createProxyGrantingTicket (array $ content ): array
8789 {
88- $ id = str_replace ('_ ' , 'PGT- ' , Random::generateID ());
89- $ iou = str_replace ('_ ' , 'PGTIOU- ' , Random::generateID ());
90+ $ randomUtils = new Utils \Random ();
91+ $ id = str_replace ('_ ' , 'PGT- ' , $ randomUtils ->generateID ());
92+ $ iou = str_replace ('_ ' , 'PGTIOU- ' , $ randomUtils ->generateID ());
9093
9194 $ expireAt = time () + $ this ->proxyGrantingTicketExpireTime ;
9295
@@ -100,7 +103,8 @@ public function createProxyGrantingTicket(array $content): array
100103 */
101104 public function createProxyTicket (array $ content ): array
102105 {
103- $ id = str_replace ('_ ' , 'PT- ' , Random::generateID ());
106+ $ randomUtils = new Utils \Random ();
107+ $ id = str_replace ('_ ' , 'PT- ' , $ randomUtils ->generateID ());
104108 $ expiresAt = time () + $ this ->proxyTicketExpireTime ;
105109
106110 return array_merge (['id ' => $ id , 'validBefore ' => $ expiresAt ], $ content );
0 commit comments