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 TeamAuthorizer ¶ added in v1.1.0
type TeamAuthorizer struct {
// contains filtered or unexported fields
}
TeamAuthorizer performs authorization based on the team identifier for the authorization header.
func NewTeamAuthorizer ¶ added in v1.1.0
func NewTeamAuthorizer(db storage.Storage, log echo.Logger) *TeamAuthorizer
NewTeamAuthorizer builds a new team based authorizer. This type of authorizer matches the team passed in through the authorization header against the team associated with the resource that the request tries to modify.
func (*TeamAuthorizer) Authorize ¶ added in v1.1.0
func (a *TeamAuthorizer) Authorize(r *http.Request) error
Authorize authorizes HTTP request by verifying resource ownership. It does so by retrieving the team included in the HTTP request authorization header and comparing it with the teams associated with the resource that the request is trying to modify. If the team is among the ones associated with the resource, then permission is granted. Otherwise it is denied.