Documentation
¶
Index ¶
- Constants
- Variables
- func CheckAuthorization(ctx context.Context, c echo.Context, scope string) (*settings.DialSettings, error)
- func FlushAuthorizations(root string)
- func GetBearerToken(r *http.Request) (string, error)
- func LookupByToken(token string) (*settings.DialSettings, error)
- func RegisterAuthorization(ds *settings.DialSettings) error
- func UpdateStore(ds *settings.DialSettings) error
Constants ¶
View Source
const ( // default API scopes ScopeApiRead = "api:read" // that's the very minimum ScopeApiWrite = "api:write" ScopeApiEdit = "api:edit" ScopeApiCreate = "api:create" ScopeApiDelete = "api:delete" ScopeApiAdmin = "api:admin" // block access ScopeApiNoAccess = "api:noaccess" )
Variables ¶
View Source
var ( // ErrNotAuthorized indicates that the API caller is not authorized ErrNotAuthorized = errors.New("not authorized") ErrAlreadyAuthorized = errors.New("already authorized") // ErrAlreadyInitialized indicates that client is already registered ErrAlreadyInitialized = errors.New("already initialized") // ErrNoToken indicates that no bearer token was provided ErrNoToken = errors.New("no token provided") // ErrTokenExpired indicates that the token is no longer valid ErrTokenExpired = errors.New("token expired") // ErrNoScope indicates that no scope was provided ErrNoScope = errors.New("no scope provided") )
Functions ¶
func CheckAuthorization ¶
func CheckAuthorization(ctx context.Context, c echo.Context, scope string) (*settings.DialSettings, error)
CheckAuthorization relies on the presence of a bearer token and validates the matching authorization against a list of requested scopes. If everything checks out, the function returns the authorization or an error otherwise.
func FlushAuthorizations ¶
func FlushAuthorizations(root string)
func LookupByToken ¶
func LookupByToken(token string) (*settings.DialSettings, error)
func RegisterAuthorization ¶
func RegisterAuthorization(ds *settings.DialSettings) error
func UpdateStore ¶
func UpdateStore(ds *settings.DialSettings) error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.