auth

package
v0.0.0-...-1d38151 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package auth is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var Lang_name = map[int32]string{
	0:  "EN",
	1:  "FR",
	2:  "ES",
	3:  "DE",
	4:  "NL",
	5:  "IT",
	6:  "PT",
	7:  "JA",
	8:  "ZH",
	9:  "PL",
	10: "RU",
	11: "SV",
	12: "AR",
	13: "EL",
	14: "NO",
}
View Source
var Lang_value = map[string]int32{
	"EN": 0,
	"FR": 1,
	"ES": 2,
	"DE": 3,
	"NL": 4,
	"IT": 5,
	"PT": 6,
	"JA": 7,
	"ZH": 8,
	"PL": 9,
	"RU": 10,
	"SV": 11,
	"AR": 12,
	"EL": 13,
	"NO": 14,
}

Functions

func RegisterAuthServiceHandler

func RegisterAuthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterAuthServiceHandler registers the http handlers for service AuthService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterAuthServiceHandlerClient

func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthServiceClient) error

RegisterAuthServiceHandlerClient registers the http handlers for service AuthService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AuthServiceClient" to call the correct interceptors.

func RegisterAuthServiceHandlerFromEndpoint

func RegisterAuthServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterAuthServiceHandlerFromEndpoint is same as RegisterAuthServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterAuthServiceServer

func RegisterAuthServiceServer(s *grpc.Server, srv AuthServiceServer)

Types

type AuthRequest

type AuthRequest struct {
	// username need to contain user name
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	// password need to contain password
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// code (optional) can contain code for authentication
	Code                 *wrappers.StringValue `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
	XXX_NoUnkeyedLiteral struct{}              `json:"-" bson:"-"`
	XXX_unrecognized     []byte                `json:"-" bson:"-"`
	XXX_sizecache        int32                 `json:"-" bson:"-"`
}

The request message containing the user's name.

func (*AuthRequest) Descriptor

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

func (*AuthRequest) GetCode

func (m *AuthRequest) GetCode() *wrappers.StringValue

func (*AuthRequest) GetPassword

func (m *AuthRequest) GetPassword() string

func (*AuthRequest) GetUsername

func (m *AuthRequest) GetUsername() string

func (*AuthRequest) ProtoMessage

func (*AuthRequest) ProtoMessage()

func (*AuthRequest) Reset

func (m *AuthRequest) Reset()

func (*AuthRequest) String

func (m *AuthRequest) String() string

func (*AuthRequest) XXX_DiscardUnknown

func (m *AuthRequest) XXX_DiscardUnknown()

func (*AuthRequest) XXX_Marshal

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

func (*AuthRequest) XXX_Merge

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

func (*AuthRequest) XXX_Size

func (m *AuthRequest) XXX_Size() int

func (*AuthRequest) XXX_Unmarshal

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

type AuthResponse

type AuthResponse struct {
	// result can contain example
	Result               string   `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-" bson:"-"`
	XXX_unrecognized     []byte   `json:"-" bson:"-"`
	XXX_sizecache        int32    `json:"-" bson:"-"`
}

AuthResponse - response to user authentication

func (*AuthResponse) Descriptor

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

func (*AuthResponse) GetResult

func (m *AuthResponse) GetResult() string

func (*AuthResponse) ProtoMessage

func (*AuthResponse) ProtoMessage()

func (*AuthResponse) Reset

func (m *AuthResponse) Reset()

func (*AuthResponse) String

func (m *AuthResponse) String() string

func (*AuthResponse) XXX_DiscardUnknown

func (m *AuthResponse) XXX_DiscardUnknown()

func (*AuthResponse) XXX_Marshal

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

func (*AuthResponse) XXX_Merge

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

func (*AuthResponse) XXX_Size

func (m *AuthResponse) XXX_Size() int

func (*AuthResponse) XXX_Unmarshal

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

type AuthServiceClient

type AuthServiceClient interface {
	// AccountAuth is a public endpoint for authorization
	AccountAuth(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthResponse, error)
}

AuthServiceClient is the client API for AuthService service.

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

func NewAuthServiceClient

func NewAuthServiceClient(cc *grpc.ClientConn) AuthServiceClient

type AuthServiceServer

type AuthServiceServer interface {
	// AccountAuth is a public endpoint for authorization
	AccountAuth(context.Context, *AuthRequest) (*AuthResponse, error)
}

AuthServiceServer is the server API for AuthService service.

type DisplayLocale

type DisplayLocale struct {
	// lang code according to ISO 639-1
	Lang Lang `protobuf:"varint,1,opt,name=lang,proto3,enum=Lang" json:"lang,omitempty"`
	// region as string
	Region *wrappers.StringValue `protobuf:"bytes,2,opt,name=region,proto3" json:"region,omitempty"`
	// desired currency name
	Currency             *wrappers.StringValue `protobuf:"bytes,3,opt,name=currency,proto3" json:"currency,omitempty"`
	XXX_NoUnkeyedLiteral struct{}              `json:"-" bson:"-"`
	XXX_unrecognized     []byte                `json:"-" bson:"-"`
	XXX_sizecache        int32                 `json:"-" bson:"-"`
}

DisplayLocale sets user locale preferences, the backend will format responses to match these preferences.

func (*DisplayLocale) Descriptor

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

func (*DisplayLocale) GetCurrency

func (m *DisplayLocale) GetCurrency() *wrappers.StringValue

func (*DisplayLocale) GetLang

func (m *DisplayLocale) GetLang() Lang

func (*DisplayLocale) GetRegion

func (m *DisplayLocale) GetRegion() *wrappers.StringValue

func (*DisplayLocale) ProtoMessage

func (*DisplayLocale) ProtoMessage()

func (*DisplayLocale) Reset

func (m *DisplayLocale) Reset()

func (*DisplayLocale) String

func (m *DisplayLocale) String() string

func (*DisplayLocale) XXX_DiscardUnknown

func (m *DisplayLocale) XXX_DiscardUnknown()

func (*DisplayLocale) XXX_Marshal

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

func (*DisplayLocale) XXX_Merge

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

func (*DisplayLocale) XXX_Size

func (m *DisplayLocale) XXX_Size() int

func (*DisplayLocale) XXX_Unmarshal

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

type ErrorResponse

type ErrorResponse struct {
	// code is numeric code for the error that occured
	Code *wrappers.Int32Value `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
	// request_id is ID for tracing. use it in displaying errors and troubleshooting
	RequestId *wrappers.StringValue `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
	// error contains the human-readable description of the error
	Error                string   `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-" bson:"-"`
	XXX_unrecognized     []byte   `json:"-" bson:"-"`
	XXX_sizecache        int32    `json:"-" bson:"-"`
}

func (*ErrorResponse) Descriptor

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

func (*ErrorResponse) GetCode

func (m *ErrorResponse) GetCode() *wrappers.Int32Value

func (*ErrorResponse) GetError

func (m *ErrorResponse) GetError() string

func (*ErrorResponse) GetRequestId

func (m *ErrorResponse) GetRequestId() *wrappers.StringValue

func (*ErrorResponse) ProtoMessage

func (*ErrorResponse) ProtoMessage()

func (*ErrorResponse) Reset

func (m *ErrorResponse) Reset()

func (*ErrorResponse) String

func (m *ErrorResponse) String() string

func (*ErrorResponse) XXX_DiscardUnknown

func (m *ErrorResponse) XXX_DiscardUnknown()

func (*ErrorResponse) XXX_Marshal

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

func (*ErrorResponse) XXX_Merge

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

func (*ErrorResponse) XXX_Size

func (m *ErrorResponse) XXX_Size() int

func (*ErrorResponse) XXX_Unmarshal

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

type ID

type ID struct {
	// The string value.
	Value                string   `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-" bson:"-"`
	XXX_unrecognized     []byte   `json:"-" bson:"-"`
	XXX_sizecache        int32    `json:"-" bson:"-"`
}

ID is a type that requires a field to have unique value that can later will be used for indexed lookups and aggregations. type string ID;

func (*ID) Descriptor

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

func (*ID) GetValue

func (m *ID) GetValue() string

func (*ID) ProtoMessage

func (*ID) ProtoMessage()

func (*ID) Reset

func (m *ID) Reset()

func (*ID) String

func (m *ID) String() string

func (*ID) XXX_DiscardUnknown

func (m *ID) XXX_DiscardUnknown()

func (*ID) XXX_Marshal

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

func (*ID) XXX_Merge

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

func (*ID) XXX_Size

func (m *ID) XXX_Size() int

func (*ID) XXX_Unmarshal

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

type Lang

type Lang int32

Lang code per ISO 639-1

const (
	// English (default)
	Lang_EN Lang = 0
	// French
	Lang_FR Lang = 1
	// Spanish
	Lang_ES Lang = 2
	// German
	Lang_DE Lang = 3
	// Dutch
	Lang_NL Lang = 4
	// Italian
	Lang_IT Lang = 5
	// Portugese
	Lang_PT Lang = 6
	// Japanese
	Lang_JA Lang = 7
	// Chinese
	Lang_ZH Lang = 8
	// Polish
	Lang_PL Lang = 9
	// Russian
	Lang_RU Lang = 10
	// Swedish
	Lang_SV Lang = 11
	// Arabic
	Lang_AR Lang = 12
	// Greek
	Lang_EL Lang = 13
	// Norwegian
	Lang_NO Lang = 14
)

func (Lang) EnumDescriptor

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

func (Lang) String

func (x Lang) String() string

type Pagination

type Pagination struct {
	// From specifies the offset ID to start listing from (excluding). This field can be left
	// empty, meaning that the listing should start from the beginning, otherwise use value returned
	// in **Last** field.
	From *wrappers.StringValue `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	// Limit the amount of items returned by specifying the latest.
	To *wrappers.StringValue `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
	// Last is filled with last ID in the list in listing responses. If you ask 20 items,
	// this field will contain 20th ID. Use this value in **From** field on the next list request
	// to continue listing from that point (excluding).
	Last *wrappers.StringValue `protobuf:"bytes,3,opt,name=last,proto3" json:"last,omitempty"`
	// Limit specify the maximum results count to return. Default limit (if not set) is 20.
	Limit                *wrappers.Int64Value `protobuf:"bytes,4,opt,name=limit,proto3" json:"limit,omitempty"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-" bson:"-"`
	XXX_unrecognized     []byte               `json:"-" bson:"-"`
	XXX_sizecache        int32                `json:"-" bson:"-"`
}

Defines pagination rules, typically for listing requests.

func (*Pagination) Descriptor

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

func (*Pagination) GetFrom

func (m *Pagination) GetFrom() *wrappers.StringValue

func (*Pagination) GetLast

func (m *Pagination) GetLast() *wrappers.StringValue

func (*Pagination) GetLimit

func (m *Pagination) GetLimit() *wrappers.Int64Value

func (*Pagination) GetTo

func (m *Pagination) GetTo() *wrappers.StringValue

func (*Pagination) ProtoMessage

func (*Pagination) ProtoMessage()

func (*Pagination) Reset

func (m *Pagination) Reset()

func (*Pagination) String

func (m *Pagination) String() string

func (*Pagination) XXX_DiscardUnknown

func (m *Pagination) XXX_DiscardUnknown()

func (*Pagination) XXX_Marshal

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

func (*Pagination) XXX_Merge

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

func (*Pagination) XXX_Size

func (m *Pagination) XXX_Size() int

func (*Pagination) XXX_Unmarshal

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

type Person

type Person struct {
	Age                  *wrappers.Int32Value `protobuf:"bytes,2,opt,name=age,proto3" json:"age,omitempty"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-" bson:"-"`
	XXX_unrecognized     []byte               `json:"-" bson:"-"`
	XXX_sizecache        int32                `json:"-" bson:"-"`
}

func (*Person) Descriptor

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

func (*Person) GetAge

func (m *Person) GetAge() *wrappers.Int32Value

func (*Person) ProtoMessage

func (*Person) ProtoMessage()

func (*Person) Reset

func (m *Person) Reset()

func (*Person) String

func (m *Person) String() string

func (*Person) XXX_DiscardUnknown

func (m *Person) XXX_DiscardUnknown()

func (*Person) XXX_Marshal

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

func (*Person) XXX_Merge

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

func (*Person) XXX_Size

func (m *Person) XXX_Size() int

func (*Person) XXX_Unmarshal

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

type UnimplementedAuthServiceServer

type UnimplementedAuthServiceServer struct {
}

UnimplementedAuthServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedAuthServiceServer) AccountAuth

Jump to

Keyboard shortcuts

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