authsrv

package
v0.0.0-...-52789aa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2018 License: BSD-3-Clause Imports: 7 Imported by: 5

Documentation

Overview

Package authsrv handle authorization token operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BearerTokensFromRefresh

func BearerTokensFromRefresh(refreshToken string) (*models.BearerToken, error)

BearerTokensFromRefresh return a new AccessToken

func BearerTokensFromUser

func BearerTokensFromUser(user *models.User) (*models.BearerToken, error)

BearerTokensFromUser return both new Access and Refresh tokens.

func GetToken

func GetToken(tokenString string) (*jwt.Token, error)

GetToken return a token from a accessToken string. Return nil if the accessToken string is invalid or if the token as expired.

func HasRole

func HasRole(role string, token *jwt.Token) bool

HasRole check if the token as a role.

func RevokeRefreshTokenFromAccess

func RevokeRefreshTokenFromAccess(token *jwt.Token) error

RevokeRefreshTokenFromAccess remove a RefreshToken from DB from an accessToken

func Roles

func Roles(token *jwt.Token) []string

Roles return the roles from a token.

func UserID

func UserID(token *jwt.Token) string

UserID return the user id from a token.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL