Documentation
¶
Overview ¶
Package apix provide API-related helpers.
Package apix is a generated GoMock package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrAccessTokenInvalid = errors.New("invalid AccessToken")
)
Errors.
Functions ¶
func FromContext ¶
FromContext returns values describing request stored in ctx, if any.
Types ¶
type AccessTokenParser ¶
type AccessTokenParser map[AccessToken]dom.Auth
AccessTokenParser handles example tokens.
func NewAccessTokenParser ¶
func NewAccessTokenParser() AccessTokenParser
NewAccessTokenParser creates AccessTokenParser which validates JWT signature using rsaPublicKey in PEM format.
func (AccessTokenParser) Authenticate ¶
func (p AccessTokenParser) Authenticate(token AccessToken) (auth dom.Auth, err error)
Authenticate implements Authenticator interface.
type Authn ¶
type Authn interface {
// Authenticate validates AccessToken and returns corresponding
// Auth. If validation fails returns zero Auth with error.
//
// Errors: ErrAccessTokenInvalid.
Authenticate(AccessToken) (dom.Auth, error)
}
Authn validates AccessToken.
type Ctx ¶
type Ctx struct {
AccessToken AccessToken
jsonrpc2.Ctx
}
Ctx describe Ctx param used by all API methods.
func (*Ctx) NewContext ¶
func (c *Ctx) NewContext( authn Authn, service string, ) ( ctx context.Context, log *structlog.Logger, methodName string, auth dom.Auth, err error, )
NewContext returns a new context.Context that carries values describing this request without any deadline, plus some of the values.
type MockAuthn ¶
type MockAuthn struct {
// contains filtered or unexported fields
}
MockAuthn is a mock of Authn interface
func NewMockAuthn ¶
func NewMockAuthn(ctrl *gomock.Controller) *MockAuthn
NewMockAuthn creates a new mock instance
func (*MockAuthn) Authenticate ¶
func (m *MockAuthn) Authenticate(arg0 AccessToken) (dom.Auth, error)
Authenticate mocks base method
func (*MockAuthn) EXPECT ¶
func (m *MockAuthn) EXPECT() *MockAuthnMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockAuthnMockRecorder ¶
type MockAuthnMockRecorder struct {
// contains filtered or unexported fields
}
MockAuthnMockRecorder is the mock recorder for MockAuthn
func (*MockAuthnMockRecorder) Authenticate ¶
func (mr *MockAuthnMockRecorder) Authenticate(arg0 interface{}) *gomock.Call
Authenticate indicates an expected call of Authenticate