Documentation ¶
Index ¶
- Constants
- Variables
- func NewSecureEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewSigninEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint
- type Auther
- type Client
- type Creds
- type Endpoints
- type InvalidScopes
- type SecurePayload
- type Service
- type SigninPayload
- type Unauthorized
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 = [2]string{"signin", "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.
Functions ¶
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".
Types ¶
type Auther ¶
type Auther interface { // BasicAuth implements the authorization logic for the Basic security scheme. BasicAuth(ctx context.Context, user, pass string, schema *security.BasicScheme) (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 ¶
Client is the "secured_service" service client.
type Creds ¶
type Creds struct { // JWT token JWT string }
Creds is the result type of the secured_service service signin method.
type Endpoints ¶
Endpoints wraps the "secured_service" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "secured_service" service with endpoints.
type InvalidScopes ¶
type InvalidScopes string
Token scopes are invalid
func (InvalidScopes) Error ¶
func (e InvalidScopes) Error() string
Error returns an error description.
func (InvalidScopes) ErrorName ¶
func (e InvalidScopes) ErrorName() string
ErrorName returns "invalid-scopes".
type SecurePayload ¶
type SecurePayload struct { // Are these exposed for unauthenticated requests? Test *string // 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) (res *Creds, err error) // This action is secured with the jwt scheme Secure(context.Context, *SecurePayload) (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".