Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4006694
PlainJsonJwtCodec.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
774 B
Referenced Files
None
Subscribers
None
PlainJsonJwtCodec.php
View Options
<?php
namespace
MediaWiki\Tests\Json
;
use
MediaWiki\Json\JwtCodec
;
use
MediaWiki\Json\JwtException
;
/**
* A JwtCodec replacement that outputs plain unencrypted JSON.
*/
class
PlainJsonJwtCodec
implements
JwtCodec
{
/** @inheritDoc */
public
function
isEnabled
():
bool
{
return
true
;
}
/** @inheritDoc */
public
function
create
(
array
$claims
):
string
{
$jwt
=
json_encode
(
$claims
,
JSON_UNESCAPED_SLASHES
|
JSON_UNESCAPED_UNICODE
);
if
(
$jwt
===
false
)
{
throw
new
JwtException
(
json_last_error_msg
()
);
}
return
$jwt
;
}
/** @inheritDoc */
public
function
parse
(
string
$jwt
):
array
{
$claims
=
json_decode
(
$jwt
,
true
);
if
(
$claims
===
null
)
{
throw
new
JwtException
(
json_last_error_msg
()
);
}
return
$claims
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 14 2026, 09:20 (14 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
62/f9/863b414de5fd2f0bd9c02fdce87b
Default Alt Text
PlainJsonJwtCodec.php (774 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment