auth

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const AuthenticationFailedMountPoint = "_authentication_failed"
View Source
const DefaultMountPoint = "_default"

DefaultMountPoint is the default mountpoint

Variables

View Source
var (
	ErrAuthenticationFailed = errors.New("authentication failed")
)

Functions

func RegisterAuthenticationServer

func RegisterAuthenticationServer(s *grpc.Server, srv AuthenticationServer)

Types

type ApplicationContext

type ApplicationContext struct {
	Username             []byte   `protobuf:"bytes,1,opt,name=Username,proto3" json:"Username,omitempty"`
	Password             []byte   `protobuf:"bytes,2,opt,name=Password,proto3" json:"Password,omitempty"`
	ClientID             []byte   `protobuf:"bytes,3,opt,name=ClientID,proto3" json:"ClientID,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ApplicationContext) Descriptor

func (*ApplicationContext) Descriptor() ([]byte, []int)

func (*ApplicationContext) GetClientID

func (m *ApplicationContext) GetClientID() []byte

func (*ApplicationContext) GetPassword

func (m *ApplicationContext) GetPassword() []byte

func (*ApplicationContext) GetUsername

func (m *ApplicationContext) GetUsername() []byte

func (*ApplicationContext) ProtoMessage

func (*ApplicationContext) ProtoMessage()

func (*ApplicationContext) Reset

func (m *ApplicationContext) Reset()

func (*ApplicationContext) String

func (m *ApplicationContext) String() string

func (*ApplicationContext) XXX_DiscardUnknown

func (m *ApplicationContext) XXX_DiscardUnknown()

func (*ApplicationContext) XXX_Marshal

func (m *ApplicationContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ApplicationContext) XXX_Merge

func (m *ApplicationContext) XXX_Merge(src proto.Message)

func (*ApplicationContext) XXX_Size

func (m *ApplicationContext) XXX_Size() int

func (*ApplicationContext) XXX_Unmarshal

func (m *ApplicationContext) XXX_Unmarshal(b []byte) error

type AuthenticationClient

type AuthenticationClient interface {
	AuthenticateMQTTClient(ctx context.Context, in *WaspAuthenticationRequest, opts ...grpc.CallOption) (*WaspAuthenticationResponse, error)
}

AuthenticationClient is the client API for Authentication service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewAuthenticationClient

func NewAuthenticationClient(cc *grpc.ClientConn) AuthenticationClient

type AuthenticationHandler

type AuthenticationHandler interface {
	Authenticate(ctx context.Context, mqtt ApplicationContext, transport TransportContext) (principal Principal, err error)
}

func FileHandler

func FileHandler(path string) (AuthenticationHandler, error)

FileHandler returns a file-based authentication handler. It reads a csv file, where each lines are formated line "username:password:mountpoint". If mountpoint is empty, the default mountpoint will be used.

func GRPC

func GRPC(remote *grpc.ClientConn) (AuthenticationHandler, error)

func NoopHandler

func NoopHandler() AuthenticationHandler

func StaticHandler

func StaticHandler(username, password string) (AuthenticationHandler, error)

StaticHandler returns a static authentication handler.

type AuthenticationServer

type AuthenticationServer interface {
	AuthenticateMQTTClient(context.Context, *WaspAuthenticationRequest) (*WaspAuthenticationResponse, error)
}

AuthenticationServer is the server API for Authentication service.

type Principal added in v1.5.0

type Principal struct {
	ID         string
	MountPoint string
}

type TransportContext

type TransportContext struct {
	Encrypted            bool     `protobuf:"varint,1,opt,name=Encrypted,proto3" json:"Encrypted,omitempty"`
	RemoteAddress        string   `protobuf:"bytes,2,opt,name=RemoteAddress,proto3" json:"RemoteAddress,omitempty"`
	X509Certificate      []byte   `protobuf:"bytes,3,opt,name=X509Certificate,proto3" json:"X509Certificate,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*TransportContext) Descriptor

func (*TransportContext) Descriptor() ([]byte, []int)

func (*TransportContext) GetEncrypted

func (m *TransportContext) GetEncrypted() bool

func (*TransportContext) GetRemoteAddress

func (m *TransportContext) GetRemoteAddress() string

func (*TransportContext) GetX509Certificate

func (m *TransportContext) GetX509Certificate() []byte

func (*TransportContext) ProtoMessage

func (*TransportContext) ProtoMessage()

func (*TransportContext) Reset

func (m *TransportContext) Reset()

func (*TransportContext) String

func (m *TransportContext) String() string

func (*TransportContext) XXX_DiscardUnknown

func (m *TransportContext) XXX_DiscardUnknown()

func (*TransportContext) XXX_Marshal

func (m *TransportContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransportContext) XXX_Merge

func (m *TransportContext) XXX_Merge(src proto.Message)

func (*TransportContext) XXX_Size

func (m *TransportContext) XXX_Size() int

func (*TransportContext) XXX_Unmarshal

func (m *TransportContext) XXX_Unmarshal(b []byte) error

type UnimplementedAuthenticationServer

type UnimplementedAuthenticationServer struct {
}

UnimplementedAuthenticationServer can be embedded to have forward compatible implementations.

func (*UnimplementedAuthenticationServer) AuthenticateMQTTClient

type WaspAuthenticationRequest

type WaspAuthenticationRequest struct {
	MQTT                 *ApplicationContext `protobuf:"bytes,1,opt,name=MQTT,proto3" json:"MQTT,omitempty"`
	Transport            *TransportContext   `protobuf:"bytes,2,opt,name=Transport,proto3" json:"Transport,omitempty"`
	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
	XXX_unrecognized     []byte              `json:"-"`
	XXX_sizecache        int32               `json:"-"`
}

func (*WaspAuthenticationRequest) Descriptor

func (*WaspAuthenticationRequest) Descriptor() ([]byte, []int)

func (*WaspAuthenticationRequest) GetMQTT

func (*WaspAuthenticationRequest) GetTransport

func (m *WaspAuthenticationRequest) GetTransport() *TransportContext

func (*WaspAuthenticationRequest) ProtoMessage

func (*WaspAuthenticationRequest) ProtoMessage()

func (*WaspAuthenticationRequest) Reset

func (m *WaspAuthenticationRequest) Reset()

func (*WaspAuthenticationRequest) String

func (m *WaspAuthenticationRequest) String() string

func (*WaspAuthenticationRequest) XXX_DiscardUnknown

func (m *WaspAuthenticationRequest) XXX_DiscardUnknown()

func (*WaspAuthenticationRequest) XXX_Marshal

func (m *WaspAuthenticationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WaspAuthenticationRequest) XXX_Merge

func (m *WaspAuthenticationRequest) XXX_Merge(src proto.Message)

func (*WaspAuthenticationRequest) XXX_Size

func (m *WaspAuthenticationRequest) XXX_Size() int

func (*WaspAuthenticationRequest) XXX_Unmarshal

func (m *WaspAuthenticationRequest) XXX_Unmarshal(b []byte) error

type WaspAuthenticationResponse

type WaspAuthenticationResponse struct {
	MountPoint           string   `protobuf:"bytes,1,opt,name=MountPoint,proto3" json:"MountPoint,omitempty"`
	ID                   string   `protobuf:"bytes,2,opt,name=ID,proto3" json:"ID,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*WaspAuthenticationResponse) Descriptor

func (*WaspAuthenticationResponse) Descriptor() ([]byte, []int)

func (*WaspAuthenticationResponse) GetID added in v1.5.0

func (*WaspAuthenticationResponse) GetMountPoint

func (m *WaspAuthenticationResponse) GetMountPoint() string

func (*WaspAuthenticationResponse) ProtoMessage

func (*WaspAuthenticationResponse) ProtoMessage()

func (*WaspAuthenticationResponse) Reset

func (m *WaspAuthenticationResponse) Reset()

func (*WaspAuthenticationResponse) String

func (m *WaspAuthenticationResponse) String() string

func (*WaspAuthenticationResponse) XXX_DiscardUnknown

func (m *WaspAuthenticationResponse) XXX_DiscardUnknown()

func (*WaspAuthenticationResponse) XXX_Marshal

func (m *WaspAuthenticationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WaspAuthenticationResponse) XXX_Merge

func (m *WaspAuthenticationResponse) XXX_Merge(src proto.Message)

func (*WaspAuthenticationResponse) XXX_Size

func (m *WaspAuthenticationResponse) XXX_Size() int

func (*WaspAuthenticationResponse) XXX_Unmarshal

func (m *WaspAuthenticationResponse) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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