auth

package
v0.12.50 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const C_AuthLogin uint64 = 13609756835726243961
View Source
const C_AuthRegister uint64 = 10692114844155491067
View Source
const C_Authorization uint64 = 9434083844645341581
View Source
const C_LoginRequest uint64 = 18198549685643443149
View Source
const C_RegisterRequest uint64 = 11503803976169819412
View Source
const C_Session uint64 = 4434983008330775104
View Source
const C_User uint64 = 3297422589340680192

Variables

View Source
var File_model_proto protoreflect.FileDescriptor
View Source
var PoolAuthorization = poolAuthorization{}
View Source
var PoolLoginRequest = poolLoginRequest{}
View Source
var PoolRegisterRequest = poolRegisterRequest{}
View Source
var PoolSession = poolSession{}
View Source
var PoolUser = poolUser{}

Functions

func RegisterAuth

func RegisterAuth(h IAuth, e *edge.Server, preHandlers ...edge.Handler)

func RegisterAuthCli

func RegisterAuthCli(h IAuthCli, c edgec.Client, rootCmd *cobra.Command)

func RegisterAuthWithFunc

func RegisterAuthWithFunc(h IAuth, e *edge.Server, handlerFunc func(c uint64) []edge.Handler)

func TunnelRequestAuthLogin added in v0.12.32

func TunnelRequestAuthLogin(ctx *edge.RequestCtx, replicaSet uint64, req *LoginRequest, res *Authorization, kvs ...*rony.KeyValue) error

func TunnelRequestAuthRegister added in v0.12.32

func TunnelRequestAuthRegister(ctx *edge.RequestCtx, replicaSet uint64, req *RegisterRequest, res *Authorization, kvs ...*rony.KeyValue) error

Types

type AuthClient

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

func NewAuthClient

func NewAuthClient(ec edgec.Client) *AuthClient

func (*AuthClient) Login

func (c *AuthClient) Login(req *LoginRequest, kvs ...*rony.KeyValue) (*Authorization, error)

func (*AuthClient) Register

func (c *AuthClient) Register(req *RegisterRequest, kvs ...*rony.KeyValue) (*Authorization, error)

type Authorization

type Authorization struct {
	SessionID string `protobuf:"bytes,1,opt,name=SessionID,proto3" json:"SessionID,omitempty"`
	// contains filtered or unexported fields
}

Authorization

func (*Authorization) Clone

func (x *Authorization) Clone() *Authorization

func (*Authorization) DeepCopy

func (x *Authorization) DeepCopy(z *Authorization)

func (*Authorization) Descriptor deprecated

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

Deprecated: Use Authorization.ProtoReflect.Descriptor instead.

func (*Authorization) GetSessionID

func (x *Authorization) GetSessionID() string

func (*Authorization) Marshal

func (x *Authorization) Marshal() ([]byte, error)

func (*Authorization) MarshalJSON

func (x *Authorization) MarshalJSON() ([]byte, error)

func (*Authorization) ProtoMessage

func (*Authorization) ProtoMessage()

func (*Authorization) ProtoReflect

func (x *Authorization) ProtoReflect() protoreflect.Message

func (*Authorization) PushToContext

func (x *Authorization) PushToContext(ctx *edge.RequestCtx)

func (*Authorization) Reset

func (x *Authorization) Reset()

func (*Authorization) String

func (x *Authorization) String() string

func (*Authorization) Unmarshal

func (x *Authorization) Unmarshal(b []byte) error

func (*Authorization) UnmarshalJSON

func (x *Authorization) UnmarshalJSON(b []byte) error

type IAuth

type IAuth interface {
	Register(ctx *edge.RequestCtx, req *RegisterRequest, res *Authorization) *rony.Error
	Login(ctx *edge.RequestCtx, req *LoginRequest, res *Authorization) *rony.Error
}

type IAuthCli

type IAuthCli interface {
	Register(cli *AuthClient, cmd *cobra.Command, args []string) error
	Login(cli *AuthClient, cmd *cobra.Command, args []string) error
}

type LocalRepos

type LocalRepos struct {
	User    *UserLocalRepo
	Session *SessionLocalRepo
}

type LoginRequest

type LoginRequest struct {
	Username string `protobuf:"bytes,1,opt,name=Username,proto3" json:"Username,omitempty"`
	Password string `protobuf:"bytes,4,opt,name=Password,proto3" json:"Password,omitempty"`
	// contains filtered or unexported fields
}

LoginRequest

func (*LoginRequest) Clone

func (x *LoginRequest) Clone() *LoginRequest

func (*LoginRequest) DeepCopy

func (x *LoginRequest) DeepCopy(z *LoginRequest)

func (*LoginRequest) Descriptor deprecated

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

Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.

func (*LoginRequest) GetPassword

func (x *LoginRequest) GetPassword() string

func (*LoginRequest) GetUsername

func (x *LoginRequest) GetUsername() string

func (*LoginRequest) Marshal

func (x *LoginRequest) Marshal() ([]byte, error)

func (*LoginRequest) MarshalJSON

func (x *LoginRequest) MarshalJSON() ([]byte, error)

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) ProtoReflect

func (x *LoginRequest) ProtoReflect() protoreflect.Message

func (*LoginRequest) PushToContext

func (x *LoginRequest) PushToContext(ctx *edge.RequestCtx)

func (*LoginRequest) Reset

func (x *LoginRequest) Reset()

func (*LoginRequest) String

func (x *LoginRequest) String() string

func (*LoginRequest) Unmarshal

func (x *LoginRequest) Unmarshal(b []byte) error

func (*LoginRequest) UnmarshalJSON

func (x *LoginRequest) UnmarshalJSON(b []byte) error

type ModuleBase

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

func New

func New(store *store.Store) ModuleBase

func (ModuleBase) L

func (m ModuleBase) L() LocalRepos

func (ModuleBase) Local

func (m ModuleBase) Local() LocalRepos

type RegisterRequest

type RegisterRequest struct {
	Username  string `protobuf:"bytes,1,opt,name=Username,proto3" json:"Username,omitempty"`
	FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"`
	LastName  string `protobuf:"bytes,3,opt,name=LastName,proto3" json:"LastName,omitempty"`
	Password  string `protobuf:"bytes,4,opt,name=Password,proto3" json:"Password,omitempty"`
	// contains filtered or unexported fields
}

RegisterRequest

func (*RegisterRequest) Clone

func (x *RegisterRequest) Clone() *RegisterRequest

func (*RegisterRequest) DeepCopy

func (x *RegisterRequest) DeepCopy(z *RegisterRequest)

func (*RegisterRequest) Descriptor deprecated

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

Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead.

func (*RegisterRequest) GetFirstName

func (x *RegisterRequest) GetFirstName() string

func (*RegisterRequest) GetLastName

func (x *RegisterRequest) GetLastName() string

func (*RegisterRequest) GetPassword

func (x *RegisterRequest) GetPassword() string

func (*RegisterRequest) GetUsername

func (x *RegisterRequest) GetUsername() string

func (*RegisterRequest) Marshal

func (x *RegisterRequest) Marshal() ([]byte, error)

func (*RegisterRequest) MarshalJSON

func (x *RegisterRequest) MarshalJSON() ([]byte, error)

func (*RegisterRequest) ProtoMessage

func (*RegisterRequest) ProtoMessage()

func (*RegisterRequest) ProtoReflect

func (x *RegisterRequest) ProtoReflect() protoreflect.Message

func (*RegisterRequest) PushToContext

func (x *RegisterRequest) PushToContext(ctx *edge.RequestCtx)

func (*RegisterRequest) Reset

func (x *RegisterRequest) Reset()

func (*RegisterRequest) String

func (x *RegisterRequest) String() string

func (*RegisterRequest) Unmarshal

func (x *RegisterRequest) Unmarshal(b []byte) error

func (*RegisterRequest) UnmarshalJSON

func (x *RegisterRequest) UnmarshalJSON(b []byte) error

type Session

type Session struct {
	ID       string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Username string `protobuf:"bytes,2,opt,name=Username,proto3" json:"Username,omitempty"`
	// contains filtered or unexported fields
}

func (*Session) Clone

func (x *Session) Clone() *Session

func (*Session) DeepCopy

func (x *Session) DeepCopy(z *Session)

func (*Session) Descriptor deprecated

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

Deprecated: Use Session.ProtoReflect.Descriptor instead.

func (*Session) GetID

func (x *Session) GetID() string

func (*Session) GetUsername

func (x *Session) GetUsername() string

func (*Session) Marshal

func (x *Session) Marshal() ([]byte, error)

func (*Session) MarshalJSON

func (x *Session) MarshalJSON() ([]byte, error)

func (*Session) ProtoMessage

func (*Session) ProtoMessage()

func (*Session) ProtoReflect

func (x *Session) ProtoReflect() protoreflect.Message

func (*Session) PushToContext

func (x *Session) PushToContext(ctx *edge.RequestCtx)

func (*Session) Reset

func (x *Session) Reset()

func (*Session) String

func (x *Session) String() string

func (*Session) Unmarshal

func (x *Session) Unmarshal(b []byte) error

func (*Session) UnmarshalJSON

func (x *Session) UnmarshalJSON(b []byte) error

type SessionLocalRepo

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

func NewSessionLocalRepo

func NewSessionLocalRepo(s *store.Store) *SessionLocalRepo

func (*SessionLocalRepo) Create

func (r *SessionLocalRepo) Create(m *Session) error

func (*SessionLocalRepo) CreateWithTxn

func (r *SessionLocalRepo) CreateWithTxn(txn *rony.StoreTxn, alloc *tools.Allocator, m *Session) (err error)

func (*SessionLocalRepo) Delete

func (r *SessionLocalRepo) Delete(id string) error

func (*SessionLocalRepo) DeleteWithTxn

func (r *SessionLocalRepo) DeleteWithTxn(txn *rony.StoreTxn, alloc *tools.Allocator, id string) error

func (*SessionLocalRepo) Iter

func (r *SessionLocalRepo) Iter(
	pk SessionPrimaryKey, ito *store.IterOption, cb func(m *Session) bool,
) error

func (*SessionLocalRepo) IterWithTxn

func (r *SessionLocalRepo) IterWithTxn(
	txn *rony.StoreTxn, alloc *tools.Allocator, offset SessionPrimaryKey, ito *store.IterOption, cb func(m *Session) bool,
) error

func (*SessionLocalRepo) List

func (r *SessionLocalRepo) List(
	pk SessionPrimaryKey, lo *store.ListOption, cond func(m *Session) bool,
) ([]*Session, error)

func (*SessionLocalRepo) ListByUsername

func (r *SessionLocalRepo) ListByUsername(username string, lo *store.ListOption, cond func(*Session) bool) ([]*Session, error)

func (*SessionLocalRepo) ListWithTxn

func (r *SessionLocalRepo) ListWithTxn(
	txn *rony.StoreTxn, alloc *tools.Allocator, offset SessionPrimaryKey, lo *store.ListOption, cond func(m *Session) bool,
) ([]*Session, error)

func (*SessionLocalRepo) Read

func (r *SessionLocalRepo) Read(id string, m *Session) (*Session, error)

func (*SessionLocalRepo) ReadWithTxn

func (r *SessionLocalRepo) ReadWithTxn(txn *rony.StoreTxn, alloc *tools.Allocator, id string, m *Session) (*Session, error)

func (*SessionLocalRepo) Save

func (r *SessionLocalRepo) Save(m *Session) error

func (*SessionLocalRepo) SaveWithTxn

func (r *SessionLocalRepo) SaveWithTxn(txn *rony.StoreTxn, alloc *tools.Allocator, m *Session) (err error)

func (*SessionLocalRepo) Update

func (r *SessionLocalRepo) Update(id string, m *Session) error

func (*SessionLocalRepo) UpdateWithTxn

func (r *SessionLocalRepo) UpdateWithTxn(txn *rony.StoreTxn, alloc *tools.Allocator, m *Session) error

type SessionPK

type SessionPK struct {
	ID string
}

type SessionPrimaryKey

type SessionPrimaryKey interface {
	// contains filtered or unexported methods
}

type User

type User struct {
	Username  string `protobuf:"bytes,1,opt,name=Username,proto3" json:"Username,omitempty"`
	Password  string `protobuf:"bytes,2,opt,name=Password,proto3" json:"Password,omitempty"`
	FirstName string `protobuf:"bytes,3,opt,name=FirstName,proto3" json:"FirstName,omitempty"`
	LastName  string `protobuf:"bytes,4,opt,name=LastName,proto3" json:"LastName,omitempty"`
	// contains filtered or unexported fields
}

func (*User) Clone

func (x *User) Clone() *User

func (*User) DeepCopy

func (x *User) DeepCopy(z *User)

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetFirstName

func (x *User) GetFirstName() string

func (*User) GetLastName

func (x *User) GetLastName() string

func (*User) GetPassword

func (x *User) GetPassword() string

func (*User) GetUsername

func (x *User) GetUsername() string

func (*User) Marshal

func (x *User) Marshal() ([]byte, error)

func (*User) MarshalJSON

func (x *User) MarshalJSON() ([]byte, error)

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

func (x *User) ProtoReflect() protoreflect.Message

func (*User) PushToContext

func (x *User) PushToContext(ctx *edge.RequestCtx)

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

func (*User) Unmarshal

func (x *User) Unmarshal(b []byte) error

func (*User) UnmarshalJSON

func (x *User) UnmarshalJSON(b []byte) error

type UserLocalRepo

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

func NewUserLocalRepo

func NewUserLocalRepo(s *store.Store) *UserLocalRepo

func (*UserLocalRepo) Create

func (r *UserLocalRepo) Create(m *User) error

func (*UserLocalRepo) CreateWithTxn

func (r *UserLocalRepo) CreateWithTxn(txn *rony.StoreTxn, alloc *tools.Allocator, m *User) (err error)

func (*UserLocalRepo) Delete

func (r *UserLocalRepo) Delete(username string) error

func (*UserLocalRepo) DeleteWithTxn

func (r *UserLocalRepo) DeleteWithTxn(txn *rony.StoreTxn, alloc *tools.Allocator, username string) error

func (*UserLocalRepo) Iter

func (r *UserLocalRepo) Iter(
	pk UserPrimaryKey, ito *store.IterOption, cb func(m *User) bool,
) error

func (*UserLocalRepo) IterWithTxn

func (r *UserLocalRepo) IterWithTxn(
	txn *rony.StoreTxn, alloc *tools.Allocator, offset UserPrimaryKey, ito *store.IterOption, cb func(m *User) bool,
) error

func (*UserLocalRepo) List

func (r *UserLocalRepo) List(
	pk UserPrimaryKey, lo *store.ListOption, cond func(m *User) bool,
) ([]*User, error)

func (*UserLocalRepo) ListWithTxn

func (r *UserLocalRepo) ListWithTxn(
	txn *rony.StoreTxn, alloc *tools.Allocator, offset UserPrimaryKey, lo *store.ListOption, cond func(m *User) bool,
) ([]*User, error)

func (*UserLocalRepo) Read

func (r *UserLocalRepo) Read(username string, m *User) (*User, error)

func (*UserLocalRepo) ReadWithTxn

func (r *UserLocalRepo) ReadWithTxn(txn *rony.StoreTxn, alloc *tools.Allocator, username string, m *User) (*User, error)

func (*UserLocalRepo) Save

func (r *UserLocalRepo) Save(m *User) error

func (*UserLocalRepo) SaveWithTxn

func (r *UserLocalRepo) SaveWithTxn(txn *rony.StoreTxn, alloc *tools.Allocator, m *User) (err error)

func (*UserLocalRepo) Update

func (r *UserLocalRepo) Update(username string, m *User) error

func (*UserLocalRepo) UpdateWithTxn

func (r *UserLocalRepo) UpdateWithTxn(txn *rony.StoreTxn, alloc *tools.Allocator, m *User) error

type UserPK

type UserPK struct {
	Username string
}

type UserPrimaryKey

type UserPrimaryKey interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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