Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidAuthentication indicates an invalid authentication ErrInvalidAuthentication = errors.New("invalid authentication") )
Functions ¶
func WriteError ¶
func WriteError(err error, response *restful.Response)
Write error in good http format with error stack in it
Types ¶
type API ¶
type API struct { CRTData []byte Authenticator Authenticator PublicKey interface{} PrivateKey interface{} SigningMethod jwt.SigningMethod TokenDuration time.Duration }
API registering with restful
type AuthResponse ¶
AuthResponse is a simple JWT authn response
type Authenticator ¶
type Authenticator interface {
Authenticate(user, password string, expiresAt time.Time) (claims jwt.Claims, err error)
}
Authenticator is the interface for authn backends
type KeystoneAuth ¶
type KeystoneAuth struct { Identity struct { Methods []string `json:"methods"` Password struct { User struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Password string `json:"password"` Domain struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` } `json:"domain"` } `json:"user"` } `json:"password"` } `json:"identity"` }
KeystoneAuth is a Keystone API like auth
type KeystoneAuthReq ¶
type KeystoneAuthReq struct {
Auth *KeystoneAuth `json:"auth"`
}
KeystoneAuthReq is a Keystone API like auth request
type KeystoneAuthResponse ¶
type KeystoneAuthResponse struct { Token struct { IssuedAt time.Time `json:"issued_at"` ExpiresAt time.Time `json:"expires_at"` User struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` } `json:"user"` } `json:"token"` }
KeystoneAuthResponse is a Keystone API like auth response
Click to show internal directories.
Click to hide internal directories.