tokendriver

package
v0.0.0-...-e7c744b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
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

func MakeCreateTokenEndpoint(service token.Service) endpoint.Endpoint

MakeCreateTokenEndpoint returns an endpoint for the matching method of the underlying service.

func MakeDeleteTokenEndpoint

func MakeDeleteTokenEndpoint(service token.Service) endpoint.Endpoint

MakeDeleteTokenEndpoint returns an endpoint for the matching method of the underlying service.

func MakeGetTokenEndpoint

func MakeGetTokenEndpoint(service token.Service) endpoint.Endpoint

MakeGetTokenEndpoint returns an endpoint for the matching method of the underlying service.

func MakeListTokensEndpoint

func MakeListTokensEndpoint(service token.Service) endpoint.Endpoint

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

type CreateTokenResponse struct {
	NewToken token.NewToken
	Err      error
}

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

type GetTokenResponse struct {
	Token token.Token
	Err   error
}

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

type ListTokensResponse struct {
	Tokens []token.Token
	Err    error
}

ListTokensResponse is a response struct for ListTokens endpoint.

func (ListTokensResponse) Failed

func (r ListTokensResponse) Failed() error

type Middleware

type Middleware func(token.Service) token.Service

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL