Documentation
¶
Index ¶
- func Admin(handlerFunc http.HandlerFunc) http.HandlerFunc
- func Auth(handlerFunc http.HandlerFunc) http.HandlerFunc
- func Check(token string) (user *database.User, expiration time.Time, err error)
- func SaveUser(user *database.User) error
- func Serve(args context.ServiceArguments) (context.ServiceResult, error)
- type AdminUser
- type Credentials
- type JWTHeader
- type JWTPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Admin ¶
func Admin(handlerFunc http.HandlerFunc) http.HandlerFunc
Checks if user is admin. If not, the handlerFunc won't be called.
func Auth ¶
func Auth(handlerFunc http.HandlerFunc) http.HandlerFunc
Checks if user is logged in. If not, the handlerFunc won't be called.
func Check ¶
Checks, if the given JWT is valid. Returns true if it is valid. Returns the user which belongs to the JWT. If the JWT is not valid, the user will be nil.
func Serve ¶
func Serve(args context.ServiceArguments) (context.ServiceResult, error)
Serve function for this package.
Types ¶
type Credentials ¶
use for plainttext passwords only
Click to show internal directories.
Click to hide internal directories.