State
You will probably never need to use this. It is used internally by the clients to create a JWT from a state or to validate a given JWT. You should use JWTs directly instead.
eternaltwin.states.State
Represents an authorization state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
str
|
Action. |
required |
as_
|
str
|
Authorization server URL. |
required |
iat
|
int
|
Issued at timestamp. |
required |
rfp
|
int
|
Request forgery protection as a timestamp. |
required |
exp
|
int
|
Expiration timestamp. |
required |
nonce
|
str
|
Nonce value. |
required |
key
|
KeyABC
|
Key used to encode the state. |
required |
new
classmethod
Create a new state using given parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL of the authorization server. |
required |
key
|
KeyABC
|
Key used to encode the state. |
required |
expiration
|
int
|
Expiration time in seconds. |
600
|
nonce
|
str
|
An optional nonce value used to guarantee the state to be unique. If not provided, a random one will be generated. |
None
|
from_jwt
classmethod
Create a state from a JWT.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jwt
|
str
|
JWT string representing the state. |
required |
url
|
str
|
URL of the authorization server. |
required |
key
|
KeyABC
|
Key used to decode the state. |
required |
Raises:
| Type | Description |
|---|---|
InvalidStateError
|
If action or authorization server does not match, or the JWT is expired. |