Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Credential ¶
type Credential interface { // AddAuthorization adds authorization information to request AddAuthorization(req *http.Request) }
Credential ...
func NewBasicAuthCredential ¶
func NewBasicAuthCredential(username, password string) Credential
NewBasicAuthCredential ...
type Handler ¶
type Handler interface { // Schema : basic, bearer Schema() string //AuthorizeRequest adds basic auth or token auth to the header of request AuthorizeRequest(req *http.Request, params map[string]string) error }
Handler authorizes the request when encounters a 401 error
func NewStandardTokenHandler ¶
func NewStandardTokenHandler(credential Credential) Handler
NewStandardTokenHandler returns a standard token handler. The handler will request a token from token server whose URL is specified in the "WWW-authentication" header and add it to the origin request TODO deal with https
func NewUsernameTokenHandler ¶
NewUsernameTokenHandler returns a handler which will generate a token according the user's privileges
Click to show internal directories.
Click to hide internal directories.