Documentation ¶
Index ¶
Constants ¶
View Source
const ( PullAction = "pull" PushAction = "push" )
View Source
const ( AccessEntryType = "artifact-repository" AllowedActionsSearchPath = "access[?name=='$NAMESPACE' && type=='$ACCESS_ENTRY_TYPE'].actions[]" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessEntry ¶
type AccountClaims ¶
type AccountClaims struct { EAuthID uint `json:"eAuthId"` Org string `json:"org"` AuthProvider string `json:"authProvider"` Username string `json:"username"` // 用户名 组织内唯一必须由DNS-1123标签格式的单元组成 Nickname string `json:"nickname"` // 昵称,如中文名 OrgRole string `json:"orgRole"` // 组织角色 Nonce string `json:"nonce"` Email string `json:"email"` Phone string `json:"phone"` Groups []string `json:"groups"` Workspaces []string `json:"workspaces"` // 工作空间 WorkspacesRoles map[string][]string `json:"workspacesRoles"` // 工作空间角色 AppCode string `json:"appCode"` AppClientID string `json:"appClientId"` AppOwner bool `json:"appOwner"` Category string `json:"category"` jwt.StandardClaims }
type Authorizer ¶
type Authorizer struct { Type AuthorizerType Realm string Service string BasicAuthMatchHeader string TokenDecoder *TokenDecoder AnonymousActions []string AccessEntryType string DefaultNamespace string AllowedActionsSearchPath string }
Authorizer is TODO
func NewAuthorizer ¶
func NewAuthorizer(opts *AuthorizerOptions) (*Authorizer, error)
NewAuthorizer is TODO
func (*Authorizer) Authorize ¶
func (authorizer *Authorizer) Authorize(authHeader string, action string, namespace string) (*Permission, error)
type AuthorizerOptions ¶
type AuthorizerOptions struct { Realm string Service string Username string Password string PublicKey []byte PublicKeyPath string AnonymousActions []string AccessEntryType string DefaultNamespace string EmptyDefaultNamespace bool AllowedActionsSearchPath string }
BasicAuthAuthorizerOptions is TODO
type AuthorizerType ¶
type AuthorizerType string
AuthorizerType is TODO
var ( DefaultNamespace = "repo" BasicAuthAuthorizerType AuthorizerType = "basic" BearerAuthAuthorizerType AuthorizerType = "bearer" )
type Claims ¶
type Claims struct { *jwt.StandardClaims Access []AccessEntry `json:"access"` Audience string `json:"aud,omitempty"` Issuer string `json:"iss,omitempty"` }
type Permission ¶
Permission is TODO
type TokenDecoder ¶
func NewTokenDecoder ¶
func NewTokenDecoder(opts *TokenDecoderOptions) (*TokenDecoder, error)
func (*TokenDecoder) DecodeToken ¶
func (tokenDecoder *TokenDecoder) DecodeToken(signedString string) (*jwt.Token, error)
type TokenDecoderOptions ¶
type TokenGenerator ¶
type TokenGenerator struct { PrivateKey *rsa.PrivateKey Audience string Issuer string KID string }
func NewTokenGenerator ¶
func NewTokenGenerator(opts *TokenGeneratorOptions) (*TokenGenerator, error)
func (*TokenGenerator) GenerateToken ¶
func (tokenGenerator *TokenGenerator) GenerateToken(access []AccessEntry, expiration time.Duration) (string, error)
currently this only works with RSA key signing TODO: how best to handle many different signing algorithms?
Click to show internal directories.
Click to hide internal directories.