Documentation ¶
Index ¶
- func DefaultUnauthorizedHandler(w http.ResponseWriter, req *http.Request)
- func Time() string
- type Activity
- type BearerGetter
- type ClaimGetter
- type ClaimSetter
- type Credentials
- type JwtStore
- type JwtToken
- type Token
- type TokenAuth
- func (t *TokenAuth) Audit(r *http.Request) (string, string, error)
- func (t *TokenAuth) AuditToken(strToken string) (string, string, error)
- func (t *TokenAuth) Authenticate(r *http.Request) (Token, error)
- func (t *TokenAuth) Authorize() func(w http.ResponseWriter, r *http.Request)
- func (t *TokenAuth) Available() func(w http.ResponseWriter, r *http.Request)
- func (t *TokenAuth) Create(w http.ResponseWriter, r *http.Request)
- func (t *TokenAuth) NewPassword(w http.ResponseWriter, r *http.Request)
- func (t *TokenAuth) Profile() func(w http.ResponseWriter, r *http.Request)
- func (t *TokenAuth) Register(w http.ResponseWriter, r *http.Request)
- func (t *TokenAuth) Routes(server *ooo.Server)
- func (t *TokenAuth) User(w http.ResponseWriter, r *http.Request)
- func (t *TokenAuth) Users() func(w http.ResponseWriter, r *http.Request)
- func (t *TokenAuth) Verify(req *http.Request) bool
- type TokenGetter
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultUnauthorizedHandler ¶
func DefaultUnauthorizedHandler(w http.ResponseWriter, req *http.Request)
DefaultUnauthorizedHandler :
Types ¶
type Activity ¶
type Activity struct {
LastEntry int64 `json:"lastEntry"`
}
Activity keeps the time of the last entry
type BearerGetter ¶
type BearerGetter struct {
Header string
}
BearerGetter :
func NewHeaderBearerTokenGetter ¶
func NewHeaderBearerTokenGetter(header string) *BearerGetter
NewHeaderBearerTokenGetter :
func (*BearerGetter) GetTokenFromRequest ¶
func (b *BearerGetter) GetTokenFromRequest(req *http.Request) string
GetTokenFromRequest :
type ClaimSetter ¶
type ClaimSetter interface {
SetClaim(string, interface{}) ClaimSetter
}
ClaimSetter :
type Credentials ¶
type Credentials struct { Account string `json:"account"` Password string `json:"password,omitempty"` Token string `json:"token"` Role string `json:"role"` }
Credentials :
type JwtStore ¶
type JwtStore struct {
// contains filtered or unexported fields
}
JwtStore :
func NewJwtStore ¶
NewJwtStore :
func (*JwtStore) CheckToken ¶
CheckToken :
type JwtToken ¶
JwtToken :
func (*JwtToken) SetClaim ¶
func (t *JwtToken) SetClaim(key string, value interface{}) ClaimSetter
SetClaim :
type TokenAuth ¶
type TokenAuth struct { // contains filtered or unexported fields }
TokenAuth :
func New ¶
New :
Returns a TokenAuth object implemting Handler interface ¶
if a handler is given it proxies the request to the handler
if a unauthorizedHandler is provided, unauthorized requests
will be handled by this HandlerFunc, otherwise a default
unauthorized handler is used.
store is the TokenStore that stores and verify the tokens
func (*TokenAuth) AuditToken ¶
func (*TokenAuth) Authenticate ¶
Authenticate :
func (*TokenAuth) Authorize ¶
func (t *TokenAuth) Authorize() func(w http.ResponseWriter, r *http.Request)
Authorize will claim a token on POST and refresh the claim on PUT
func (*TokenAuth) Available ¶
func (t *TokenAuth) Available() func(w http.ResponseWriter, r *http.Request)
Available will check if an account is taken
func (*TokenAuth) Create ¶
func (t *TokenAuth) Create(w http.ResponseWriter, r *http.Request)
Create will create a new user (root only access)
func (*TokenAuth) NewPassword ¶
func (t *TokenAuth) NewPassword(w http.ResponseWriter, r *http.Request)
NewPassword is for updating account password
func (*TokenAuth) Profile ¶
func (t *TokenAuth) Profile() func(w http.ResponseWriter, r *http.Request)
Profile returns to the client the correspondent user profile for the token provided
func (*TokenAuth) Register ¶
func (t *TokenAuth) Register(w http.ResponseWriter, r *http.Request)
Register will create a new user with the default user role (open route)
func (*TokenAuth) User ¶
func (t *TokenAuth) User(w http.ResponseWriter, r *http.Request)
User will send the user list to a root user
type TokenGetter ¶
TokenGetter :