auth

package
v0.0.0-...-0ca0b20 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInternalError

func IsInternalError(err error) bool

IsInternalError returns true if err is an instance of InternalError.

func IsInvalidLoginCredentials

func IsInvalidLoginCredentials(err error) bool

IsInvalidLoginCredentials returns true if err is an instance of InvalidLoginCredentials.

func IsInvalidLoginRequest

func IsInvalidLoginRequest(err error) bool

IsInvalidLoginRequest returns true if err is an instance of InvalidLoginRequest.

func RegisterRoutesAuthServiceV1

func RegisterRoutesAuthServiceV1(router wrouter.Router, impl AuthServiceV1) error

RegisterRoutesAuthServiceV1 registers handlers for the AuthServiceV1 endpoints with a witchcraft wrouter. This should typically be called in a witchcraft server's InitFunc. impl provides an implementation of each endpoint, which can assume the request parameters have been parsed in accordance with the Conjure specification.

Types

type AuthServiceV1

type AuthServiceV1 interface {
	/*
	   Login to the service with a username/password.
	   Returns an InvalidLoginRequest error if the request was invalid.
	*/
	Login(ctx context.Context, requestArg LoginRequestV1) (LoginResponseV1, error)
}

Auth service provides functionality to log in/out of the service.

type AuthServiceV1Client

type AuthServiceV1Client interface {
	/*
	   Login to the service with a username/password.
	   Returns an InvalidLoginRequest error if the request was invalid.
	*/
	Login(ctx context.Context, requestArg LoginRequestV1) (LoginResponseV1, error)
}

Auth service provides functionality to log in/out of the service.

func NewAuthServiceV1Client

func NewAuthServiceV1Client(client httpclient.Client) AuthServiceV1Client

type InternalError

type InternalError struct {
	// contains filtered or unexported fields
}

InternalError is an error type.

An internal error has occured. The specific reason is specified in the "reason" argument.

func NewInternalError

func NewInternalError(reasonArg string) *InternalError

NewInternalError returns new instance of InternalError error.

func WrapWithInternalError

func WrapWithInternalError(err error, reasonArg string) *InternalError

WrapWithInternalError returns new instance of InternalError error wrapping an existing error.

func (*InternalError) Cause

func (e *InternalError) Cause() error

Cause returns the underlying cause of the error, or nil if none. Note that cause is not serialized and sent over the wire.

func (*InternalError) Code

func (e *InternalError) Code() errors.ErrorCode

Code returns an enum describing error category.

func (*InternalError) Error

func (e *InternalError) Error() string

func (*InternalError) Format

func (e *InternalError) Format(state fmt.State, verb rune)

Format implements fmt.Formatter, a requirement of werror.Werror.

func (*InternalError) InstanceID

func (e *InternalError) InstanceID() uuid.UUID

InstanceID returns unique identifier of this particular error instance.

func (InternalError) MarshalJSON

func (e InternalError) MarshalJSON() ([]byte, error)

func (InternalError) MarshalYAML

func (o InternalError) MarshalYAML() (interface{}, error)

func (*InternalError) Message

func (e *InternalError) Message() string

Message returns the message body for the error.

func (*InternalError) Name

func (e *InternalError) Name() string

Name returns an error name identifying error type.

func (*InternalError) Parameters

func (e *InternalError) Parameters() map[string]interface{}

Parameters returns a set of named parameters detailing this particular error instance.

func (*InternalError) SafeParams

func (e *InternalError) SafeParams() map[string]interface{}

SafeParams returns a set of named safe parameters detailing this particular error instance and any underlying causes.

func (*InternalError) StackTrace

func (e *InternalError) StackTrace() werror.StackTrace

StackTrace returns the StackTrace for the error, or nil if none. Note that stack traces are not serialized and sent over the wire.

func (*InternalError) UnmarshalJSON

func (e *InternalError) UnmarshalJSON(data []byte) error

func (*InternalError) UnmarshalYAML

func (o *InternalError) UnmarshalYAML(unmarshal func(interface{}) error) error

func (*InternalError) UnsafeParams

func (e *InternalError) UnsafeParams() map[string]interface{}

UnsafeParams returns a set of named unsafe parameters detailing this particular error instance and any underlying causes.

type InvalidLoginCredentials

type InvalidLoginCredentials struct {
	// contains filtered or unexported fields
}

InvalidLoginCredentials is an error type. The provided user could not be authenticated to login.

func NewInvalidLoginCredentials

func NewInvalidLoginCredentials(usernameArg string) *InvalidLoginCredentials

NewInvalidLoginCredentials returns new instance of InvalidLoginCredentials error.

func WrapWithInvalidLoginCredentials

func WrapWithInvalidLoginCredentials(err error, usernameArg string) *InvalidLoginCredentials

WrapWithInvalidLoginCredentials returns new instance of InvalidLoginCredentials error wrapping an existing error.

func (*InvalidLoginCredentials) Cause

func (e *InvalidLoginCredentials) Cause() error

Cause returns the underlying cause of the error, or nil if none. Note that cause is not serialized and sent over the wire.

func (*InvalidLoginCredentials) Code

Code returns an enum describing error category.

func (*InvalidLoginCredentials) Error

func (e *InvalidLoginCredentials) Error() string

func (*InvalidLoginCredentials) Format

func (e *InvalidLoginCredentials) Format(state fmt.State, verb rune)

Format implements fmt.Formatter, a requirement of werror.Werror.

func (*InvalidLoginCredentials) InstanceID

func (e *InvalidLoginCredentials) InstanceID() uuid.UUID

InstanceID returns unique identifier of this particular error instance.

func (InvalidLoginCredentials) MarshalJSON

func (e InvalidLoginCredentials) MarshalJSON() ([]byte, error)

func (InvalidLoginCredentials) MarshalYAML

func (o InvalidLoginCredentials) MarshalYAML() (interface{}, error)

func (*InvalidLoginCredentials) Message

func (e *InvalidLoginCredentials) Message() string

Message returns the message body for the error.

func (*InvalidLoginCredentials) Name

func (e *InvalidLoginCredentials) Name() string

Name returns an error name identifying error type.

func (*InvalidLoginCredentials) Parameters

func (e *InvalidLoginCredentials) Parameters() map[string]interface{}

Parameters returns a set of named parameters detailing this particular error instance.

func (*InvalidLoginCredentials) SafeParams

func (e *InvalidLoginCredentials) SafeParams() map[string]interface{}

SafeParams returns a set of named safe parameters detailing this particular error instance and any underlying causes.

func (*InvalidLoginCredentials) StackTrace

func (e *InvalidLoginCredentials) StackTrace() werror.StackTrace

StackTrace returns the StackTrace for the error, or nil if none. Note that stack traces are not serialized and sent over the wire.

func (*InvalidLoginCredentials) UnmarshalJSON

func (e *InvalidLoginCredentials) UnmarshalJSON(data []byte) error

func (*InvalidLoginCredentials) UnmarshalYAML

func (o *InvalidLoginCredentials) UnmarshalYAML(unmarshal func(interface{}) error) error

func (*InvalidLoginCredentials) UnsafeParams

func (e *InvalidLoginCredentials) UnsafeParams() map[string]interface{}

UnsafeParams returns a set of named unsafe parameters detailing this particular error instance and any underlying causes.

type InvalidLoginRequest

type InvalidLoginRequest struct {
	// contains filtered or unexported fields
}

InvalidLoginRequest is an error type. Login request was invalid. Returned from /auth/login.

func NewInvalidLoginRequest

func NewInvalidLoginRequest(missingFieldsArg []string) *InvalidLoginRequest

NewInvalidLoginRequest returns new instance of InvalidLoginRequest error.

func WrapWithInvalidLoginRequest

func WrapWithInvalidLoginRequest(err error, missingFieldsArg []string) *InvalidLoginRequest

WrapWithInvalidLoginRequest returns new instance of InvalidLoginRequest error wrapping an existing error.

func (*InvalidLoginRequest) Cause

func (e *InvalidLoginRequest) Cause() error

Cause returns the underlying cause of the error, or nil if none. Note that cause is not serialized and sent over the wire.

func (*InvalidLoginRequest) Code

Code returns an enum describing error category.

func (*InvalidLoginRequest) Error

func (e *InvalidLoginRequest) Error() string

func (*InvalidLoginRequest) Format

func (e *InvalidLoginRequest) Format(state fmt.State, verb rune)

Format implements fmt.Formatter, a requirement of werror.Werror.

func (*InvalidLoginRequest) InstanceID

func (e *InvalidLoginRequest) InstanceID() uuid.UUID

InstanceID returns unique identifier of this particular error instance.

func (InvalidLoginRequest) MarshalJSON

func (e InvalidLoginRequest) MarshalJSON() ([]byte, error)

func (InvalidLoginRequest) MarshalYAML

func (o InvalidLoginRequest) MarshalYAML() (interface{}, error)

func (*InvalidLoginRequest) Message

func (e *InvalidLoginRequest) Message() string

Message returns the message body for the error.

func (*InvalidLoginRequest) Name

func (e *InvalidLoginRequest) Name() string

Name returns an error name identifying error type.

func (*InvalidLoginRequest) Parameters

func (e *InvalidLoginRequest) Parameters() map[string]interface{}

Parameters returns a set of named parameters detailing this particular error instance.

func (*InvalidLoginRequest) SafeParams

func (e *InvalidLoginRequest) SafeParams() map[string]interface{}

SafeParams returns a set of named safe parameters detailing this particular error instance and any underlying causes.

func (*InvalidLoginRequest) StackTrace

func (e *InvalidLoginRequest) StackTrace() werror.StackTrace

StackTrace returns the StackTrace for the error, or nil if none. Note that stack traces are not serialized and sent over the wire.

func (*InvalidLoginRequest) UnmarshalJSON

func (e *InvalidLoginRequest) UnmarshalJSON(data []byte) error

func (*InvalidLoginRequest) UnmarshalYAML

func (o *InvalidLoginRequest) UnmarshalYAML(unmarshal func(interface{}) error) error

func (*InvalidLoginRequest) UnsafeParams

func (e *InvalidLoginRequest) UnsafeParams() map[string]interface{}

UnsafeParams returns a set of named unsafe parameters detailing this particular error instance and any underlying causes.

type LoginRequestV1

type LoginRequestV1 struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (LoginRequestV1) MarshalYAML

func (o LoginRequestV1) MarshalYAML() (interface{}, error)

func (*LoginRequestV1) UnmarshalYAML

func (o *LoginRequestV1) UnmarshalYAML(unmarshal func(interface{}) error) error

type LoginResponseV1

type LoginResponseV1 struct {
	// Token to be used in subsequent requests.
	AccessToken string `conjure-docs:"Token to be used in subsequent requests." json:"accessToken"`
	// TokenType is the type of token this is. This will always be "bearer".
	TokenType string `conjure-docs:"TokenType is the type of token this is. This will always be \"bearer\"." json:"tokenType"`
	// ExpiresIn is the amount of time in seconds for which the token is valid.
	ExpiresIn int `conjure-docs:"ExpiresIn is the amount of time in seconds for which the token is valid." json:"expiresIn"`
}

LoginResponseV1 returns an OAuth2 response as defined in https://oauth.com/oauth2-servers/access-tokens/access-token-response

func (LoginResponseV1) MarshalYAML

func (o LoginResponseV1) MarshalYAML() (interface{}, error)

func (*LoginResponseV1) UnmarshalYAML

func (o *LoginResponseV1) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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