Documentation ¶
Index ¶
- Constants
- func AuthHandler(response http.ResponseWriter, request *http.Request, ...)
- func GenerateJWTToken(subject string, extraTime time.Duration) (tokenString string, err error)
- func GetEncodedPassword(username *string) (password string, err error)
- func GoAuthMiddleWare(CH GoAuthHandler) httprouter.Handle
- func JSONError(response http.ResponseWriter, errorString string, statusCode int)
- type AccessToken
- type GoAuthHandler
- type InMemoryDatabase
- type Permission
- type User
Constants ¶
View Source
const ( //JWTSecret Secret for creating JTW token - sha512sum da música "A lua me traiu, da 'Banca Calypso'" JWTSecret string = "" /* 128-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func AuthHandler ¶
func AuthHandler(response http.ResponseWriter, request *http.Request, routeParams httprouter.Params, jsonParams map[string]interface{})
AuthHandler Handles authorization
func GenerateJWTToken ¶
GenerateJWTToken Generates the authenticaton token (JWT)
func GetEncodedPassword ¶
GetEncodedPassword Returns the encoded user password from DB
func GoAuthMiddleWare ¶
func GoAuthMiddleWare(CH GoAuthHandler) httprouter.Handle
GoAuthMiddleWare Default Middleware
Types ¶
type AccessToken ¶
type AccessToken struct {
AccessToken string `json:"access_token"`
}
AccessToken Representation for the return of AuthHandler
type GoAuthHandler ¶
type GoAuthHandler func( response http.ResponseWriter, request *http.Request, routeParams httprouter.Params, jsonParams map[string]interface{})
GoAuthHandler Type for using to route callbacks
type InMemoryDatabase ¶
type InMemoryDatabase struct { Permissions []Permission Users map[string]User }
InMemoryDatabase "De facto" where to search for information
type Permission ¶
type Permission struct {
Name string
}
Permission Struct defining permission's fields
Click to show internal directories.
Click to hide internal directories.