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 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.