pir_pipeline.dashboard.CustomSessionInterface

class pir_pipeline.dashboard.CustomSessionInterface

Bases: SecureCookieSessionInterface

Change how session is serialized

__init__()

Methods

__init__()

digest_method([string])

Don't access hashlib.sha1 until runtime.

get_cookie_domain(app)

The value of the Domain parameter on the session cookie.

get_cookie_httponly(app)

Returns True if the session cookie should be httponly.

get_cookie_name(app)

The name of the session cookie.

get_cookie_partitioned(app)

Returns True if the cookie should be partitioned.

get_cookie_path(app)

Returns the path for which the cookie should be valid.

get_cookie_samesite(app)

Return 'Strict' or 'Lax' if the cookie should use the SameSite attribute.

get_cookie_secure(app)

Returns True if the cookie should be secure.

get_expiration_time(app, session)

A helper method that returns an expiration date for the session or None if the session is linked to the browser session.

get_signing_serializer(app)

is_null_session(obj)

Checks if a given object is a null session.

make_null_session(app)

Creates a null session which acts as a replacement object if the real session support could not be loaded due to a configuration error.

open_session(app, request)

This is called at the beginning of each request, after pushing the request context, before matching the URL.

save_session(app, session, response)

This is called at the end of each request, after generating a response, before removing the request context.

should_set_cookie(app, session)

Used by session backends to determine if a Set-Cookie header should be set for this session cookie for this response.

Attributes

key_derivation

the name of the itsdangerous supported key derivation.

pickle_based

A flag that indicates if the session interface is pickle based.

salt

the salt that should be applied on top of the secret key for the signing of cookie based sessions.

serializer

A python serializer for the payload.

static digest_method(string: bytes = b'') Any

Don’t access hashlib.sha1 until runtime. FIPS builds may not include SHA-1, in which case the import and use as a default would fail before the developer can configure something else.

The value of the Domain parameter on the session cookie. If not set, browsers will only send the cookie to the exact domain it was set from. Otherwise, they will send it to any subdomain of the given value as well.

Uses the SESSION_COOKIE_DOMAIN config.

Changed in version 2.3: Not set by default, does not fall back to SERVER_NAME.

Returns True if the session cookie should be httponly. This currently just returns the value of the SESSION_COOKIE_HTTPONLY config var.

The name of the session cookie. Uses``app.config[“SESSION_COOKIE_NAME”]``.

Returns True if the cookie should be partitioned. By default, uses the value of SESSION_COOKIE_PARTITIONED.

Added in version 3.1.

Returns the path for which the cookie should be valid. The default implementation uses the value from the SESSION_COOKIE_PATH config var if it’s set, and falls back to APPLICATION_ROOT or uses / if it’s None.

Return 'Strict' or 'Lax' if the cookie should use the SameSite attribute. This currently just returns the value of the SESSION_COOKIE_SAMESITE setting.

Returns True if the cookie should be secure. This currently just returns the value of the SESSION_COOKIE_SECURE setting.

get_expiration_time(app: Flask, session: SessionMixin) datetime | None

A helper method that returns an expiration date for the session or None if the session is linked to the browser session. The default implementation returns now + the permanent session lifetime configured on the application.

is_null_session(obj: object) bool

Checks if a given object is a null session. Null sessions are not asked to be saved.

This checks if the object is an instance of null_session_class by default.

key_derivation = 'hmac'

the name of the itsdangerous supported key derivation. The default is hmac.

make_null_session(app: Flask) NullSession

Creates a null session which acts as a replacement object if the real session support could not be loaded due to a configuration error. This mainly aids the user experience because the job of the null session is to still support lookup without complaining but modifications are answered with a helpful error message of what failed.

This creates an instance of null_session_class by default.

null_session_class

alias of NullSession

open_session(app: Flask, request: Request) SecureCookieSession | None

This is called at the beginning of each request, after pushing the request context, before matching the URL.

This must return an object which implements a dictionary-like interface as well as the SessionMixin interface.

This will return None to indicate that loading failed in some way that is not immediately an error. The request context will fall back to using make_null_session() in this case.

pickle_based = False

A flag that indicates if the session interface is pickle based. This can be used by Flask extensions to make a decision in regards to how to deal with the session object.

Added in version 0.10.

salt = 'cookie-session'

the salt that should be applied on top of the secret key for the signing of cookie based sessions.

save_session(app: Flask, session: SessionMixin, response: Response) None

This is called at the end of each request, after generating a response, before removing the request context. It is skipped if is_null_session() returns True.

serializer = <flask.json.tag.TaggedJSONSerializer object>

A python serializer for the payload. The default is a compact JSON derived serializer with support for some extra Python types such as datetime objects or tuples.

session_class

alias of SecureCookieSession

Used by session backends to determine if a Set-Cookie header should be set for this session cookie for this response. If the session has been modified, the cookie is set. If the session is permanent and the SESSION_REFRESH_EACH_REQUEST config is true, the cookie is always set.

This check is usually skipped if the session was deleted.

Added in version 0.11.