Documentation
¶
Overview ¶
Package provider provides the interfaces and manager for cloud providers
Index ¶
- Variables
- func Open(name string, params provider.Params) (provider.Provider, error)
- func Register(name string, provider provider.NewFunc)
- type Attributes
- type AuthToken
- type Claims
- type ContextKey
- type NewFunc
- type ObjectProvider
- type ObjectStore
- type Params
- type Provider
- type Queue
- type QueueProvider
- type TokenValidationError
- type User
- type UserPool
- type UserProvider
Constants ¶
This section is empty.
Variables ¶
var ( ErrUserPoolNotFound = errors.New("user pool not found") ErrUserNotFound = errors.New("user not found") ErrUserExists = errors.New("user with that username exists") ErrUserDisabled = errors.New("user disabled") ErrPasswordExpired = errors.New("password expired") ErrTokenRequired = TokenValidationError(errors.New("token required")) ErrTokenMismatch = TokenValidationError(errors.New("token mismatch")) ErrInvalidClient = TokenValidationError(errors.New("invalid auth client")) ErrInvalidToken = TokenValidationError(errors.New("invalid token")) ErrAccessDenied = TokenValidationError(errors.New("invalid scope")) ErrStoreNotFound = errors.New("store not found") ErrObjectNotFound = errors.New("object not found") )
var ( // ContextKeyAuthToken is used by authorization providers to mark the token in a context ContextKeyAuthToken = ContextKey("auth-token") )
Functions ¶
Types ¶
type Attributes ¶
Provider is an interface that must be implemented by cloud providers
type AuthToken ¶
type AuthToken interface {
// ID returns the token identifier
ID() string
// ClientID returns the OAuth client identity
ClientID() string
// Username() returns the user for the token or empty if no user is associated
Username() string
// ExpiresAt returns the token expiration time
ExpiresAt() int64
// Scope returns the scopes the token has
Scope() []string
// Returns the token use, i.e. access, identity, etc.
Use() string
// Claims returns the token claims
Claims() Claims
// String returns the string value of the token as a signed JWT
String() string
}
AuthToken is a driver interface for parsing and using JWT values
type ContextKey ¶ added in v1.1.0
type ContextKey string
ContextKey defines a static context key
func (ContextKey) String ¶ added in v1.1.0
func (c ContextKey) String() string
type NewFunc ¶
NewFunc is a function registered with the cloud layer for creating a new instance of the provider.
type ObjectProvider ¶
type ObjectProvider interface {
// OpenObjectStore store returns an object store with the given name and parameter
OpenObjectStore(name string, params Params) (ObjectStore, error)
}
ObjectProvider provides an object store
type ObjectStore ¶
type ObjectStore interface {
// GetObject returns an io.Reader that allows for getting the object data
GetObject(key string, params ...Params) (io.Reader, error)
// PutObject set the value
PutObject(key string, r io.Reader, params ...Params) error
// DeleteObject deletes and object
DeleteObject(key string) error
// Name returns the object store name
Name() string
}
ObjectStore is an interface for kv object stores implemented by providers
type Provider ¶
type Provider interface {
// ProxyHTTP handles incoming cloud events, proxying them to the virtual http.Handler
ProxyHTTP(http.Handler) error
// Close is called to cleanup the provider
Close()
}
Provider is an interface that must be implemented by cloud providers
type Queue ¶
type Queue interface {
// Publish publishes the message body with optioanl attributes and return the id
Publish(body []byte, attributes ...Attributes) (string, error)
}
Queue defines a queue interface
type QueueProvider ¶
QueueProvider defines a queue provider interface
type TokenValidationError ¶
type TokenValidationError error
type User ¶
type User interface {
// Login returns the user login i.e. username
Login() string
// Attributes returns a map of user attributes
Attributes() map[string]string
// Enabled represents the user's status
Enabled() bool
// Groups returns a list of groups the user belongs to
Groups() []string
}
User is a common user interface
type UserPool ¶
type UserPool interface {
// AuthenticateUser authenticates the user and returns an AuthToken
AuthenticateUser(username, password string) (AuthToken, error)
// AuthorizeToken takes the signed JWT string, parses and validates it returning an AuthToken
AuthorizeToken(token string, scopes ...[]string) (AuthToken, error)
// CreateUser creates a new user
CreateUser(username, password string, attributes map[string]string) (User, error)
// ChangeUserPassword attempts to change the users password from current to the proposed
ChangeUserPassword(username, current, proposed string) error
// GetUser returns a user
GetUser(username string) (User, error)
// UpdateUser updates a users attributes
UpdateUser(username string, attributes map[string]string) error
// DeleteUser deletes a user record
DeleteUser(username string) error
// DisableUser disables a user account
DisableUser(username string) error
}
UserPool is an interface implemented by providers that support users