auth

package
v0.0.0-...-14bcf06 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AccessLevel_name = map[int32]string{
	0:   "_NO_LIMIT",
	100: "LOW_ACCESS_LEVEL",
	200: "MIDDLE_ACCESS_LEVEL",
	300: "HIGH_ACCESS_LEVEL",
	400: "SERVER_INTERNAL",
}
View Source
var AccessLevel_value = map[string]int32{
	"_NO_LIMIT":           0,
	"LOW_ACCESS_LEVEL":    100,
	"MIDDLE_ACCESS_LEVEL": 200,
	"HIGH_ACCESS_LEVEL":   300,
	"SERVER_INTERNAL":     400,
}
View Source
var E_Access = &proto.ExtensionDesc{
	ExtendedType:  (*descriptor.MethodOptions)(nil),
	ExtensionType: (*Access)(nil),
	Field:         2360,
	Name:          "auth.access",
	Tag:           "bytes,2360,opt,name=access",
	Filename:      "auth/annotations.proto",
}
View Source
var E_Visible = &proto.ExtensionDesc{
	ExtendedType:  (*descriptor.ServiceOptions)(nil),
	ExtensionType: (*Visible)(nil),
	Field:         1360,
	Name:          "auth.visible",
	Tag:           "bytes,1360,opt,name=visible",
	Filename:      "auth/annotations.proto",
}
View Source
var VisibleScope_name = map[int32]string{
	0: "PUBLIC_SCOPE",
	1: "INTERNAL_SCOPE",
	2: "ALL_SCOPE",
}
View Source
var VisibleScope_value = map[string]int32{
	"PUBLIC_SCOPE":   0,
	"INTERNAL_SCOPE": 1,
	"ALL_SCOPE":      2,
}

Functions

func StreamServerInterceptor

func StreamServerInterceptor(v Authenticator) grpc.StreamServerInterceptor

StreamServerInterceptor returns a new streaming server interceptor that authenticates incoming messages.

The stage at which unauthenticated messages will be rejected with `PermissionDenied` varies based on the type of the RPC. For `ServerStream` (1:m) requests, it will happen before reaching any userspace handlers. For `ClientStream` (n:1) or `BidiStream` (n:m) RPCs, the messages will be rejected on calls to `stream.Recv()`.

func UnaryServerInterceptor

func UnaryServerInterceptor(v Authenticator) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a new unary server interceptor that authenticates incoming messages.

Invalid messages will be rejected with `PermissionDenied` before reaching any userspace handlers.

Types

type Access

type Access struct {
	Level                AccessLevel `protobuf:"varint,1,opt,name=level,proto3,enum=auth.AccessLevel" json:"level,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

func (*Access) Descriptor

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

func (*Access) GetLevel

func (m *Access) GetLevel() AccessLevel

func (*Access) ProtoMessage

func (*Access) ProtoMessage()

func (*Access) Reset

func (m *Access) Reset()

func (*Access) String

func (m *Access) String() string

func (*Access) XXX_DiscardUnknown

func (m *Access) XXX_DiscardUnknown()

func (*Access) XXX_Marshal

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

func (*Access) XXX_Merge

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

func (*Access) XXX_Size

func (m *Access) XXX_Size() int

func (*Access) XXX_Unmarshal

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

type AccessLevel

type AccessLevel int32
const (
	AccessLevel__NO_LIMIT           AccessLevel = 0
	AccessLevel_LOW_ACCESS_LEVEL    AccessLevel = 100
	AccessLevel_MIDDLE_ACCESS_LEVEL AccessLevel = 200
	AccessLevel_HIGH_ACCESS_LEVEL   AccessLevel = 300
	AccessLevel_SERVER_INTERNAL     AccessLevel = 400
)

func (AccessLevel) EnumDescriptor

func (AccessLevel) EnumDescriptor() ([]byte, []int)

func (AccessLevel) String

func (x AccessLevel) String() string

type Authenticator

type Authenticator interface {
	SetAccessLevel(map[string]AccessLevel)
	Authenticate(ctx context.Context, fullMethod string) error
}

Server authenticator interface.

type GatewayHandler

type GatewayHandler func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error

type Implementor

type Implementor interface {
	ScopedGRPCServer(scope VisibleScope) []*grpc.Server
	RegisterGateway(scope VisibleScope, handlers GatewayHandler) error
}

type Visible

type Visible struct {
	Scope                VisibleScope `protobuf:"varint,1,opt,name=scope,proto3,enum=auth.VisibleScope" json:"scope,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func (*Visible) Descriptor

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

func (*Visible) GetScope

func (m *Visible) GetScope() VisibleScope

func (*Visible) ProtoMessage

func (*Visible) ProtoMessage()

func (*Visible) Reset

func (m *Visible) Reset()

func (*Visible) String

func (m *Visible) String() string

func (*Visible) XXX_DiscardUnknown

func (m *Visible) XXX_DiscardUnknown()

func (*Visible) XXX_Marshal

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

func (*Visible) XXX_Merge

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

func (*Visible) XXX_Size

func (m *Visible) XXX_Size() int

func (*Visible) XXX_Unmarshal

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

type VisibleScope

type VisibleScope int32
const (
	VisibleScope_PUBLIC_SCOPE   VisibleScope = 0
	VisibleScope_INTERNAL_SCOPE VisibleScope = 1
	VisibleScope_ALL_SCOPE      VisibleScope = 2
)

func (VisibleScope) EnumDescriptor

func (VisibleScope) EnumDescriptor() ([]byte, []int)

func (VisibleScope) String

func (x VisibleScope) String() string

Jump to

Keyboard shortcuts

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