Entity Class

Entity is a service class concerned with Database / ORM / sessions & transaction Includes static utilities consumed by AuthStrategy classes

class flask_jwt_router._entity.BaseEntity[source]
class flask_jwt_router._entity.Entity(config: ClassVar)[source]
Parameters
  • config

  • auth_model

auth_model: _GenericAlias = None

The assigned entity model in the current request This gets assigned in get_entity_from_token

clean_up() → None[source]

Cleans up the oauth entity key state between requests

decoded_token: Dict[str, Any] = None

The result from the decoded token. This gets assigned in get_entity_from_token

get_attr_name(table_name: str = None) → str[source]

If SQLAlchemy is the ORM then expect there to be a __mapper__.primary_key path. This returns a list but for our purposes we only need the first primary key attribute name. This method maintains the existing option of specifying a primary key name directly for scenarios when not using SqlAlchemy etc. :param table_name: :return:

get_entity_from_ext(tablename: str = None) → _GenericAlias[source]

Exception raised if SQLAlchemy ORM not being used (SQLAlchemy will throw if __tablename__ doesn’t exist or it can’t create the name from the db engine’s table object. :return: {_ORMType}

get_entity_from_token_or_tablename(decoded_token: Dict[str, any] = None, *, tablename=None, email_value=None) → Optional[str][source]

Entity class main public method. Attaches a __get_entity__ method to the AuthModel class & calling the attached method returns the entity data :param decoded_token: {Dict[str, Any]} :kwargs:

param tablename

This is passed in directly from any oauth 2.0 sessions

Returns

{str}

tablename: Optional[str] = None

The table name value from :class: ~flask_jwt_router.oauth2.google. This indicates we are now using oauth 2.0.

exception flask_jwt_router._entity.NoTokenInHeadersError(err)[source]