Discover Packages
corelab.mkcl.org/MKCLOS/coredevelopmentplatform/corepkgv2/v2
authmdl
sessionmdl
package
Version:
v2.0.0-beta.1
Opens a new window with list of versions in this module.
Published: Dec 28, 2020
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
View Source
var (
ErrUserNotFound = errors .New ("user not found")
ErrSessionNotFound = errors .New ("session not found")
ErrInvalidSessionInstance = errors .New ("got invalid session instance id")
ErrSessionValidationFailed = errors .New ("session validation failed")
)
func CheckForSessionAvailability(userId, sessionFor string ) bool
CheckForSessionAvailability checks if the user has active session for provided `sessionFor`. Returns true if session is available.
Delete removes all the sessions associated with the user.
func DeleteSession(userId, sessionFor string )
DeleteSession removes a particular session for user, if present.
Init initializes sessions with provided cache. Subsequent calls will not have any effect after first initialization.
Set stores the sessions for provided userId. Session is appended to the list. It does not check if the same session exists or not.
func ValidateSessionFromToken(claims map[string ]interface{}) error
ValidateSessionFromToken checks for session id in claims against available sessions.
Validate only if a nonempty `sessionId` is present. The claims must contain `userId` field if session is present.
Get returns all the available sessions for the user. This may contain expired but not deleted sessions.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.