Liking cljdoc? Tell your friends :D

biff.datalevin.session

Session management backed by Datalevin.

Provides both direct session management functions and a Ring-compatible session store implementation.

Session management backed by Datalevin.

Provides both direct session management functions and a Ring-compatible
session store implementation.
raw docstring

cleanup-expired-sessions!clj

(cleanup-expired-sessions! conn-or-system)

Deletes expired sessions and returns the number removed.

Accepts a Datalevin connection or system map.

Deletes expired sessions and returns the number removed.

Accepts a Datalevin connection or system map.
sourceraw docstring

cleanup-expired-sessions-txclj

(cleanup-expired-sessions-tx db-or-conn-or-system)

Creates transactions to delete all expired sessions.

Returns a vector of retraction transactions.

Creates transactions to delete all expired sessions.

Returns a vector of retraction transactions.
sourceraw docstring

create-sessionclj

(create-session user-ref
                &
                {:keys [expires-in-hours] :or {expires-in-hours 168}})

Creates a new session for a user.

The user-ref can be either:

  • A UUID (will be converted to lookup ref [:user/id uuid])
  • A lookup ref like [:user/id uuid]
  • A numeric entity ID

Options: :expires-in-hours - Session lifetime in hours (default 168 = 7 days)

Returns a map with :session-id and :tx (transaction data).

Note: The user must exist before creating a session.

Creates a new session for a user.

The user-ref can be either:
- A UUID (will be converted to lookup ref [:user/id uuid])
- A lookup ref like [:user/id uuid]
- A numeric entity ID

Options:
  :expires-in-hours - Session lifetime in hours (default 168 = 7 days)

Returns a map with :session-id and :tx (transaction data).

Note: The user must exist before creating a session.
sourceraw docstring

create-session-tokenclj

(create-session-token session-id
                      {:keys [secret expires-in-sec]
                       :or {expires-in-sec 604800}})

Creates a signed JWT token containing session data.

Options: :secret - Signing secret (required) :expires-in-sec - Token lifetime in seconds (default 604800 = 7 days)

Creates a signed JWT token containing session data.

Options:
   :secret         - Signing secret (required)
   :expires-in-sec - Token lifetime in seconds (default 604800 = 7 days)
sourceraw docstring

datalevin-session-storeclj

(datalevin-session-store conn)
(datalevin-session-store conn opts)

Creates a Ring session store backed by Datalevin.

Options: :expires-in-hours - Session lifetime in hours (default 168 = 7 days)

Usage: (wrap-session handler {:store (datalevin-session-store conn)})

Creates a Ring session store backed by Datalevin.

Options:
  :expires-in-hours - Session lifetime in hours (default 168 = 7 days)

Usage:
  (wrap-session handler {:store (datalevin-session-store conn)})
sourceraw docstring

delete-session-txclj

(delete-session-tx db-or-conn-or-system session-id)

Creates a transaction to delete a session.

For Datalevin, this returns a retraction using the lookup ref. The session must exist for this to work.

Creates a transaction to delete a session.

For Datalevin, this returns a retraction using the lookup ref.
The session must exist for this to work.
sourceraw docstring

delete-user-sessions-txclj

(delete-user-sessions-tx db-or-conn-or-system user-id)

Creates transactions to delete all sessions for a user.

Returns a vector of retraction transactions.

Creates transactions to delete all sessions for a user.

Returns a vector of retraction transactions.
sourceraw docstring

get-sessionclj

(get-session db-or-system session-id)

Retrieves a session by ID.

Returns the session entity with user data if valid and not expired, nil otherwise.

Retrieves a session by ID.

Returns the session entity with user data if valid and not expired,
nil otherwise.
sourceraw docstring

get-session-userclj

(get-session-user db-or-system session-id)

Retrieves the user associated with a session.

Returns the user map if session is valid, nil otherwise.

Retrieves the user associated with a session.

Returns the user map if session is valid, nil otherwise.
sourceraw docstring

update-session-store-connclj

(update-session-store-conn store conn)

Updates the connection used by a session store.

Useful when the connection changes during development.

Updates the connection used by a session store.

Useful when the connection changes during development.
sourceraw docstring

verify-session-tokenclj

(verify-session-token token secret)

Verifies and decodes a JWT session token.

Returns the session-id as UUID if valid, nil otherwise.

Verifies and decodes a JWT session token.

Returns the session-id as UUID if valid, nil otherwise.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close