Documentation ¶
Index ¶
- Constants
- func MakeCreateTokenEndpoint(service token.Service) endpoint.Endpoint
- func MakeDeleteTokenEndpoint(service token.Service) endpoint.Endpoint
- func MakeGetTokenEndpoint(service token.Service) endpoint.Endpoint
- func MakeListTokensEndpoint(service token.Service) endpoint.Endpoint
- func RegisterHTTPHandlers(endpoints Endpoints, router *mux.Router, options ...kithttp.ServerOption)
- type Authorizer
- type CreateTokenRequest
- type CreateTokenResponse
- type DeleteTokenRequest
- type DeleteTokenResponse
- type Endpoints
- type GetTokenRequest
- type GetTokenResponse
- type ListTokensRequest
- type ListTokensResponse
- type Middleware
Constants ¶
const CannotCreateVirtualUser = sentinel("cannot create virtual user")
CannotCreateVirtualUser is returned when a user does not have the right to create a virtual user token.
Variables ¶
This section is empty.
Functions ¶
func MakeCreateTokenEndpoint ¶
MakeCreateTokenEndpoint returns an endpoint for the matching method of the underlying service.
func MakeDeleteTokenEndpoint ¶
MakeDeleteTokenEndpoint returns an endpoint for the matching method of the underlying service.
func MakeGetTokenEndpoint ¶
MakeGetTokenEndpoint returns an endpoint for the matching method of the underlying service.
func MakeListTokensEndpoint ¶
MakeListTokensEndpoint returns an endpoint for the matching method of the underlying service.
func RegisterHTTPHandlers ¶
func RegisterHTTPHandlers(endpoints Endpoints, router *mux.Router, options ...kithttp.ServerOption)
RegisterHTTPHandlers mounts all of the service endpoints into an http.Handler.
Types ¶
type Authorizer ¶
type Authorizer interface { // Authorize authorizes a context to execute an action on an object. Authorize(ctx context.Context, action string, object interface{}) (bool, error) }
Authorizer checks if a context has permission to execute an action.
type CreateTokenRequest ¶
type CreateTokenRequest struct {
TokenRequest token.NewTokenRequest
}
CreateTokenRequest is a request struct for CreateToken endpoint.
type CreateTokenResponse ¶
CreateTokenResponse is a response struct for CreateToken endpoint.
func (CreateTokenResponse) Failed ¶
func (r CreateTokenResponse) Failed() error
type DeleteTokenRequest ¶
type DeleteTokenRequest struct {
Id string
}
DeleteTokenRequest is a request struct for DeleteToken endpoint.
type DeleteTokenResponse ¶
type DeleteTokenResponse struct {
Err error
}
DeleteTokenResponse is a response struct for DeleteToken endpoint.
func (DeleteTokenResponse) Failed ¶
func (r DeleteTokenResponse) Failed() error
type Endpoints ¶
type Endpoints struct { CreateToken endpoint.Endpoint DeleteToken endpoint.Endpoint GetToken endpoint.Endpoint ListTokens endpoint.Endpoint }
Endpoints collects all of the endpoints that compose the underlying service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.
func MakeEndpoints ¶
func MakeEndpoints(service token.Service, middleware ...endpoint.Middleware) Endpoints
MakeEndpoints returns a(n) Endpoints struct where each endpoint invokes the corresponding method on the provided service.
type GetTokenRequest ¶
type GetTokenRequest struct {
Id string
}
GetTokenRequest is a request struct for GetToken endpoint.
type GetTokenResponse ¶
GetTokenResponse is a response struct for GetToken endpoint.
func (GetTokenResponse) Failed ¶
func (r GetTokenResponse) Failed() error
type ListTokensRequest ¶
type ListTokensRequest struct{}
ListTokensRequest is a request struct for ListTokens endpoint.
type ListTokensResponse ¶
ListTokensResponse is a response struct for ListTokens endpoint.
func (ListTokensResponse) Failed ¶
func (r ListTokensResponse) Failed() error
type Middleware ¶
Middleware describes a service middleware.
func AuthorizationMiddleware ¶
func AuthorizationMiddleware(authorizer Authorizer) Middleware
AuthorizationMiddleware makes sure a user has the required permissions to create a token.