Implements the IAuthToken interface for encoding, decoding, and verifying authentication tokens.
More...
|
byte[] | ReadBytes (Stream stream, int length) |
| Reads a specified number of bytes from a stream.
|
|
Implements the IAuthToken interface for encoding, decoding, and verifying authentication tokens.
◆ Decode< T >()
void XmobiTea.ProtonNet.Token.AuthToken.Decode< T > |
( |
string | token, |
|
|
out ITokenHeader | header, |
|
|
out T | payload ) |
Decodes the specified token into a header and payload.
- Template Parameters
-
T | The type of the payload. |
- Parameters
-
token | The token to decode. |
header | Outputs the token header. |
payload | Outputs the token payload. |
- Exceptions
-
TokenStringInvalidException | Thrown if the token is invalid. |
Implements XmobiTea.ProtonNet.Token.IAuthToken.
◆ Encode< T >()
string XmobiTea.ProtonNet.Token.AuthToken.Encode< T > |
( |
T | payload, |
|
|
string | key, |
|
|
TokenOptions | options = null ) |
Encodes the specified payload into a token.
- Template Parameters
-
T | The type of the payload. |
- Parameters
-
payload | The payload to encode. |
key | The key used for signing the token. |
options | Optional encoding options. |
- Returns
- The encoded token as a string.
Implements XmobiTea.ProtonNet.Token.IAuthToken.
◆ ReadBytes()
byte[] XmobiTea.ProtonNet.Token.AuthToken.ReadBytes |
( |
Stream | stream, |
|
|
int | length ) |
|
protected |
Reads a specified number of bytes from a stream.
- Parameters
-
stream | The stream to read from. |
length | The number of bytes to read. |
- Returns
- A byte array containing the data read from the stream.
◆ SetBinaryConverter()
Sets the binary converter for the specified binary type.
- Parameters
-
binaryType | The binary type. |
binaryConverter | The binary converter. |
◆ Verify< T >()
void XmobiTea.ProtonNet.Token.AuthToken.Verify< T > |
( |
string | token, |
|
|
string | key, |
|
|
out ITokenHeader | header, |
|
|
out T | payload ) |
Verifies the specified token using the provided key and outputs the header and payload.
- Template Parameters
-
T | The type of the payload. |
- Parameters
-
token | The token to verify. |
key | The key used for verification. |
header | Outputs the verified token header. |
payload | Outputs the verified token payload. |
- Exceptions
-
TokenSignatureInvalidException | Thrown if the token signature is invalid. |
TokenExpiredException | Thrown if the token has expired. |
Implements XmobiTea.ProtonNet.Token.IAuthToken.
The documentation for this class was generated from the following file:
- XmobiTea.ProtonNet.Token/AuthToken.cs