apikeyservice

package
v0.0.0-...-63cd2eb Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const APIName = "hierarchy"

APIName is the name of the API as defined in the design.

View Source
const APIVersion = "0.0.1"

APIVersion is the version of the API as defined in the design.

View Source
const ServiceName = "api_key_service"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [3]string{"default", "secure", "unsecure"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func NewDefaultEndpoint

func NewDefaultEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewDefaultEndpoint returns an endpoint function that calls the method "default" of service "api_key_service".

func NewSecureEndpoint

func NewSecureEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewSecureEndpoint returns an endpoint function that calls the method "secure" of service "api_key_service".

func NewUnsecureEndpoint

func NewUnsecureEndpoint(s Service) goa.Endpoint

NewUnsecureEndpoint returns an endpoint function that calls the method "unsecure" of service "api_key_service".

Types

type Auther

type Auther interface {
	// APIKeyAuth implements the authorization logic for the APIKey security scheme.
	APIKeyAuth(ctx context.Context, key string, schema *security.APIKeyScheme) (context.Context, error)
	// JWTAuth implements the authorization logic for the JWT security scheme.
	JWTAuth(ctx context.Context, token string, schema *security.JWTScheme) (context.Context, error)
}

Auther defines the authorization functions to be implemented by the service.

type Client

type Client struct {
	DefaultEndpoint  goa.Endpoint
	SecureEndpoint   goa.Endpoint
	UnsecureEndpoint goa.Endpoint
}

Client is the "api_key_service" service client.

func NewClient

func NewClient(default_, secure, unsecure goa.Endpoint) *Client

NewClient initializes a "api_key_service" service client given the endpoints.

func (*Client) Default

func (c *Client) Default(ctx context.Context, p *DefaultPayload) (err error)

Default calls the "default" endpoint of the "api_key_service" service.

func (*Client) Secure

func (c *Client) Secure(ctx context.Context, p *SecurePayload) (err error)

Secure calls the "secure" endpoint of the "api_key_service" service.

func (*Client) Unsecure

func (c *Client) Unsecure(ctx context.Context) (err error)

Unsecure calls the "unsecure" endpoint of the "api_key_service" service.

type DefaultPayload

type DefaultPayload struct {
	// API key used for authentication
	Key string
}

DefaultPayload is the payload type of the api_key_service service default method.

type Endpoints

type Endpoints struct {
	Default  goa.Endpoint
	Secure   goa.Endpoint
	Unsecure goa.Endpoint
}

Endpoints wraps the "api_key_service" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "api_key_service" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "api_key_service" service endpoints.

type SecurePayload

type SecurePayload struct {
	// JWT used for authentication
	Token string
}

SecurePayload is the payload type of the api_key_service service secure method.

type Service

type Service interface {
	// Default implements default.
	Default(context.Context, *DefaultPayload) (err error)
	// This method requires a valid JWT token.
	Secure(context.Context, *SecurePayload) (err error)
	// This method is not secured.
	Unsecure(context.Context) (err error)
}

The svc service is secured with API key based authentication

Jump to

Keyboard shortcuts

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