Documentation
¶
Index ¶
- func FormatExpiresIn(t time.Time) string
- func FormatRelativeTime(t time.Time) string
- func IsSessionActive(expiresAt time.Time) bool
- func IsSessionExpiringSoon(expiresAt time.Time, within time.Duration) bool
- type Config
- type DashboardExtension
- func (e *DashboardExtension) BridgeFunctions() []ui.BridgeFunction
- func (e *DashboardExtension) DashboardWidgets() []ui.DashboardWidget
- func (e *DashboardExtension) ExtensionID() string
- func (e *DashboardExtension) NavigationItems() []ui.NavigationItem
- func (e *DashboardExtension) RenderDashboardWidget(basePath string, currentApp *app.App) g.Node
- func (e *DashboardExtension) RevokeAllUserSessions(ctx *router.PageContext) (g.Node, error)
- func (e *DashboardExtension) RevokeSession(ctx *router.PageContext) (g.Node, error)
- func (e *DashboardExtension) Routes() []ui.Route
- func (e *DashboardExtension) SaveSettings(ctx *router.PageContext) (g.Node, error)
- func (e *DashboardExtension) ServeMultiSessionPage(ctx *router.PageContext) (g.Node, error)
- func (e *DashboardExtension) ServeMultiSessionPageLegacy(ctx *router.PageContext) (g.Node, error)
- func (e *DashboardExtension) ServeSessionDetailPage(ctx *router.PageContext) (g.Node, error)
- func (e *DashboardExtension) ServeSessionDetailPageLegacy(ctx *router.PageContext) (g.Node, error)
- func (e *DashboardExtension) ServeSettings(ctx *router.PageContext) (g.Node, error)
- func (e *DashboardExtension) ServeSettingsLegacy(ctx *router.PageContext) (g.Node, error)
- func (e *DashboardExtension) ServeUserSessionsPage(ctx *router.PageContext) (g.Node, error)
- func (e *DashboardExtension) ServeUserSessionsPageLegacy(ctx *router.PageContext) (g.Node, error)
- func (e *DashboardExtension) SetRegistry(registry any)
- func (e *DashboardExtension) SettingsPages() []ui.SettingsPage
- func (e *DashboardExtension) SettingsSections() []ui.SettingsSection
- type DeviceInfo
- type ErrorResponse
- type GetSessionInput
- type GetSessionResult
- type GetSessionStatsInput
- type GetSessionStatsResult
- type GetSessionsInput
- type GetSessionsResult
- type GetSettingsInput
- type GetSettingsResult
- type GetUserSessionsInput
- type GetUserSessionsResult
- type Handler
- func (h *Handler) Delete(c forge.Context) error
- func (h *Handler) GetByID(c forge.Context) error
- func (h *Handler) GetCurrent(c forge.Context) error
- func (h *Handler) GetStats(c forge.Context) error
- func (h *Handler) List(c forge.Context) error
- func (h *Handler) Refresh(c forge.Context) error
- func (h *Handler) RevokeAll(c forge.Context) error
- func (h *Handler) RevokeOthers(c forge.Context) error
- func (h *Handler) SetActive(c forge.Context) error
- type ListSessionsRequest
- type MessageResponse
- type MultiSessionErrorResponse
- type PaginationInfoDTO
- type Plugin
- func (p *Plugin) DashboardExtension() ui.DashboardExtension
- func (p *Plugin) GetAuthService() *auth.Service
- func (p *Plugin) ID() string
- func (p *Plugin) Init(authInst core.Authsome) error
- func (p *Plugin) Migrate() error
- func (p *Plugin) RegisterHooks(_ *hooks.HookRegistry) error
- func (p *Plugin) RegisterRoutes(router forge.Router) error
- func (p *Plugin) RegisterServiceDecorators(_ *registry.ServiceRegistry) error
- type PluginOption
- type RevokeAllRequest
- type RevokeAllUserSessionsInput
- type RevokeAllUserSessionsResult
- type RevokeResponse
- type RevokeSessionInput
- type RevokeSessionResult
- type Service
- func (s *Service) CurrentUserFromToken(ctx context.Context, token string) (xid.ID, error)
- func (s *Service) Delete(ctx context.Context, userID, id xid.ID) error
- func (s *Service) Find(ctx context.Context, userID xid.ID, id xid.ID) (*session.Session, error)
- func (s *Service) GetCurrent(ctx context.Context, userID, sessionID xid.ID) (*session.Session, error)
- func (s *Service) GetCurrentSessionID(ctx context.Context, token string) (xid.ID, error)
- func (s *Service) GetStats(ctx context.Context, userID xid.ID) (*SessionStats, error)
- func (s *Service) List(ctx context.Context, userID xid.ID, req *ListSessionsRequest) (*session.ListSessionsResponse, error)
- func (s *Service) RefreshCurrent(ctx context.Context, userID, sessionID xid.ID) (*session.Session, error)
- func (s *Service) RevokeAll(ctx context.Context, userID xid.ID, includeCurrentSession bool, ...) (int, error)
- func (s *Service) RevokeAllExceptCurrent(ctx context.Context, userID, currentSessionID xid.ID) (int, error)
- type SessionDTO
- type SessionDetailDTO
- type SessionStats
- type SessionStatsDTO
- type SessionStatsResponse
- type SessionTokenResponse
- type SessionsResponse
- type SetActiveRequest
- type SettingsDTO
- type StatusResponse
- type UpdateSettingsInput
- type UpdateSettingsResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatExpiresIn ¶ added in v0.0.3
FormatExpiresIn formats time until expiration.
func FormatRelativeTime ¶ added in v0.0.3
FormatRelativeTime formats a time as relative time (e.g., "2 hours ago").
func IsSessionActive ¶ added in v0.0.3
IsSessionActive checks if a session is currently active.
Types ¶
type Config ¶
type Config struct {
// MaxSessionsPerUser is the maximum concurrent sessions per user
MaxSessionsPerUser int `json:"maxSessionsPerUser"`
// EnableDeviceTracking enables device fingerprinting
EnableDeviceTracking bool `json:"enableDeviceTracking"`
// SessionExpiry is the session expiry time in hours
SessionExpiryHours int `json:"sessionExpiryHours"`
// AllowCrossPlatform allows sessions across different platforms
AllowCrossPlatform bool `json:"allowCrossPlatform"`
}
Config holds the multisession plugin configuration.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default multisession plugin configuration.
type DashboardExtension ¶
type DashboardExtension struct {
// contains filtered or unexported fields
}
DashboardExtension implements the ui.DashboardExtension interface This allows the multisession plugin to add its own screens to the dashboard.
func NewDashboardExtension ¶
func NewDashboardExtension(plugin *Plugin) *DashboardExtension
NewDashboardExtension creates a new dashboard extension for multisession.
func (*DashboardExtension) BridgeFunctions ¶ added in v0.0.15
func (e *DashboardExtension) BridgeFunctions() []ui.BridgeFunction
BridgeFunctions returns bridge functions for the multisession plugin.
func (*DashboardExtension) DashboardWidgets ¶
func (e *DashboardExtension) DashboardWidgets() []ui.DashboardWidget
DashboardWidgets returns widgets to show on the main dashboard.
func (*DashboardExtension) ExtensionID ¶
func (e *DashboardExtension) ExtensionID() string
ExtensionID returns the unique identifier for this extension.
func (*DashboardExtension) NavigationItems ¶
func (e *DashboardExtension) NavigationItems() []ui.NavigationItem
NavigationItems returns navigation items to register.
func (*DashboardExtension) RenderDashboardWidget ¶
RenderDashboardWidget renders the dashboard widget showing session stats.
func (*DashboardExtension) RevokeAllUserSessions ¶
func (e *DashboardExtension) RevokeAllUserSessions(ctx *router.PageContext) (g.Node, error)
RevokeAllUserSessions handles revoking all sessions for a user.
func (*DashboardExtension) RevokeSession ¶
func (e *DashboardExtension) RevokeSession(ctx *router.PageContext) (g.Node, error)
RevokeSession handles session revocation.
func (*DashboardExtension) Routes ¶
func (e *DashboardExtension) Routes() []ui.Route
Routes returns routes to register under /app/:appId/.
func (*DashboardExtension) SaveSettings ¶
func (e *DashboardExtension) SaveSettings(ctx *router.PageContext) (g.Node, error)
SaveSettings handles saving multisession settings.
func (*DashboardExtension) ServeMultiSessionPage ¶
func (e *DashboardExtension) ServeMultiSessionPage(ctx *router.PageContext) (g.Node, error)
ServeMultiSessionPage renders the multi-session management page using v2 pages.
func (*DashboardExtension) ServeMultiSessionPageLegacy ¶ added in v0.0.15
func (e *DashboardExtension) ServeMultiSessionPageLegacy(ctx *router.PageContext) (g.Node, error)
ServeMultiSessionPageLegacy renders the multi-session management page with legacy layout Deprecated: Use ServeMultiSessionPage with v2 pages instead.
func (*DashboardExtension) ServeSessionDetailPage ¶ added in v0.0.3
func (e *DashboardExtension) ServeSessionDetailPage(ctx *router.PageContext) (g.Node, error)
ServeSessionDetailPage renders detailed information about a single session ServeSessionDetailPage renders the session detail page using v2 pages.
func (*DashboardExtension) ServeSessionDetailPageLegacy ¶ added in v0.0.15
func (e *DashboardExtension) ServeSessionDetailPageLegacy(ctx *router.PageContext) (g.Node, error)
ServeSessionDetailPageLegacy renders the session detail page with legacy layout Deprecated: Use ServeSessionDetailPage with v2 pages instead.
func (*DashboardExtension) ServeSettings ¶
func (e *DashboardExtension) ServeSettings(ctx *router.PageContext) (g.Node, error)
ServeSettings renders the multisession settings page ServeSettings renders the settings page using v2 pages.
func (*DashboardExtension) ServeSettingsLegacy ¶ added in v0.0.15
func (e *DashboardExtension) ServeSettingsLegacy(ctx *router.PageContext) (g.Node, error)
ServeSettingsLegacy renders the settings page with legacy layout Deprecated: Use ServeSettings with v2 pages instead.
func (*DashboardExtension) ServeUserSessionsPage ¶ added in v0.0.3
func (e *DashboardExtension) ServeUserSessionsPage(ctx *router.PageContext) (g.Node, error)
ServeUserSessionsPage renders all sessions for a specific user ServeUserSessionsPage renders the user sessions page using v2 pages.
func (*DashboardExtension) ServeUserSessionsPageLegacy ¶ added in v0.0.15
func (e *DashboardExtension) ServeUserSessionsPageLegacy(ctx *router.PageContext) (g.Node, error)
ServeUserSessionsPageLegacy renders the user sessions page with legacy layout Deprecated: Use ServeUserSessionsPage with v2 pages instead.
func (*DashboardExtension) SetRegistry ¶
func (e *DashboardExtension) SetRegistry(registry any)
SetRegistry sets the extension registry reference (deprecated but kept for compatibility).
func (*DashboardExtension) SettingsPages ¶
func (e *DashboardExtension) SettingsPages() []ui.SettingsPage
SettingsPages returns full settings pages for the new sidebar layout.
func (*DashboardExtension) SettingsSections ¶
func (e *DashboardExtension) SettingsSections() []ui.SettingsSection
SettingsSections returns settings sections to add to the settings page Deprecated: Use SettingsPages() instead.
type DeviceInfo ¶ added in v0.0.3
type DeviceInfo struct {
DeviceType string // Desktop, Mobile, Tablet, Bot, Unknown
OS string // Windows, macOS, Linux, iOS, Android, ChromeOS, etc.
OSVersion string // OS version if available
Browser string // Chrome, Firefox, Safari, Edge, etc.
BrowserVer string // Browser version if available
IsMobile bool
IsTablet bool
IsDesktop bool
IsBot bool
}
DeviceInfo contains parsed device information from user agent.
func ParseUserAgent ¶ added in v0.0.3
func ParseUserAgent(ua string) *DeviceInfo
ParseUserAgent parses a user agent string and extracts device information.
func (*DeviceInfo) FormatDeviceInfo ¶ added in v0.0.3
func (d *DeviceInfo) FormatDeviceInfo() string
FormatDeviceInfo returns a human-readable device string.
func (*DeviceInfo) ShortDeviceInfo ¶ added in v0.0.3
func (d *DeviceInfo) ShortDeviceInfo() string
ShortDeviceInfo returns a compact device string.
type ErrorResponse ¶
type ErrorResponse = responses.ErrorResponse
ErrorResponse types - use shared responses from core.
type GetSessionInput ¶ added in v0.0.15
GetSessionInput is the input for bridgeGetSession.
type GetSessionResult ¶ added in v0.0.15
type GetSessionResult struct {
Session SessionDetailDTO `json:"session"`
}
GetSessionResult is the output for bridgeGetSession.
type GetSessionStatsInput ¶ added in v0.0.15
type GetSessionStatsInput struct {
AppID string `json:"appId"`
}
GetSessionStatsInput is the input for bridgeGetSessionStats.
type GetSessionStatsResult ¶ added in v0.0.15
type GetSessionStatsResult struct {
Stats SessionStatsDTO `json:"stats"`
}
GetSessionStatsResult is the output for bridgeGetSessionStats.
type GetSessionsInput ¶ added in v0.0.15
type GetSessionsInput struct {
AppID string `json:"appId"`
UserID string `json:"userId,omitempty"`
Page int `json:"page,omitempty"`
PageSize int `json:"pageSize,omitempty"`
Status string `json:"status,omitempty"` // "active", "expiring", "expired", "all"
Device string `json:"device,omitempty"` // "mobile", "desktop", "tablet", "all"
Search string `json:"search,omitempty"` // Search by user ID
}
GetSessionsInput is the input for bridgeGetSessions.
type GetSessionsResult ¶ added in v0.0.15
type GetSessionsResult struct {
Sessions []SessionDTO `json:"sessions"`
Stats SessionStatsDTO `json:"stats"`
Pagination PaginationInfoDTO `json:"pagination"`
}
GetSessionsResult is the output for bridgeGetSessions.
type GetSettingsInput ¶ added in v0.0.15
type GetSettingsInput struct {
AppID string `json:"appId"`
}
GetSettingsInput is the input for bridgeGetSettings.
type GetSettingsResult ¶ added in v0.0.15
type GetSettingsResult struct {
Settings SettingsDTO `json:"settings"`
}
GetSettingsResult is the output for bridgeGetSettings.
type GetUserSessionsInput ¶ added in v0.0.15
type GetUserSessionsInput struct {
AppID string `json:"appId"`
UserID string `json:"userId"`
Page int `json:"page,omitempty"`
PageSize int `json:"pageSize,omitempty"`
}
GetUserSessionsInput is the input for bridgeGetUserSessions.
type GetUserSessionsResult ¶ added in v0.0.15
type GetUserSessionsResult struct {
Sessions []SessionDTO `json:"sessions"`
UserID string `json:"userId"`
TotalCount int `json:"totalCount"`
ActiveCount int `json:"activeCount"`
Pagination PaginationInfoDTO `json:"pagination"`
}
GetUserSessionsResult is the output for bridgeGetUserSessions.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) GetCurrent ¶ added in v0.0.6
GetCurrent returns details about the currently active session.
func (*Handler) GetStats ¶ added in v0.0.6
GetStats returns aggregated session statistics for the current user.
func (*Handler) RevokeOthers ¶ added in v0.0.6
RevokeOthers revokes all sessions except the current one.
type ListSessionsRequest ¶ added in v0.0.7
type ListSessionsRequest struct {
// Filtering
Active *bool `json:"active" query:"active"`
UserAgent *string `json:"userAgent" query:"user_agent"`
IPAddress *string `json:"ipAddress" query:"ip_address"`
CreatedFrom *string `json:"createdFrom" query:"created_from"`
CreatedTo *string `json:"createdTo" query:"created_to"`
// Sorting
SortBy *string `json:"sortBy" query:"sort_by"`
SortOrder *string `json:"sortOrder" query:"sort_order"`
// Pagination
Limit int `json:"limit" query:"limit"`
Offset int `json:"offset" query:"offset"`
}
ListSessionsRequest represents filtering and pagination options for listing sessions.
type MessageResponse ¶
type MessageResponse = responses.MessageResponse
type MultiSessionErrorResponse ¶
type MultiSessionErrorResponse struct {
Error string `example:"Error message" json:"error"`
}
MultiSessionErrorResponse types for multi-session routes.
type PaginationInfoDTO ¶ added in v0.0.15
type PaginationInfoDTO struct {
CurrentPage int `json:"currentPage"`
PageSize int `json:"pageSize"`
TotalItems int64 `json:"totalItems"`
TotalPages int `json:"totalPages"`
}
PaginationInfoDTO contains pagination metadata.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin wires the multi-session service and registers routes.
func NewPlugin ¶
func NewPlugin(opts ...PluginOption) *Plugin
NewPlugin creates a new multisession plugin instance with optional configuration.
func (*Plugin) DashboardExtension ¶
func (p *Plugin) DashboardExtension() ui.DashboardExtension
DashboardExtension implements the PluginWithDashboardExtension interface This allows the multisession plugin to extend the dashboard with custom screens DashboardExtension lazy initialization to ensure plugin is fully initialized before creating extension.
func (*Plugin) GetAuthService ¶
GetAuthService returns the auth service for testing.
func (*Plugin) RegisterHooks ¶
func (p *Plugin) RegisterHooks(_ *hooks.HookRegistry) error
func (*Plugin) RegisterRoutes ¶
RegisterRoutes mounts endpoints under /api/auth/multi-session.
func (*Plugin) RegisterServiceDecorators ¶
func (p *Plugin) RegisterServiceDecorators(_ *registry.ServiceRegistry) error
type PluginOption ¶
type PluginOption func(*Plugin)
PluginOption is a functional option for configuring the multisession plugin.
func WithAllowCrossPlatform ¶
func WithAllowCrossPlatform(allow bool) PluginOption
WithAllowCrossPlatform sets whether cross-platform sessions are allowed.
func WithDefaultConfig ¶
func WithDefaultConfig(cfg Config) PluginOption
WithDefaultConfig sets the default configuration for the plugin.
func WithEnableDeviceTracking ¶
func WithEnableDeviceTracking(enable bool) PluginOption
WithEnableDeviceTracking sets whether device tracking is enabled.
func WithMaxSessionsPerUser ¶
func WithMaxSessionsPerUser(max int) PluginOption
WithMaxSessionsPerUser sets the maximum concurrent sessions per user.
func WithSessionExpiryHours ¶
func WithSessionExpiryHours(hours int) PluginOption
WithSessionExpiryHours sets the session expiry time.
type RevokeAllRequest ¶ added in v0.0.7
type RevokeAllRequest struct {
IncludeCurrentSession bool `json:"includeCurrentSession"`
}
RevokeAllRequest represents the request to revoke all sessions.
type RevokeAllUserSessionsInput ¶ added in v0.0.15
type RevokeAllUserSessionsInput struct {
AppID string `json:"appId"`
UserID string `json:"userId"`
}
RevokeAllUserSessionsInput is the input for bridgeRevokeAllUserSessions.
type RevokeAllUserSessionsResult ¶ added in v0.0.15
type RevokeAllUserSessionsResult struct {
Success bool `json:"success"`
RevokedCount int `json:"revokedCount"`
Message string `json:"message,omitempty"`
}
RevokeAllUserSessionsResult is the output for bridgeRevokeAllUserSessions.
type RevokeResponse ¶ added in v0.0.7
RevokeResponse represents the response from revoking sessions.
type RevokeSessionInput ¶ added in v0.0.15
RevokeSessionInput is the input for bridgeRevokeSession.
type RevokeSessionResult ¶ added in v0.0.15
type RevokeSessionResult struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
}
RevokeSessionResult is the output for bridgeRevokeSession.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides multi-session operations.
func NewService ¶
func NewService(sr session.Repository, sessionSvc session.ServiceInterface, dr dev.Repository, a *auth.Service, _ any) *Service
func (*Service) CurrentUserFromToken ¶
CurrentUserFromToken validates token and returns userID.
func (*Service) GetCurrent ¶ added in v0.0.6
func (s *Service) GetCurrent(ctx context.Context, userID, sessionID xid.ID) (*session.Session, error)
GetCurrent returns the current session by ID with ownership verification. This is a convenience method that wraps Find to retrieve the active session. Returns an error if the session doesn't exist or doesn't belong to the user.
func (*Service) GetCurrentSessionID ¶ added in v0.0.6
GetCurrentSessionID extracts the session ID from a session token. It validates the token and returns the associated session ID. Returns an error if the token is invalid or expired.
func (*Service) GetStats ¶ added in v0.0.6
GetStats returns aggregated session statistics for a user. Calculates total and active session counts, unique device and location counts, and identifies the oldest and newest sessions. Useful for security dashboards and user account management interfaces. Returns SessionStats containing all aggregated data or an error if retrieval fails.
func (*Service) List ¶
func (s *Service) List(ctx context.Context, userID xid.ID, req *ListSessionsRequest) (*session.ListSessionsResponse, error)
List returns all sessions for a user with optional filtering.
func (*Service) RefreshCurrent ¶ added in v0.0.6
func (s *Service) RefreshCurrent(ctx context.Context, userID, sessionID xid.ID) (*session.Session, error)
RefreshCurrent extends the current session's expiry time using the sliding session pattern. This updates the session's expiration timestamp to prevent automatic logout during active use. Returns the updated session with the new expiry time or an error if the refresh fails.
func (*Service) RevokeAll ¶ added in v0.0.6
func (s *Service) RevokeAll(ctx context.Context, userID xid.ID, includeCurrentSession bool, currentSessionID xid.ID) (int, error)
RevokeAll revokes all sessions for a user with optional current session inclusion. If includeCurrentSession is false, the current session specified by currentSessionID is preserved. Returns the count of successfully revoked sessions and any error encountered. Use case: Sign out from all devices, or sign out everywhere except current device.
func (*Service) RevokeAllExceptCurrent ¶ added in v0.0.6
func (s *Service) RevokeAllExceptCurrent(ctx context.Context, userID, currentSessionID xid.ID) (int, error)
RevokeAllExceptCurrent revokes all sessions except the current one. This is commonly used after password changes or when suspicious activity is detected to ensure security while keeping the user logged in on their current device. Returns the count of successfully revoked sessions and any error encountered.
type SessionDTO ¶ added in v0.0.15
type SessionDTO struct {
ID string `json:"id"`
UserID string `json:"userId"`
UserEmail string `json:"userEmail,omitempty"`
IPAddress string `json:"ipAddress"`
UserAgent string `json:"userAgent"`
DeviceType string `json:"deviceType"` // mobile, desktop, tablet, bot
DeviceInfo string `json:"deviceInfo"` // Short device description
Browser string `json:"browser"`
BrowserVer string `json:"browserVersion"`
OS string `json:"os"`
OSVersion string `json:"osVersion"`
Status string `json:"status"` // active, expiring, expired
IsActive bool `json:"isActive"`
IsExpiring bool `json:"isExpiring"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt time.Time `json:"expiresAt"`
LastUsed string `json:"lastUsed"` // Relative time string
ExpiresIn string `json:"expiresIn"` // Relative time string
}
SessionDTO represents a session in list views.
type SessionDetailDTO ¶ added in v0.0.15
type SessionDetailDTO struct {
ID string `json:"id"`
UserID string `json:"userId"`
UserEmail string `json:"userEmail,omitempty"`
AppID string `json:"appId"`
OrganizationID string `json:"organizationId,omitempty"`
EnvironmentID string `json:"environmentId,omitempty"`
IPAddress string `json:"ipAddress"`
UserAgent string `json:"userAgent"`
DeviceType string `json:"deviceType"`
DeviceInfo string `json:"deviceInfo"`
Browser string `json:"browser"`
BrowserVer string `json:"browserVersion"`
OS string `json:"os"`
OSVersion string `json:"osVersion"`
Status string `json:"status"`
IsActive bool `json:"isActive"`
IsExpiring bool `json:"isExpiring"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
ExpiresAt time.Time `json:"expiresAt"`
LastRefreshedAt *time.Time `json:"lastRefreshedAt,omitempty"`
CreatedAtFmt string `json:"createdAtFormatted"`
UpdatedAtFmt string `json:"updatedAtFormatted"`
ExpiresAtFmt string `json:"expiresAtFormatted"`
LastRefreshedFmt string `json:"lastRefreshedFormatted,omitempty"`
}
SessionDetailDTO represents detailed session information.
type SessionStats ¶ added in v0.0.6
type SessionStats struct {
TotalSessions int // Total number of sessions (active + expired)
ActiveSessions int // Number of currently active (non-expired) sessions
DeviceCount int // Number of unique devices
LocationCount int // Number of unique IP addresses (proxy for locations)
OldestSession *session.Session // Oldest session by creation time
NewestSession *session.Session // Newest session by creation time
}
SessionStats holds aggregated session statistics for a user. Provides an overview of the user's session landscape including counts, unique devices, unique locations (based on IP addresses), and session age range.
type SessionStatsDTO ¶ added in v0.0.15
type SessionStatsDTO struct {
TotalSessions int64 `json:"totalSessions"`
ActiveCount int `json:"activeCount"`
ExpiringCount int `json:"expiringCount"`
ExpiredCount int `json:"expiredCount"`
MobileCount int `json:"mobileCount"`
DesktopCount int `json:"desktopCount"`
TabletCount int `json:"tabletCount"`
UniqueUsers int `json:"uniqueUsers"`
}
SessionStatsDTO contains session statistics.
type SessionStatsResponse ¶ added in v0.0.6
type SessionStatsResponse struct {
TotalSessions int `json:"totalSessions"`
ActiveSessions int `json:"activeSessions"`
DeviceCount int `json:"deviceCount"`
LocationCount int `json:"locationCount"`
OldestSession *string `json:"oldestSession,omitempty"` // ISO8601 timestamp
NewestSession *string `json:"newestSession,omitempty"` // ISO8601 timestamp
}
SessionStatsResponse represents aggregated session statistics.
type SessionTokenResponse ¶
type SessionsResponse ¶
type SessionsResponse = session.ListSessionsResponse
type SetActiveRequest ¶ added in v0.0.7
type SetActiveRequest struct {
ID string `json:"id"`
}
SetActiveRequest represents the request to set an active session.
type SettingsDTO ¶ added in v0.0.15
type SettingsDTO struct {
MaxSessionsPerUser int `json:"maxSessionsPerUser"`
SessionExpiryHours int `json:"sessionExpiryHours"`
EnableDeviceTracking bool `json:"enableDeviceTracking"`
AllowCrossPlatform bool `json:"allowCrossPlatform"`
}
SettingsDTO represents plugin settings.
type StatusResponse ¶
type StatusResponse = responses.StatusResponse
type UpdateSettingsInput ¶ added in v0.0.15
type UpdateSettingsInput struct {
AppID string `json:"appId"`
MaxSessionsPerUser int `json:"maxSessionsPerUser,omitempty"`
SessionExpiryHours int `json:"sessionExpiryHours,omitempty"`
EnableDeviceTracking *bool `json:"enableDeviceTracking,omitempty"`
AllowCrossPlatform *bool `json:"allowCrossPlatform,omitempty"`
}
UpdateSettingsInput is the input for bridgeUpdateSettings.
type UpdateSettingsResult ¶ added in v0.0.15
type UpdateSettingsResult struct {
Success bool `json:"success"`
Settings SettingsDTO `json:"settings"`
Message string `json:"message,omitempty"`
}
UpdateSettingsResult is the output for bridgeUpdateSettings.