Documentation ¶
Overview ¶
Provides the structs and function to verify and extract a token and check if the token can use the resources he wants
Index ¶
Constants ¶
View Source
const ( // SuperAdminRole - Super Admin Role SuperAdminRole = "SuperAdmin" // AdminRole - Admin Role AdminRole = "Admin" // ClientRole - Client Role ClientRole = "Client" )
All available roles
Variables ¶
This section is empty.
Functions ¶
func CreateToken ¶
func CreateToken(clientID string, role string, appID string, expire *jwt.NumericDate) (string, error)
CreateToken - Create token with given info
func GetAuthData ¶
GetAuthData - Get AppID and Authorization
Types ¶
type Identity ¶
Identity - Data in JWT token
func AuthenticateAdmin ¶
AuthenticateAdmin - Check if token is valid and is admin kind
func GetTokenAndVerify ¶
func VerifyToken ¶
VerifyToken - Check token validity and payload
func (*Identity) CanUseAppID ¶
CanUseAppID - Check if user can use given AppID
func (*Identity) IsAdminKind ¶
IsAdminKind - Check if is Super Admin or Admin
func (*Identity) IsSuperAdmin ¶
IsSuperAdmin - Check if client is a Super Admin
Click to show internal directories.
Click to hide internal directories.