github.com/goadesign/goa/examples/security/gen/secured_service
securedservice
import "github.com/goadesign/goa/examples/security/gen/secured_service"
Overview
Index
- Constants
- Variables
- func NewAlsoDoublySecureEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc, authOAuth2Fn security.AuthOAuth2Func, authBasicFn security.AuthBasicFunc) goa.Endpoint
- func NewDoublySecureEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewSecureEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewSigninEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint
- type AlsoDoublySecurePayload
- type Client
- func NewClient(signin, secure, doublySecure, alsoDoublySecure goa.Endpoint) *Client
- func (c *Client) AlsoDoublySecure(ctx context.Context, p *AlsoDoublySecurePayload) (res string, err error)
- func (c *Client) DoublySecure(ctx context.Context, p *DoublySecurePayload) (res string, err error)
- func (c *Client) Secure(ctx context.Context, p *SecurePayload) (res string, err error)
- func (c *Client) Signin(ctx context.Context, p *SigninPayload) (err error)
- type DoublySecurePayload
- type Endpoints
- type SecurePayload
- type Service
- type SigninPayload
- type Unauthorized
Package files
client.go endpoints.go service.go
Constants
const ServiceName = "secured_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
var MethodNames = [4]string{"signin", "secure", "doubly_secure", "also_doubly_secure"}
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.
func NewAlsoDoublySecureEndpoint
func NewAlsoDoublySecureEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc, authOAuth2Fn security.AuthOAuth2Func, authBasicFn security.AuthBasicFunc) goa.Endpoint
NewAlsoDoublySecureEndpoint returns an endpoint function that calls the method “also_doubly_secure” of service “secured_service”.
func NewDoublySecureEndpoint
func NewDoublySecureEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewDoublySecureEndpoint returns an endpoint function that calls the method “doubly_secure” of service “secured_service”.
func NewSecureEndpoint
func NewSecureEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewSecureEndpoint returns an endpoint function that calls the method “secure” of service “secured_service”.
func NewSigninEndpoint
func NewSigninEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint
NewSigninEndpoint returns an endpoint function that calls the method “signin” of service “secured_service”.
type AlsoDoublySecurePayload
type AlsoDoublySecurePayload struct {
// Username used to perform signin
Username *string
// Password used to perform signin
Password *string
// API key
Key *string
// JWT used for authentication
Token *string
OauthToken *string
}
AlsoDoublySecurePayload is the payload type of the secured_service service also_doubly_secure method.
type Client
type Client struct {
SigninEndpoint goa.Endpoint
SecureEndpoint goa.Endpoint
DoublySecureEndpoint goa.Endpoint
AlsoDoublySecureEndpoint goa.Endpoint
}
Client is the “secured_service” service client.
func NewClient
func NewClient(signin, secure, doublySecure, alsoDoublySecure goa.Endpoint) *Client
NewClient initializes a “secured_service” service client given the endpoints.
func (*Client) AlsoDoublySecure
func (c *Client) AlsoDoublySecure(ctx context.Context, p *AlsoDoublySecurePayload) (res string, err error)
AlsoDoublySecure calls the “also_doubly_secure” endpoint of the “secured_service” service.
func (*Client) DoublySecure
func (c *Client) DoublySecure(ctx context.Context, p *DoublySecurePayload) (res string, err error)
DoublySecure calls the “doubly_secure” endpoint of the “secured_service” service.
func (*Client) Secure
func (c *Client) Secure(ctx context.Context, p *SecurePayload) (res string, err error)
Secure calls the “secure” endpoint of the “secured_service” service.
func (*Client) Signin
func (c *Client) Signin(ctx context.Context, p *SigninPayload) (err error)
Signin calls the “signin” endpoint of the “secured_service” service.
type DoublySecurePayload
type DoublySecurePayload struct {
// API key
Key *string
// JWT used for authentication
Token *string
}
DoublySecurePayload is the payload type of the secured_service service doubly_secure method.
type Endpoints
type Endpoints struct {
Signin goa.Endpoint
Secure goa.Endpoint
DoublySecure goa.Endpoint
AlsoDoublySecure goa.Endpoint
}
Endpoints wraps the “secured_service” service endpoints.
func NewEndpoints
func NewEndpoints(s Service, authBasicFn security.AuthBasicFunc, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc, authOAuth2Fn security.AuthOAuth2Func) *Endpoints
NewEndpoints wraps the methods of the “secured_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 “secured_service” service endpoints.
type SecurePayload
type SecurePayload struct {
// Whether to force auth failure even with a valid JWT
Fail *bool
// JWT used for authentication
Token *string
}
SecurePayload is the payload type of the secured_service service secure method.
type Service
type Service interface {
// Creates a valid JWT
Signin(context.Context, *SigninPayload) (err error)
// This action is secured with the jwt scheme
Secure(context.Context, *SecurePayload) (res string, err error)
// This action is secured with the jwt scheme and also requires an API key
// query string.
DoublySecure(context.Context, *DoublySecurePayload) (res string, err error)
// This action is secured with the jwt scheme and also requires an API key
// header.
AlsoDoublySecure(context.Context, *AlsoDoublySecurePayload) (res string, err error)
}
The secured service exposes endpoints that require valid authorization credentials.
type SigninPayload
type SigninPayload struct {
// Username used to perform signin
Username string
// Password used to perform signin
Password string
}
Credentials used to authenticate to retrieve JWT token
type Unauthorized
type Unauthorized string
Credentials are invalid
func (Unauthorized) Error
func (e Unauthorized) Error() string
Error returns an error description.
func (Unauthorized) ErrorName
func (e Unauthorized) ErrorName() string
ErrorName returns “unauthorized”.
Generated by godoc2md