Documentation ¶
Index ¶
- Constants
- func NewClientTokenInterceptor(tokenGetter TokenGetter) grpc.UnaryClientInterceptor
- func RegisterAuthServer(s *grpc.Server, srv AuthServer)
- type AuthClient
- type AuthServer
- type LoginReply
- func (*LoginReply) Descriptor() ([]byte, []int)
- func (m *LoginReply) GetAccessToken() string
- func (*LoginReply) ProtoMessage()
- func (m *LoginReply) Reset()
- func (m *LoginReply) String() string
- func (m *LoginReply) XXX_DiscardUnknown()
- func (m *LoginReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LoginReply) XXX_Merge(src proto.Message)
- func (m *LoginReply) XXX_Size() int
- func (m *LoginReply) XXX_Unmarshal(b []byte) error
- type LoginRequest
- func (*LoginRequest) Descriptor() ([]byte, []int)
- func (m *LoginRequest) GetPassword() string
- func (m *LoginRequest) GetUsername() string
- func (*LoginRequest) ProtoMessage()
- func (m *LoginRequest) Reset()
- func (m *LoginRequest) String() string
- func (m *LoginRequest) XXX_DiscardUnknown()
- func (m *LoginRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LoginRequest) XXX_Merge(src proto.Message)
- func (m *LoginRequest) XXX_Size() int
- func (m *LoginRequest) XXX_Unmarshal(b []byte) error
- type LoginSrvServer
- func (s *LoginSrvServer) AttemptLogin(ctx context.Context, request *LoginRequest) (*LoginReply, error)
- func (s *LoginSrvServer) AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error)
- func (s *LoginSrvServer) Authenticate(ctx context.Context) (context.Context, error)
- func (s *LoginSrvServer) GetProfile(ctx context.Context, profileRequest *ProfileRequest) (*Profile, error)
- func (s *LoginSrvServer) RefreshToken(ctx context.Context, request *RefreshRequest) (*LoginReply, error)
- type Option
- type Profile
- func (*Profile) Descriptor() ([]byte, []int)
- func (m *Profile) GetDomain() string
- func (m *Profile) GetEmail() string
- func (m *Profile) GetExpiry() int64
- func (m *Profile) GetGroups() []string
- func (m *Profile) GetName() string
- func (m *Profile) GetOrigin() string
- func (m *Profile) GetPicture() string
- func (m *Profile) GetRefreshes() int32
- func (m *Profile) GetSub() string
- func (*Profile) ProtoMessage()
- func (m *Profile) Reset()
- func (m *Profile) String() string
- func (m *Profile) XXX_DiscardUnknown()
- func (m *Profile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Profile) XXX_Merge(src proto.Message)
- func (m *Profile) XXX_Size() int
- func (m *Profile) XXX_Unmarshal(b []byte) error
- type ProfileRequest
- func (*ProfileRequest) Descriptor() ([]byte, []int)
- func (*ProfileRequest) ProtoMessage()
- func (m *ProfileRequest) Reset()
- func (m *ProfileRequest) String() string
- func (m *ProfileRequest) XXX_DiscardUnknown()
- func (m *ProfileRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ProfileRequest) XXX_Merge(src proto.Message)
- func (m *ProfileRequest) XXX_Size() int
- func (m *ProfileRequest) XXX_Unmarshal(b []byte) error
- type RefreshRequest
- func (*RefreshRequest) Descriptor() ([]byte, []int)
- func (*RefreshRequest) ProtoMessage()
- func (m *RefreshRequest) Reset()
- func (m *RefreshRequest) String() string
- func (m *RefreshRequest) XXX_DiscardUnknown()
- func (m *RefreshRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *RefreshRequest) XXX_Merge(src proto.Message)
- func (m *RefreshRequest) XXX_Size() int
- func (m *RefreshRequest) XXX_Unmarshal(b []byte) error
- type TokenGetter
- type UnimplementedAuthServer
- func (*UnimplementedAuthServer) AttemptLogin(ctx context.Context, req *LoginRequest) (*LoginReply, error)
- func (*UnimplementedAuthServer) GetProfile(ctx context.Context, req *ProfileRequest) (*Profile, error)
- func (*UnimplementedAuthServer) RefreshToken(ctx context.Context, req *RefreshRequest) (*LoginReply, error)
Constants ¶
const (
// AuthTokenMetadataKey is the key of for auth token in the metadata of RPCs
AuthTokenMetadataKey = "authorization"
)
Variables ¶
This section is empty.
Functions ¶
func NewClientTokenInterceptor ¶
func NewClientTokenInterceptor(tokenGetter TokenGetter) grpc.UnaryClientInterceptor
NewClientTokenInterceptor attaches a token to the outgoing RPC
func RegisterAuthServer ¶
func RegisterAuthServer(s *grpc.Server, srv AuthServer)
Types ¶
type AuthClient ¶
type AuthClient interface { AttemptLogin(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error) RefreshToken(ctx context.Context, in *RefreshRequest, opts ...grpc.CallOption) (*LoginReply, error) GetProfile(ctx context.Context, in *ProfileRequest, opts ...grpc.CallOption) (*Profile, error) }
AuthClient is the client API for Auth service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewAuthClient ¶
func NewAuthClient(cc *grpc.ClientConn) AuthClient
type AuthServer ¶
type AuthServer interface { AttemptLogin(context.Context, *LoginRequest) (*LoginReply, error) RefreshToken(context.Context, *RefreshRequest) (*LoginReply, error) GetProfile(context.Context, *ProfileRequest) (*Profile, error) }
AuthServer is the server API for Auth service.
type LoginReply ¶
type LoginReply struct { AccessToken string `protobuf:"bytes,1,opt,name=accessToken,proto3" json:"accessToken,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*LoginReply) Descriptor ¶
func (*LoginReply) Descriptor() ([]byte, []int)
func (*LoginReply) GetAccessToken ¶
func (m *LoginReply) GetAccessToken() string
func (*LoginReply) ProtoMessage ¶
func (*LoginReply) ProtoMessage()
func (*LoginReply) Reset ¶
func (m *LoginReply) Reset()
func (*LoginReply) String ¶
func (m *LoginReply) String() string
func (*LoginReply) XXX_DiscardUnknown ¶
func (m *LoginReply) XXX_DiscardUnknown()
func (*LoginReply) XXX_Marshal ¶
func (m *LoginReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*LoginReply) XXX_Merge ¶
func (m *LoginReply) XXX_Merge(src proto.Message)
func (*LoginReply) XXX_Size ¶
func (m *LoginReply) XXX_Size() int
func (*LoginReply) XXX_Unmarshal ¶
func (m *LoginReply) XXX_Unmarshal(b []byte) error
type LoginRequest ¶
type LoginRequest 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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*LoginRequest) Descriptor ¶
func (*LoginRequest) Descriptor() ([]byte, []int)
func (*LoginRequest) GetPassword ¶
func (m *LoginRequest) GetPassword() string
func (*LoginRequest) GetUsername ¶
func (m *LoginRequest) GetUsername() string
func (*LoginRequest) ProtoMessage ¶
func (*LoginRequest) ProtoMessage()
func (*LoginRequest) Reset ¶
func (m *LoginRequest) Reset()
func (*LoginRequest) String ¶
func (m *LoginRequest) String() string
func (*LoginRequest) XXX_DiscardUnknown ¶
func (m *LoginRequest) XXX_DiscardUnknown()
func (*LoginRequest) XXX_Marshal ¶
func (m *LoginRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*LoginRequest) XXX_Merge ¶
func (m *LoginRequest) XXX_Merge(src proto.Message)
func (*LoginRequest) XXX_Size ¶
func (m *LoginRequest) XXX_Size() int
func (*LoginRequest) XXX_Unmarshal ¶
func (m *LoginRequest) XXX_Unmarshal(b []byte) error
type LoginSrvServer ¶
type LoginSrvServer struct { UnimplementedAuthServer // contains filtered or unexported fields }
LoginSrvServer proxies the REST api though grpc
func NewLoginSrvServer ¶
func NewLoginSrvServer(url string, options ...Option) *LoginSrvServer
NewLoginSrvServer creates the AuthServer
func (*LoginSrvServer) AttemptLogin ¶
func (s *LoginSrvServer) AttemptLogin(ctx context.Context, request *LoginRequest) (*LoginReply, error)
AttemptLogin is a basic authentication
func (*LoginSrvServer) AuthFuncOverride ¶
func (s *LoginSrvServer) AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error)
AuthFuncOverride used internally to skip authentication for login route
func (*LoginSrvServer) Authenticate ¶
Authenticate asserts a token is attached to the RPC context clients can attach it with NewClientTokenInterceptor
func (*LoginSrvServer) GetProfile ¶
func (s *LoginSrvServer) GetProfile(ctx context.Context, profileRequest *ProfileRequest) (*Profile, error)
GetProfile returns the user profile
func (*LoginSrvServer) RefreshToken ¶
func (s *LoginSrvServer) RefreshToken(ctx context.Context, request *RefreshRequest) (*LoginReply, error)
RefreshToken refreshes the token sent through the context metadata
type Option ¶
type Option func(*LoginSrvServer)
Option allows functional configuration for the loginServer
type Profile ¶
type Profile struct { Sub string `protobuf:"bytes,1,opt,name=Sub,proto3" json:"Sub,omitempty"` Picture string `protobuf:"bytes,2,opt,name=Picture,proto3" json:"Picture,omitempty"` Name string `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"` Email string `protobuf:"bytes,4,opt,name=Email,proto3" json:"Email,omitempty"` Origin string `protobuf:"bytes,5,opt,name=Origin,proto3" json:"Origin,omitempty"` Expiry int64 `protobuf:"varint,6,opt,name=Expiry,proto3" json:"Expiry,omitempty"` Refreshes int32 `protobuf:"varint,7,opt,name=Refreshes,proto3" json:"Refreshes,omitempty"` Domain string `protobuf:"bytes,8,opt,name=Domain,proto3" json:"Domain,omitempty"` Groups []string `protobuf:"bytes,9,rep,name=Groups,proto3" json:"Groups,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Profile) Descriptor ¶
func (*Profile) GetPicture ¶
func (*Profile) GetRefreshes ¶
func (*Profile) ProtoMessage ¶
func (*Profile) ProtoMessage()
func (*Profile) XXX_DiscardUnknown ¶
func (m *Profile) XXX_DiscardUnknown()
func (*Profile) XXX_Marshal ¶
func (*Profile) XXX_Unmarshal ¶
type ProfileRequest ¶
type ProfileRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ProfileRequest) Descriptor ¶
func (*ProfileRequest) Descriptor() ([]byte, []int)
func (*ProfileRequest) ProtoMessage ¶
func (*ProfileRequest) ProtoMessage()
func (*ProfileRequest) Reset ¶
func (m *ProfileRequest) Reset()
func (*ProfileRequest) String ¶
func (m *ProfileRequest) String() string
func (*ProfileRequest) XXX_DiscardUnknown ¶
func (m *ProfileRequest) XXX_DiscardUnknown()
func (*ProfileRequest) XXX_Marshal ¶
func (m *ProfileRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ProfileRequest) XXX_Merge ¶
func (m *ProfileRequest) XXX_Merge(src proto.Message)
func (*ProfileRequest) XXX_Size ¶
func (m *ProfileRequest) XXX_Size() int
func (*ProfileRequest) XXX_Unmarshal ¶
func (m *ProfileRequest) XXX_Unmarshal(b []byte) error
type RefreshRequest ¶
type RefreshRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*RefreshRequest) Descriptor ¶
func (*RefreshRequest) Descriptor() ([]byte, []int)
func (*RefreshRequest) ProtoMessage ¶
func (*RefreshRequest) ProtoMessage()
func (*RefreshRequest) Reset ¶
func (m *RefreshRequest) Reset()
func (*RefreshRequest) String ¶
func (m *RefreshRequest) String() string
func (*RefreshRequest) XXX_DiscardUnknown ¶
func (m *RefreshRequest) XXX_DiscardUnknown()
func (*RefreshRequest) XXX_Marshal ¶
func (m *RefreshRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RefreshRequest) XXX_Merge ¶
func (m *RefreshRequest) XXX_Merge(src proto.Message)
func (*RefreshRequest) XXX_Size ¶
func (m *RefreshRequest) XXX_Size() int
func (*RefreshRequest) XXX_Unmarshal ¶
func (m *RefreshRequest) XXX_Unmarshal(b []byte) error
type UnimplementedAuthServer ¶
type UnimplementedAuthServer struct { }
UnimplementedAuthServer can be embedded to have forward compatible implementations.
func (*UnimplementedAuthServer) AttemptLogin ¶
func (*UnimplementedAuthServer) AttemptLogin(ctx context.Context, req *LoginRequest) (*LoginReply, error)
func (*UnimplementedAuthServer) GetProfile ¶
func (*UnimplementedAuthServer) GetProfile(ctx context.Context, req *ProfileRequest) (*Profile, error)
func (*UnimplementedAuthServer) RefreshToken ¶
func (*UnimplementedAuthServer) RefreshToken(ctx context.Context, req *RefreshRequest) (*LoginReply, error)