Documentation ¶
Index ¶
- Variables
- func AuthDenied(res http.ResponseWriter, req *http.Request)
- func AuthRequired(res http.ResponseWriter, req *http.Request)
- func Authenticate() martini.Handler
- func ComputeHmacSHA1(message string, secret string) string
- func CorsHandler() martini.Handler
- func CreateNewToken(tr *TokenRequest) (token string, err error)
- func NotAuthRequired(res http.ResponseWriter, req *http.Request)
- func NotRequired() martini.Handler
- func Required() martini.Handler
- func SetAppAuthHandler(newHandler AppAuthHandler)
- type AppAuthHandler
- type TokenInfo
- type TokenRequest
- type TokenResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultAuthType string = "MCAA"
* Just an identifier -- nothing special about it.
Functions ¶
func AuthDenied ¶
func AuthDenied(res http.ResponseWriter, req *http.Request)
func AuthRequired ¶
func AuthRequired(res http.ResponseWriter, req *http.Request)
func Authenticate ¶
* Before access is granted to protected areas, the person * must call a method that invokes the 'Authenticate' method * which will generate and return a token to the requester * provided that authenticate and are granted access.
func ComputeHmacSHA1 ¶
func CorsHandler ¶
func CreateNewToken ¶
func CreateNewToken(tr *TokenRequest) (token string, err error)
func NotAuthRequired ¶
func NotAuthRequired(res http.ResponseWriter, req *http.Request)
func NotRequired ¶
func SetAppAuthHandler ¶
func SetAppAuthHandler(newHandler AppAuthHandler)
Types ¶
type AppAuthHandler ¶
* Signature and method used to authenticate a user * which is usually a callback to user code
type TokenInfo ¶
type TokenInfo struct { Request *TokenRequest Response *TokenResponse Nonce int64 }
type TokenRequest ¶
type TokenRequest struct { AppKey string // well-known key embedded in the application AppHash string UserKey string // Username and userKey are supplied by client via user entry UserHash string Nonce int64 // likey the unix time; variable to help prevent signature duplication (throwat replay attacks) Signature string }
* Token management
func (TokenRequest) ComputeHash ¶
func (tr TokenRequest) ComputeHash(key, secret string) string
func (TokenRequest) ComputeSignature ¶
func (tr TokenRequest) ComputeSignature() string
func (*TokenRequest) Sign ¶
func (tr *TokenRequest) Sign()
type TokenResponse ¶
func (TokenResponse) AuthHeaderString ¶
func (tr TokenResponse) AuthHeaderString(secret string, nonce string) string
func (TokenResponse) ComputeSignature ¶
func (tr TokenResponse) ComputeSignature(secret string, nonce string) string
Click to show internal directories.
Click to hide internal directories.