class flaskbb.core.tokens.TokenActions[source]

Collection of token actions.


This is just a class rather than an enum because enums cannot be extended at runtime which would limit the number of token actions to the ones implemented by FlaskBB itself and block extension of tokens by plugins.

class flaskbb.core.tokens.Token(user_id, operation)[source]
class flaskbb.core.tokens.TokenSerializer[source]

This method is abstract.

Used to transform a token into a string representation of it.

Parameters:token (Token) –
Returns str:

This method is abstract

Used to transform a string representation of a token into an actual Token instance

Parameters:raw_token (str) –
Returns token:The parsed token
Return type:Token<flaskbb.core.tokens.Token>
class flaskbb.core.tokens.TokenVerifier[source]

Used to verify the validatity of tokens post deserialization, such as an email matching the user id in the provided token.

Should raise a ValidationError if verification fails.

verify_token(token, **kwargs)[source]

This method is abstract.

  • token (Token) – The parsed token to verify
  • kwargs – Arbitrary context for validation of the token
exception flaskbb.core.tokens.TokenError(reason)[source]

Raised when there is an issue with deserializing a token. Has helper classmethods to ensure consistent verbiage.

Parameters:reason (str) – An explanation of why the token is invalid
classmethod invalid()[source]

Used to raise an exception about a token that is invalid due to being signed incorrectly, has been tampered with, is unparsable or contains an inappropriate action.

classmethod expired()[source]

Used to raise an exception about a token that has expired and is no longer usable.