MediaWiki master
MediaWiki\Json\RsaJwtCodec Class Reference

JwtCodec using lcobucci/jwt with an RSA key ($wgJwtPublicKey / $wgJwtPrivateKey). More...

Inherits MediaWiki\Json\JwtCodec.

Collaboration diagram for MediaWiki\Json\RsaJwtCodec:

Public Member Functions

 __construct (private ServiceOptions $serviceOptions)
 
 create (array $claims)
 Creates a JWT string with the given claims.
 
 isEnabled ()
 Whether the codec can be used (disabled means it hasn't been properly configured).All other methods will throw on a disabled JwtCodec.
 
 parse (string $jwt)
 Parses and partially validates a JWT string, and returns the set of claim inside it.The validation covers the signature and time fields; other checks are left to the caller.

Exceptions
JwtExceptionIf the JWT is invalid (expired, has invalid signature or can't even be parsed).

 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

JwtCodec using lcobucci/jwt with an RSA key ($wgJwtPublicKey / $wgJwtPrivateKey).

Since
1.45

Definition at line 27 of file RsaJwtCodec.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Json\RsaJwtCodec::__construct ( private ServiceOptions $serviceOptions)

Definition at line 35 of file RsaJwtCodec.php.

Member Function Documentation

◆ create()

MediaWiki\Json\RsaJwtCodec::create ( array $claims)

Creates a JWT string with the given claims.

Implements MediaWiki\Json\JwtCodec.

Definition at line 48 of file RsaJwtCodec.php.

◆ isEnabled()

MediaWiki\Json\RsaJwtCodec::isEnabled ( )

Whether the codec can be used (disabled means it hasn't been properly configured).All other methods will throw on a disabled JwtCodec.

Implements MediaWiki\Json\JwtCodec.

Definition at line 42 of file RsaJwtCodec.php.

◆ parse()

MediaWiki\Json\RsaJwtCodec::parse ( string $jwt)

Parses and partially validates a JWT string, and returns the set of claim inside it.The validation covers the signature and time fields; other checks are left to the caller.

Exceptions
JwtExceptionIf the JWT is invalid (expired, has invalid signature or can't even be parsed).

Implements MediaWiki\Json\JwtCodec.

Definition at line 62 of file RsaJwtCodec.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Json\RsaJwtCodec::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const JwtPublicKey
Name constant for the JwtPublicKey setting, for use with Config::get()
const JwtPrivateKey
Name constant for the JwtPrivateKey setting, for use with Config::get()
Access: internal

Definition at line 30 of file RsaJwtCodec.php.


The documentation for this class was generated from the following file: