Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authorization ¶
func Authorization(auth Authorizer) echo.MiddlewareFunc
Authorization returns a new authorization middleware func by using the input authorizer.
Types ¶
type Authorizer ¶
Authorizer represents an authorization mechanism applied to an HTTP request.
type TagAuthorizer ¶
type TagAuthorizer struct {
// contains filtered or unexported fields
}
TagAuthorizer performs authorization based on the TAG scheme for the authorization header.
func NewTagAuthorizer ¶
func NewTagAuthorizer(db storage.Storage, log echo.Logger) *TagAuthorizer
NewTagAuthorizer builds a new tag based authorizer. This type of authorizer matches the tag passed in through the authorization header against the tag associated with the resource that the request tries to modify.
func (*TagAuthorizer) Authorize ¶
func (a *TagAuthorizer) Authorize(r *http.Request) error
Authorize authorizes HTTP request by verifying resource ownership. It does so by retrieving the tag included in the http request's authorization header and comparing it with the tags associated with the resource that the request is trying to modify. If request tag is among the ones associated with the resource, then action is granted. Otherwise it is denied.