serviceiamsession

package
v0.10.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAllSessions

func DeleteAllSessions(userID string) error

DeleteAllSessions deletes all indexed sessions of a user. Missing session records are treated as stale index entries and cleaned up from the user's ZSET so the operation remains idempotent.

func DeleteOtherSessions

func DeleteOtherSessions(userID, currentSessionID string) error

DeleteOtherSessions deletes all indexed sessions of a user except the current session. Missing session records are treated as stale index entries and cleaned up from the user's ZSET so the operation remains idempotent.

func DeleteSession

func DeleteSession(sessionID string) (modeliamsession.Session, error)

DeleteSession deletes the stored session and removes the indexed user-session relation.

func GetCurrentSession

func GetCurrentSession(ctx *types.ServiceContext) (string, modeliamsession.Session, error)

GetCurrentSession loads the current authenticated user session from the request cookie and Redis storage. It only enforces the minimal integrity required by IAM services: the session must exist and be bound to a user. Database-level checks such as user status, permission, or account existence remain the responsibility of the caller.

func GetSessionExpiration

func GetSessionExpiration() time.Duration

GetSessionExpiration returns the configured session expiration time. If not configured, it returns the default value of 8 hours.

func InvalidateUserSessions

func InvalidateUserSessions(userID string)

InvalidateUserSessions removes all indexed sessions for a user. It is best-effort: failures to talk to Redis do not block password updates.

func SetSessionExpiration

func SetSessionExpiration(expiration time.Duration)

SetSessionExpiration sets the session expiration time for iam module. This function should be called during module registration.

func TrackUserSession

func TrackUserSession(session modeliamsession.Session) error

TrackUserSession adds the session id into the user's indexed session set.

func UpdateSessionMustChangePassword

func UpdateSessionMustChangePassword(sessionID string, mustChange bool) error

UpdateSessionMustChangePassword updates the stored session after the user clears MustChangePassword in the database.

Types

type AdminSessionsDeleteService

AdminSessionsDeleteService handles invalidation of a specified session for privileged administrators.

func (*AdminSessionsDeleteService) Delete

Delete invalidates a specified session for a privileged administrator.

type AdminSessionsGetService

AdminSessionsGetService handles retrieval of a specified session for privileged administrators.

func (*AdminSessionsGetService) Get

Get returns the detail of a specified session for a privileged administrator.

type AdminSessionsListService

AdminSessionsListService handles retrieval of all sessions grouped by user for privileged administrators.

func (*AdminSessionsListService) List

List returns all indexed sessions grouped by user for a privileged administrator.

type AdminUserSessionsDeleteService

AdminUserSessionsDeleteService handles invalidation of all sessions owned by a specified user for privileged administrators.

func (*AdminUserSessionsDeleteService) Delete

Delete invalidates all indexed sessions of a specified user for a privileged administrator.

type AdminUserSessionsListService

AdminUserSessionsListService handles retrieval of all sessions owned by a specified user for privileged administrators.

func (*AdminUserSessionsListService) List

List returns all indexed sessions of a specified user for a privileged administrator.

type CurrentDeleteService

CurrentDeleteService handles invalidation of the current authenticated session.

func (*CurrentDeleteService) Delete

Delete invalidates the current authenticated session and clears the session cookie.

type CurrentListService

CurrentListService handles retrieval of the current authenticated session.

func (*CurrentListService) List

List returns the current authenticated session together with the latest user snapshot.

type HeartbeatService

HeartbeatService records client liveness for the current authenticated session.

func (*HeartbeatService) Create

Create validates the current session and updates the online-user record without extending the Redis session lifetime.

type SessionsDeleteAllService

SessionsDeleteAllService handles invalidation of all sessions for the current authenticated user.

func (*SessionsDeleteAllService) Delete

Delete invalidates all sessions for the current authenticated user.

type SessionsDeleteService

SessionsDeleteService handles invalidation of a specified session for the current authenticated user.

func (*SessionsDeleteService) Delete

Delete invalidates a specified session for the current authenticated user. When the route id is "others", it keeps the current session active and revokes every other indexed session of the same user. The endpoint remains idempotent: deleting a missing session still returns success.

type SessionsGetService

SessionsGetService handles retrieval of a specified session for the current authenticated user.

func (*SessionsGetService) Get

Get returns the detail of a specified session for the current authenticated user.

type SessionsListService

SessionsListService handles retrieval of all active sessions for the current authenticated user.

func (*SessionsListService) List

List returns all active sessions for the current authenticated user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址