Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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) (*SessionManagerTokenClaims, error)
Parse tries to parse the provided string and returns the token claims.
type SessionManagerTokenClaims ¶
type SessionManagerTokenClaims struct { //Foo string `json:"foo"` jwt.StandardClaims }
SessionManagerTokenClaims holds claim metadata for a token.
Click to show internal directories.
Click to hide internal directories.