Documentation
¶
Index ¶
- Constants
- func AddHandler(app *appsrv.Application)
- func AuthenticateV3(ctx context.Context, input mcclient.SAuthenticationInputV3) (*mcclient.TokenCredentialV3, error)
- func FernetTokenVerifier(ctx context.Context, tokenStr string) (mcclient.TokenCredential, error)
- func FetchAuthContext(authCtx mcclient.SAuthContext, r *http.Request) mcclient.SAuthContext
- func GetDefaulAdminSession(ctx context.Context, region string) (*mcclient.ClientSession, error)
- func GetDefaultAdminCredToken() mcclient.TokenCredential
- func GetDefaultToken() string
- type ITokenPayload
- type SAuthContextPayload
- type SAuthToken
- type SAuthenticateV2ResponseBody
- type SDomainScopedPayload
- type SDomainScopedPayloadWithContext
- type SProjectScopedPayload
- type SProjectScopedPayloadWithContext
- type SUnscopedPayload
- type SUnscopedPayloadWithContext
- type SUuidPayload
- type TScopedPayloadVersion
- type VerifyTokenV2Param
- type VerifyTokenV3Param
Constants ¶
View Source
const ( ErrVerMismatch = errors.Error("[auth] version mismatch") ErrProjectDisabled = errors.Error("[auth] project disabled") ErrUserDisabled = errors.Error("[auth] user disabled") ErrInvalidToken = errors.Error("[auth] invalid token") ErrExpiredToken = errors.Error("[auth] expired token") ErrInvalidFernetToken = errors.Error("[auth] invalid fernet token") ErrInvalidAuthMethod = errors.Error("[auth] invalid auth methods") ErrUserNotFound = errors.Error("[auth] user not found") ErrDomainDisabled = errors.Error("[auth] domain is disabled") ErrEmptyAuth = errors.Error("[auth] empty auth request") ErrUserNotInProject = errors.Error("[auth] user not in project") ErrInvalidAccessKeyId = errors.Error("[auth] invalid access key id") ErrExpiredAccessKey = errors.Error("[auth] expired access key") ErrTokenNotFound = errors.Error("[auth] token not found") )
View Source
const ( SProjectScopedPayloadVersion = TScopedPayloadVersion(2) SDomainScopedPayloadVersion = TScopedPayloadVersion(1) SUnscopedPayloadVersion = TScopedPayloadVersion(0) SProjectScopedPayloadWithContextVersion = TScopedPayloadVersion(5) SDomainScopedPayloadWithContextVersion = TScopedPayloadVersion(4) SUnscopedPayloadWithContextVersion = TScopedPayloadVersion(3) )
Variables ¶
This section is empty.
Functions ¶
func AddHandler ¶
func AddHandler(app *appsrv.Application)
func AuthenticateV3 ¶
func AuthenticateV3(ctx context.Context, input mcclient.SAuthenticationInputV3) (*mcclient.TokenCredentialV3, error)
keystone v3认证API
func FernetTokenVerifier ¶
func FetchAuthContext ¶
func FetchAuthContext(authCtx mcclient.SAuthContext, r *http.Request) mcclient.SAuthContext
func GetDefaulAdminSession ¶
func GetDefaultAdminCredToken ¶
func GetDefaultAdminCredToken() mcclient.TokenCredential
func GetDefaultToken ¶
func GetDefaultToken() string
Types ¶
type ITokenPayload ¶
type ITokenPayload interface {
Unmarshal(tk []byte) error
Decode(token *SAuthToken)
Encode() ([]byte, error)
GetVersion() TScopedPayloadVersion
}
type SAuthContextPayload ¶
type SAuthToken ¶
type SAuthToken struct {
UserId string
Method string
ProjectId string
DomainId string
ExpiresAt time.Time
AuditIds []string
Context mcclient.SAuthContext
}
func TokenStrDecode ¶
func TokenStrDecode(ctx context.Context, tokenStr string) (*SAuthToken, error)
func (*SAuthToken) Decode ¶
func (t *SAuthToken) Decode(tk []byte) error
func (*SAuthToken) Encode ¶
func (t *SAuthToken) Encode() ([]byte, error)
func (*SAuthToken) GetSimpleUserCred ¶
func (t *SAuthToken) GetSimpleUserCred(token string) (mcclient.TokenCredential, error)
func (*SAuthToken) IsExpired ¶
func (t *SAuthToken) IsExpired() bool
func (*SAuthToken) ValidDuration ¶
func (t *SAuthToken) ValidDuration() time.Duration
type SAuthenticateV2ResponseBody ¶
type SAuthenticateV2ResponseBody struct {
Access mcclient.TokenCredentialV2 `json:"access"`
}
func AuthenticateV2 ¶
func AuthenticateV2(ctx context.Context, input mcclient.SAuthenticationInputV2) (*SAuthenticateV2ResponseBody, error)
keystone v2 认证接口,通过用户名/密码或者 token 认证
type SDomainScopedPayload ¶
type SDomainScopedPayload struct {
Version TScopedPayloadVersion
UserId SUuidPayload
Method byte
DomainId SUuidPayload
ExpiresAt float64
AuditIds []string
}
func (*SDomainScopedPayload) Decode ¶
func (p *SDomainScopedPayload) Decode(token *SAuthToken)
func (*SDomainScopedPayload) Encode ¶
func (p *SDomainScopedPayload) Encode() ([]byte, error)
func (*SDomainScopedPayload) GetVersion ¶
func (p *SDomainScopedPayload) GetVersion() TScopedPayloadVersion
func (*SDomainScopedPayload) Unmarshal ¶
func (p *SDomainScopedPayload) Unmarshal(tk []byte) error
type SDomainScopedPayloadWithContext ¶
type SDomainScopedPayloadWithContext struct {
SDomainScopedPayload
Context SAuthContextPayload
}
func (*SDomainScopedPayloadWithContext) Decode ¶
func (p *SDomainScopedPayloadWithContext) Decode(token *SAuthToken)
func (*SDomainScopedPayloadWithContext) Encode ¶
func (p *SDomainScopedPayloadWithContext) Encode() ([]byte, error)
func (*SDomainScopedPayloadWithContext) Unmarshal ¶
func (p *SDomainScopedPayloadWithContext) Unmarshal(tk []byte) error
type SProjectScopedPayload ¶
type SProjectScopedPayload struct {
Version TScopedPayloadVersion
UserId SUuidPayload
Method byte
ProjectId SUuidPayload
ExpiresAt float64
AuditIds []string
}
* msgpack payload * * https://github.com/msgpack/msgpack/blob/master/spec.md
func (*SProjectScopedPayload) Decode ¶
func (p *SProjectScopedPayload) Decode(token *SAuthToken)
func (*SProjectScopedPayload) Encode ¶
func (p *SProjectScopedPayload) Encode() ([]byte, error)
func (*SProjectScopedPayload) GetVersion ¶
func (p *SProjectScopedPayload) GetVersion() TScopedPayloadVersion
func (*SProjectScopedPayload) Unmarshal ¶
func (p *SProjectScopedPayload) Unmarshal(tk []byte) error
type SProjectScopedPayloadWithContext ¶
type SProjectScopedPayloadWithContext struct {
SProjectScopedPayload
Context SAuthContextPayload
}
func (*SProjectScopedPayloadWithContext) Decode ¶
func (p *SProjectScopedPayloadWithContext) Decode(token *SAuthToken)
func (*SProjectScopedPayloadWithContext) Encode ¶
func (p *SProjectScopedPayloadWithContext) Encode() ([]byte, error)
func (*SProjectScopedPayloadWithContext) Unmarshal ¶
func (p *SProjectScopedPayloadWithContext) Unmarshal(tk []byte) error
type SUnscopedPayload ¶
type SUnscopedPayload struct {
Version TScopedPayloadVersion
UserId SUuidPayload
Method byte
ExpiresAt float64
AuditIds []string
}
func (*SUnscopedPayload) Decode ¶
func (p *SUnscopedPayload) Decode(token *SAuthToken)
func (*SUnscopedPayload) Encode ¶
func (p *SUnscopedPayload) Encode() ([]byte, error)
func (*SUnscopedPayload) GetVersion ¶
func (p *SUnscopedPayload) GetVersion() TScopedPayloadVersion
func (*SUnscopedPayload) Unmarshal ¶
func (p *SUnscopedPayload) Unmarshal(tk []byte) error
type SUnscopedPayloadWithContext ¶
type SUnscopedPayloadWithContext struct {
SUnscopedPayload
Context SAuthContextPayload
}
func (*SUnscopedPayloadWithContext) Decode ¶
func (p *SUnscopedPayloadWithContext) Decode(token *SAuthToken)
func (*SUnscopedPayloadWithContext) Encode ¶
func (p *SUnscopedPayloadWithContext) Encode() ([]byte, error)
func (*SUnscopedPayloadWithContext) Unmarshal ¶
func (p *SUnscopedPayloadWithContext) Unmarshal(tk []byte) error
type SUuidPayload ¶
type TScopedPayloadVersion ¶
type TScopedPayloadVersion byte
type VerifyTokenV2Param ¶
type VerifyTokenV2Param struct {
// keystone V2验证token
// in:path
// required:true
Token string
}
swagger:parameters verifyTokensV2
type VerifyTokenV3Param ¶
type VerifyTokenV3Param struct {
// keystone V3验证token
// in:header
// required:true
Token string `json:"X-Subject-Token"`
}
swagger:parameters verifyTokensV3
Click to show internal directories.
Click to hide internal directories.