MediaWiki master
MediaWiki\Json\JwtCodec Interface Reference

A helper to read and write JWTs without having to depend on a specific library, and using central configuration for the encryption details. More...

Inherited by MediaWiki\Json\RsaJwtCodec.

Public Member Functions

 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).
 
 parse (string $jwt)
 Parses and partially validates a JWT string, and returns the set of claim inside it.
 

Detailed Description

A helper to read and write JWTs without having to depend on a specific library, and using central configuration for the encryption details.

Since
1.45
Stability: stable
to implement

Definition at line 12 of file JwtCodec.php.

Member Function Documentation

◆ create()

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

Creates a JWT string with the given claims.

Implemented in MediaWiki\Json\RsaJwtCodec.

◆ isEnabled()

MediaWiki\Json\JwtCodec::isEnabled ( )

Whether the codec can be used (disabled means it hasn't been properly configured).

All other methods will throw on a disabled JwtCodec.

Implemented in MediaWiki\Json\RsaJwtCodec.

◆ parse()

MediaWiki\Json\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).

Implemented in MediaWiki\Json\RsaJwtCodec.


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