Documentation
¶
Overview ¶
Package auth provides services for authentification / authorization.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthzManager ¶
type AuthzManager interface { BaseManager // Owner returns the zettel identifier of the owner. Owner() id.Zid // IsOwner returns true, if the given zettel identifier is that of the owner. IsOwner(zid id.Zid) bool // Returns true if authentication is enabled. WithAuth() bool // GetUserRole role returns the user role of the given user zettel. GetUserRole(user *meta.Meta) meta.UserRole }
AuthzManager provides methods for authorization.
type BaseManager ¶
type BaseManager interface { // IsReadonly returns true, if the systems is configured to run in read-only-mode. IsReadonly() bool }
BaseManager allows to check some base auth modes.
type Manager ¶
type Manager interface { TokenManager AuthzManager BoxWithPolicy(unprotectedBox box.Box, rtConfig config.Config) (box.Box, Policy) }
Manager is the main interface for providing the service.
type Policy ¶
type Policy interface { // User is allowed to create a new zettel. CanCreate(user, newMeta *meta.Meta) bool // User is allowed to read zettel CanRead(user, m *meta.Meta) bool // User is allowed to write zettel. CanWrite(user, oldMeta, newMeta *meta.Meta) bool // User is allowed to rename zettel CanRename(user, m *meta.Meta) bool // User is allowed to delete zettel. CanDelete(user, m *meta.Meta) bool // User is allowed to refresh box data. CanRefresh(user *meta.Meta) bool }
Policy is an interface for checking access authorization.
type TokenData ¶
type TokenData struct { Token []byte Now time.Time Issued time.Time Expires time.Time Ident string Zid id.Zid }
TokenData contains some important elements from a token.
type TokenKind ¶
type TokenKind int
TokenKind specifies for which application / usage a token is/was requested.
const ( KindAPI TokenKind KindwebUI )
Allowed values of token kind
type TokenManager ¶
type TokenManager interface { // GetToken produces a authentication token. GetToken(ident *meta.Meta, d time.Duration, kind TokenKind) ([]byte, error) // CheckToken checks the validity of the token and returns relevant data. CheckToken(token []byte, k TokenKind) (TokenData, error) }
TokenManager provides methods to create authentication
Directories
¶
Path | Synopsis |
---|---|
Package cred provides some function for handling credentials.
|
Package cred provides some function for handling credentials. |
Package impl provides services for authentification / authorization.
|
Package impl provides services for authentification / authorization. |
Package policy provides some interfaces and implementation for authorizsation policies.
|
Package policy provides some interfaces and implementation for authorizsation policies. |
Click to show internal directories.
Click to hide internal directories.