forked from sensu/sensu-go
/
provider.go
28 lines (25 loc) · 956 Bytes
/
provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package v2
import (
"context"
)
// AuthProvider represents an abstracted authentication provider
type AuthProvider interface {
// Authenticate attempts to authenticate a user with its username and password
Authenticate(ctx context.Context, username, password string) (*Claims, error)
// Refresh renews the user claims with the provider claims
Refresh(ctx context.Context, providerClaims AuthProviderClaims) (*Claims, error)
// GetObjectMeta returns the object metadata for the provider
GetObjectMeta() ObjectMeta
// Name returns the provider name (e.g. default)
Name() string
// StorePrefix gives the path prefix to this resource in the store
StorePrefix() string
// Type returns the provider type (e.g. ldap)
Type() string
// URIPath gives the path to the provider
URIPath() string
// Validate checks if the fields in the provider are valid
Validate() error
// SetNamespace sets the namespace of the resource.
SetNamespace(string)
}