Documentation ¶
Index ¶
- func MakeCookieMetadata(key, value string, flags ...string) string
- func MakeSignature(size int) ([]byte, error)
- type SessionManager
- func (mgr SessionManager) Create(subject string) (string, error)
- func (mgr SessionManager) LoginLocalUser(username, password string, users map[string]string) (string, error)
- func (mgr SessionManager) Parse(tokenString string) (jwt.Claims, error)
- func (mgr SessionManager) SignClaims(claims jwt.Claims) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeCookieMetadata ¶ added in v0.3.3
MakeCookieMetadata generates a string representing a Web cookie. Yum!
func MakeSignature ¶
MakeSignature generates a cryptographically-secure pseudo-random token, based on a given number of random bytes, for signing purposes.
Types ¶
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
SessionManager generates and validates JWT tokens for login sessions.
func MakeSessionManager ¶
func MakeSessionManager(secretKey []byte) SessionManager
MakeSessionManager creates a new session manager with the given secret key.
func (SessionManager) Create ¶
func (mgr SessionManager) Create(subject string) (string, error)
Create creates a new token for a given subject (user) and returns it as a string.
func (SessionManager) LoginLocalUser ¶
func (mgr SessionManager) LoginLocalUser(username, password string, users map[string]string) (string, error)
LoginLocalUser checks if a username/password combo is correct and creates a new token if so. [TODO] This may belong elsewhere.
func (SessionManager) Parse ¶
func (mgr SessionManager) Parse(tokenString string) (jwt.Claims, error)
Parse tries to parse the provided string and returns the token claims.
func (SessionManager) SignClaims ¶ added in v0.3.3
func (mgr SessionManager) SignClaims(claims jwt.Claims) (string, error)
Click to show internal directories.
Click to hide internal directories.