Documentation
¶
Index ¶
Constants ¶
View Source
const ( // UserKey is temporary User key received on successfull login. UserKey uint32 = iota // RecoveryKey represents a key for resseting password. RecoveryKey // APIKey enables the one to act on behalf of the user. APIKey )
Variables ¶
View Source
var ( // ErrInvalidKeyIssuedAt indicates that the Key is being used before it's issued. ErrInvalidKeyIssuedAt = errors.New("invalid issue time") // ErrKeyExpired indicates that the Key is expired. ErrKeyExpired = errors.New("use of expired key") )
View Source
var ( ErrUnauthorizedAccess = errors.New("unauthorized access") // ErrMalformedEntity indicates malformed entity specification (e.g. // invalid owner or ID). ErrMalformedEntity = errors.New("malformed entity specification") // ErrNotFound indicates a non-existing entity request. ErrNotFound = errors.New("entity not found") // ErrConflict indicates that entity already exists. ErrConflict = errors.New("entity already exists") )
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key struct {
ID string
Type uint32
Issuer string
Secret string
IssuedAt time.Time
ExpiresAt time.Time
}
Key represents API key.
type KeyRepository ¶
type KeyRepository interface {
// Save persists the Key. A non-nil error is returned to indicate
// operation failure
Save(context.Context, Key) (string, error)
// Retrieve retrieves Key by its unique identifier.
Retrieve(context.Context, string, string) (Key, error)
// Remove removes Key with provided ID.
Remove(context.Context, string, string) error
}
KeyRepository specifies Key persistence API.
type Service ¶
type Service interface {
// Issue issues a new Key.
Issue(context.Context, string, Key) (Key, error)
// Revoke removes the Key with the provided id that is
// issued by the user identified by the provided key.
Revoke(context.Context, string, string) error
// Retrieve retrieves data for the Key identified by the provided
// ID, that is issued by the user identified by the provided key.
Retrieve(context.Context, string, string) (Key, error)
// Identify validates token token. If token is valid, content
// is returned. If token is invalid, or invocation failed for some
// other reason, non-nil error value is returned in response.
Identify(context.Context, string) (string, error)
}
Service specifies an API that must be fullfiled by the domain service implementation, and all of its decorators (e.g. logging & metrics).
func New ¶
func New(keys KeyRepository, up mainflux.UUIDProvider, tokenizer Tokenizer) Service
New instantiates the auth service implementation.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package api contains implementation of AuthN service HTTP API.
|
Package api contains implementation of AuthN service HTTP API. |
|
grpc
Package grpc contains implementation of AuthN service gRPC API.
|
Package grpc contains implementation of AuthN service gRPC API. |
|
Package postgres contains Key repository implementations using PostgreSQL as the underlying database.
|
Package postgres contains Key repository implementations using PostgreSQL as the underlying database. |
|
Package tracing contains middlewares that will add spans to existing traces.
|
Package tracing contains middlewares that will add spans to existing traces. |
Click to show internal directories.
Click to hide internal directories.