Documentation ¶
Index ¶
- func CreateSessionJWTToken(SigningKey string, sessionTkn Token) (string, error)
- func DecodeJWTToken(signKey string, tknStr string) (jwt.Token, error)
- func DecodeJWTWithPubKey(pubKey string, tknStr string) (claims jwt.Claims, err error)
- func DecodePublicKey(str string) (*rsa.PublicKey, error)
- func Delete(id string) error
- func Exist(id string) bool
- func IsValidTokenFormat(tkn string) bool
- func ParseTokenTypeAndValue(tkn string) (tokenType string, tokenValue string)
- func Save(session Session) error
- type Claims
- type CustomClaims
- type Session
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSessionJWTToken ¶
CreateSessionJWTToken creates a new jwt token used in a user session instance
func DecodeJWTToken ¶
DecodeJWTToken decodes a jwt token using the signing key
func DecodeJWTWithPubKey ¶
DecodeJWTWithPubKey gets the claims of a jwt auth token
func DecodePublicKey ¶
DecodePublicKey decodes an ssh-rsa string into rsa public key
func IsValidTokenFormat ¶
IsValidTokenFormat checks if a token is a well formatted Bearer token
func ParseTokenTypeAndValue ¶
ParseTokenTypeAndValue returns the type and value of a jwt token
Types ¶
type Claims ¶
type Claims struct { Phrase string `json:"phrase"` jwt.StandardClaims }
Claims custom claims for user authentication
func VerifyAuthTokenWithAuthorizedKeys ¶
VerifyAuthTokenWithAuthorizedKeys gets the auth claims from jwt token using an authorized key from server
type CustomClaims ¶
type CustomClaims struct { Data interface{} `json:"data"` jwt.StandardClaims }
CustomClaims custom claims for request
type Session ¶
type Session struct { ID string `json:"id"` User string `json:"user"` Token string `json:"token"` ExpiresAt string `json:"expires_at"` }
Session represents an authenticated user session
func GetAllSessions ¶
GetAllSessions returns all user sessions
func GetSessionByID ¶
GetSessionByID returns a user session by id
type Token ¶
type Token struct {
SessionID string `json:"session_id"` // uuid identifying the session jwt
}
Token for an authenticated session
func ParseSessionTokenFromJWTClaims ¶
ParseTokenTypeAndValue returns the session token within the jwt claims