Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authed ¶
func Authed(wrap AuthedFunction, ath Auther) restful.RouteFunction
Pull the "Authorization" header from the request and check if the token can be parsed. If true, delegate to the wrapped function, otherwise send a unauthorized.
Types ¶
type AuthUser ¶
type AuthUser struct { Network string `json:"network"` Uid string `json:"uid"` Name string `json:"name"` BackgroundUrl string `json:"backgroundurl"` ThumbnailUrl string `json:"thumbnail"` }
An AuthUser is a Uid and a Name. The BackgroundUrl and the ThumbnailUrl is optional an can be empty
type AuthedFunction ¶
type AuthedFunction func(ath *AuthUser, request *restful.Request, response *restful.Response)
Signature for a restful function which needs an authenticated user
type Auther ¶
type Auther interface { // Return a JWT token out of a given auth'd user Create(network, authCode, redirectUrl string) (string, Token, *AuthUser, error) // Read the User out of the JWT token Get(token string) (*AuthUser, error) }
A Auther creates an AuthUser from a network and an access_token for this network.
type AutherService ¶
type AutherService struct {
Auth Auther
}
The rest service
func (*AutherService) Register ¶
func (t *AutherService) Register(root string, c *restful.Container)
Rest interface description
Click to show internal directories.
Click to hide internal directories.