Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateJWT ¶
GenerateJWT used to generate a JWT based on the given claims and expiry in minutes
Types ¶
type Handler ¶
type Handler struct { Path string Handler func(http.ResponseWriter, *http.Request) Permissions Type RequestedResourceID string }
Handler represents a protected route
type JWTClaims ¶
type JWTClaims struct { Username string `json:"username"` Type string `json:"type"` Permissions map[string][]string `json:"permissions"` jwt.StandardClaims }
JWTClaims represents the claims in the JWT
type Type ¶
type Type uint64
Type representing the required level (need to be admin, user, service account) to access a resource
const ( // AuthTypeUser means that a user account is required to access a resource AuthTypeUser Type = 1 << iota // AuthTypeAdmin means that an admin account is required to access a resource AuthTypeAdmin Type = 2 // AuthTypeServiceAccount means that a service account is required to access a resource AuthTypeServiceAccount Type = 4 // AuthTypeAll means that any account type can access the ressource (anonymous not allowed) AuthTypeAll Type = 8 )
Click to show internal directories.
Click to hide internal directories.