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.
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 theSameSite
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
the name of the itsdangerous supported key derivation.
A flag that indicates if the session interface is pickle based.
the salt that should be applied on top of the secret key for the signing of cookie based sessions.
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.
- get_cookie_domain(app: Flask) str | None ¶
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
.
- get_cookie_httponly(app: Flask) bool ¶
Returns True if the session cookie should be httponly. This currently just returns the value of the
SESSION_COOKIE_HTTPONLY
config var.
- get_cookie_name(app: Flask) str ¶
The name of the session cookie. Uses``app.config[“SESSION_COOKIE_NAME”]``.
- get_cookie_partitioned(app: Flask) bool ¶
Returns True if the cookie should be partitioned. By default, uses the value of
SESSION_COOKIE_PARTITIONED
.Added in version 3.1.
- get_cookie_path(app: Flask) str ¶
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 toAPPLICATION_ROOT
or uses/
if it’sNone
.
- get_cookie_samesite(app: Flask) str | None ¶
Return
'Strict'
or'Lax'
if the cookie should use theSameSite
attribute. This currently just returns the value of theSESSION_COOKIE_SAMESITE
setting.
- get_cookie_secure(app: Flask) bool ¶
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 usingmake_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()
returnsTrue
.
- 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
- should_set_cookie(app: Flask, session: SessionMixin) bool ¶
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 theSESSION_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.