Documentation ¶
Index ¶
- Constants
- Variables
- func Code(err error) codes.Code
- func Error(c codes.Code, msg string) error
- func Errorf(c codes.Code, msg string, a ...interface{}) error
- func Is(err, target error) bool
- func LoggingMiddleware(logger log.Logger, methodName string) endpoint.Middleware
- func NewPBFromAuthRequest(msg *AuthRequest) *pb.AuthRequest
- func NewPBFromAuthResponse(msg *AuthResponse) *pb.AuthResponse
- func NewPBFromDelKeysRequest(msg *DelKeysRequest) *pb.DelKeysRequest
- func NewPBFromDelKeysResponse(msg *DelKeysResponse) *pb.DelKeysResponse
- func NewPBFromListKeysRequest(msg *ListKeysRequest) *pb.ListKeysRequest
- func NewPBFromListKeysResponse(msg *ListKeysResponse) *pb.ListKeysResponse
- func NewPBFromNewJWTRequest(msg *NewJWTRequest) *pb.NewJWTRequest
- func NewPBFromNewJWTResponse(msg *NewJWTResponse) *pb.NewJWTResponse
- func NewPBFromPingRequest(msg *PingRequest) *pb.PingRequest
- func NewPBFromPingResponse(msg *PingResponse) *pb.PingResponse
- func NewPBFromPublicKeysRequest(msg *PublicKeysRequest) *pb.PublicKeysRequest
- func NewPBFromPublicKeysResponse(msg *PublicKeysResponse) *pb.PublicKeysResponse
- func NewPBFromReadyRequest(msg *ReadyRequest) *pb.ReadyRequest
- func NewPBFromReadyResponse(msg *ReadyResponse) *pb.ReadyResponse
- func NewPBFromRegisterRequest(msg *RegisterRequest) *pb.RegisterRequest
- func NewPBFromRegisterResponse(msg *RegisterResponse) *pb.RegisterResponse
- func NewPBFromRenewJWTRequest(msg *RenewJWTRequest) *pb.RenewJWTRequest
- func NewPBFromRenewJWTResponse(msg *RenewJWTResponse) *pb.RenewJWTResponse
- func NewPBFromRevokeJWTRequest(msg *RevokeJWTRequest) *pb.RevokeJWTRequest
- func NewPBFromRevokeJWTResponse(msg *RevokeJWTResponse) *pb.RevokeJWTResponse
- func NewPBFromUpdateKeysRequest(msg *UpdateKeysRequest) *pb.UpdateKeysRequest
- func NewPBFromUpdateKeysResponse(msg *UpdateKeysResponse) *pb.UpdateKeysResponse
- func StreamServerInterceptor() grpc.StreamServerInterceptor
- func UnaryServerErrorInterceptor() grpc.UnaryServerInterceptor
- func WrapErr(err error, c codes.Code, msg string) error
- func WrapErrf(err error, c codes.Code, msg string, a ...interface{}) error
- type AuthRequest
- type AuthResponse
- type ClientOption
- type ClientRequestFunc
- type ClientResponseFunc
- type ClientService
- type DelKeysRequest
- type DelKeysResponse
- type Endpoints
- type GRPCServer
- func (s *GRPCServer) Auth(ctx context.Context, req *pb.AuthRequest) (*pb.AuthResponse, error)
- func (s *GRPCServer) DelKeys(ctx context.Context, req *pb.DelKeysRequest) (*pb.DelKeysResponse, error)
- func (s *GRPCServer) ListKeys(req *pb.ListKeysRequest, stream pb.JWTISService_ListKeysServer) error
- func (s *GRPCServer) NewJWT(ctx context.Context, req *pb.NewJWTRequest) (*pb.NewJWTResponse, error)
- func (s *GRPCServer) Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResponse, error)
- func (s *GRPCServer) PublicKeys(ctx context.Context, req *pb.PublicKeysRequest) (*pb.PublicKeysResponse, error)
- func (s *GRPCServer) Ready(ctx context.Context, req *pb.ReadyRequest) (*pb.ReadyResponse, error)
- func (s *GRPCServer) Register(ctx context.Context, req *pb.RegisterRequest) (*pb.RegisterResponse, error)
- func (s *GRPCServer) RenewJWT(ctx context.Context, req *pb.RenewJWTRequest) (*pb.RenewJWTResponse, error)
- func (s *GRPCServer) RevokeJWT(ctx context.Context, req *pb.RevokeJWTRequest) (*pb.RevokeJWTResponse, error)
- func (s *GRPCServer) UpdateKeys(ctx context.Context, req *pb.UpdateKeysRequest) (*pb.UpdateKeysResponse, error)
- type JWTPair
- type KeysOptions
- type ListKeysRequest
- type ListKeysResponse
- type NewJWTRequest
- type NewJWTResponse
- type PingRequest
- type PingResponse
- type PublicKeysRequest
- type PublicKeysResponse
- type ReadyRequest
- type ReadyResponse
- type RegisterRequest
- type RegisterResponse
- type RenewJWTRequest
- type RenewJWTResponse
- type Repository
- type RequestAndStreamListKeys
- type RevokeJWTRequest
- type RevokeJWTResponse
- type ServerService
- type Service
- type Status
- type UpdateKeysRequest
- type UpdateKeysResponse
Constants ¶
const ( // StrategyRefreshBoth refresh strategy to issue refresh token on every access token renew StrategyRefreshBoth = "refreshBoth" // StrategyRefreshOnExpire refresh strategy to issue refresh token if it's expiration time is close StrategyRefreshOnExpire = "refreshOnExpire" // StrategyNoRefresh refresh strategy means refresh token issue must be explicit, only by calling NewJWT StrategyNoRefresh = "noRefresh" )
Variables ¶
var ( // ErrInternal error, followed by codes.Internal ErrInternal = errors.New("internal error") // ErrInvalidArgument error, followed by codes.InvalidArgument ErrInvalidArgument = errors.New("invalid request argument error") // ErrDecodeGRPCRequest error ErrDecodeGRPCRequest = errors.Wrap(ErrInternal, "decode GRPC request error") // ErrEncodeGRPCResponse error ErrEncodeGRPCResponse = errors.Wrap(ErrInternal, "encode GRPC response error") // ErrNotExpectedGRPCRequestType error ErrNotExpectedGRPCRequestType = errors.Wrap(ErrInvalidArgument, "not expected grpc request type") // ErrNotExpectedGRPCResponseType error ErrNotExpectedGRPCResponseType = errors.Wrap(ErrInternal, "not expected grpc response type") // ErrNotExpectedProtoGRPCResponseType error ErrNotExpectedProtoGRPCResponseType = errors.Wrap(ErrInternal, "not expected proto grpc response type") // ErrUnmarshalRequest error ErrUnmarshalRequest = errors.Wrap(ErrInvalidArgument, "error unmarshal request") // ErrMarshalRequest error ErrMarshalRequest = errors.Wrap(ErrInternal, "error marshal request") // ErrUnmarshalResponse error ErrUnmarshalResponse = errors.Wrap(ErrInternal, "error unmarshal response") // ErrMarshalResponse error ErrMarshalResponse = errors.Wrap(ErrInternal, "error marshal response") // ErrMarshalResponseKey error ErrMarshalResponseKey = errors.Wrap(ErrInternal, "marshal response key error") // ErrUnimplemented error ErrUnimplemented = errors.Wrap(ErrInternal, "unimplemented method") // ErrInvalidKID error ErrInvalidKID = errors.Wrap(ErrInvalidArgument, "invalid KID") // ErrInvalidClaims error ErrInvalidClaims = errors.Wrap(ErrInvalidArgument, "invalid Claims") // ErrKIDNotExists error ErrKIDNotExists = errors.Wrap(ErrInvalidArgument, "enc, sig keys are not found for requested kid") // ErrDecryptRefreshToken error ErrDecryptRefreshToken = errors.Wrap(ErrInvalidArgument, "refresh token couldn't be decrypted") // ErrInvalidRefreshToken error ErrInvalidRefreshToken = errors.Wrap(ErrInvalidArgument, "invalid refresh token") // ErrRefreshTokenExpired error ErrRefreshTokenExpired = errors.Wrap(ErrInvalidRefreshToken, "refresh token expired") // ErrInvalidRefreshClaims error ErrInvalidRefreshClaims = errors.Wrap(ErrInvalidRefreshToken, "invalid refresh token claims") // ErrNullKeysRepo error ErrNullKeysRepo = errors.Wrap(ErrInternal, "keys repository pointer is null") )
Functions ¶
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger, methodName string) endpoint.Middleware
LoggingMiddleware returns an endpoint middleware that logs the duration of each invocation, and the resulting error, if any.
func NewPBFromAuthRequest ¶
func NewPBFromAuthRequest(msg *AuthRequest) *pb.AuthRequest
NewPBFromAuthRequest transformer *AuthRequest to *pb.AuthRequest
func NewPBFromAuthResponse ¶
func NewPBFromAuthResponse(msg *AuthResponse) *pb.AuthResponse
NewPBFromAuthResponse transformer *AuthResponse to *pb.AuthResponse
func NewPBFromDelKeysRequest ¶
func NewPBFromDelKeysRequest(msg *DelKeysRequest) *pb.DelKeysRequest
NewPBFromDelKeysRequest transformer *DelKeysRequest to *pb.DelKeysRequest
func NewPBFromDelKeysResponse ¶
func NewPBFromDelKeysResponse(msg *DelKeysResponse) *pb.DelKeysResponse
NewPBFromDelKeysResponse transformer *DelKeysResponse to *pb.DelKeysResponse
func NewPBFromListKeysRequest ¶
func NewPBFromListKeysRequest(msg *ListKeysRequest) *pb.ListKeysRequest
NewPBFromListKeysRequest transformer *ListKeysRequest to *pb.ListKeysRequest
func NewPBFromListKeysResponse ¶
func NewPBFromListKeysResponse(msg *ListKeysResponse) *pb.ListKeysResponse
NewPBFromListKeysResponse transformer *ListKeysResponse to *pb.ListKeysResponse
func NewPBFromNewJWTRequest ¶
func NewPBFromNewJWTRequest(msg *NewJWTRequest) *pb.NewJWTRequest
NewPBFromNewJWTRequest transformer *NewJWTRequest to *pb.NewJWTRequest
func NewPBFromNewJWTResponse ¶
func NewPBFromNewJWTResponse(msg *NewJWTResponse) *pb.NewJWTResponse
NewPBFromNewJWTResponse transformer *NewJWTResponse to *pb.NewJWTResponse
func NewPBFromPingRequest ¶
func NewPBFromPingRequest(msg *PingRequest) *pb.PingRequest
NewPBFromPingRequest transformer *PingRequest to *pb.PingRequest
func NewPBFromPingResponse ¶
func NewPBFromPingResponse(msg *PingResponse) *pb.PingResponse
NewPBFromPingResponse transformer *PingResponse to *pb.PingResponse
func NewPBFromPublicKeysRequest ¶
func NewPBFromPublicKeysRequest(msg *PublicKeysRequest) *pb.PublicKeysRequest
NewPBFromPublicKeysRequest transformer *PublicKeysRequest to *pb.PublicKeysRequest
func NewPBFromPublicKeysResponse ¶
func NewPBFromPublicKeysResponse(msg *PublicKeysResponse) *pb.PublicKeysResponse
NewPBFromPublicKeysResponse transformer *PublicKeysResponse to *pb.PublicKeysResponse
func NewPBFromReadyRequest ¶
func NewPBFromReadyRequest(msg *ReadyRequest) *pb.ReadyRequest
NewPBFromReadyRequest transformer *ReadyRequest to *pb.ReadyRequest
func NewPBFromReadyResponse ¶
func NewPBFromReadyResponse(msg *ReadyResponse) *pb.ReadyResponse
NewPBFromReadyResponse transformer *ReadyResponse to *pb.ReadyResponse
func NewPBFromRegisterRequest ¶
func NewPBFromRegisterRequest(msg *RegisterRequest) *pb.RegisterRequest
NewPBFromRegisterRequest transformer *RegisterRequest to *pb.RegisterRequest
func NewPBFromRegisterResponse ¶
func NewPBFromRegisterResponse(msg *RegisterResponse) *pb.RegisterResponse
NewPBFromRegisterResponse transformer *RegisterResponse to *pb.RegisterResponse
func NewPBFromRenewJWTRequest ¶
func NewPBFromRenewJWTRequest(msg *RenewJWTRequest) *pb.RenewJWTRequest
NewPBFromRenewJWTRequest transformer *RenewJWTRequest to *pb.RenewJWTRequest
func NewPBFromRenewJWTResponse ¶
func NewPBFromRenewJWTResponse(msg *RenewJWTResponse) *pb.RenewJWTResponse
NewPBFromRenewJWTResponse transformer *RenewJWTResponse to *pb.RenewJWTResponse
func NewPBFromRevokeJWTRequest ¶
func NewPBFromRevokeJWTRequest(msg *RevokeJWTRequest) *pb.RevokeJWTRequest
NewPBFromRevokeJWTRequest transformer *RevokeJWTRequest to *pb.RevokeJWTRequest
func NewPBFromRevokeJWTResponse ¶
func NewPBFromRevokeJWTResponse(msg *RevokeJWTResponse) *pb.RevokeJWTResponse
NewPBFromRevokeJWTResponse transformer *RevokeJWTResponse to *pb.RevokeJWTResponse
func NewPBFromUpdateKeysRequest ¶
func NewPBFromUpdateKeysRequest(msg *UpdateKeysRequest) *pb.UpdateKeysRequest
NewPBFromUpdateKeysRequest transformer *UpdateKeysRequest to *pb.UpdateKeysRequest
func NewPBFromUpdateKeysResponse ¶
func NewPBFromUpdateKeysResponse(msg *UpdateKeysResponse) *pb.UpdateKeysResponse
NewPBFromUpdateKeysResponse transformer *UpdateKeysResponse to *pb.UpdateKeysResponse
func StreamServerInterceptor ¶
func StreamServerInterceptor() grpc.StreamServerInterceptor
StreamServerInterceptor returns a new streaming server interceptor for panic recovery.
func UnaryServerErrorInterceptor ¶
func UnaryServerErrorInterceptor() grpc.UnaryServerInterceptor
UnaryServerErrorInterceptor returns a new unary server interceptor for error handling
Types ¶
type AuthRequest ¶
type AuthRequest struct {
KID string
}
AuthRequest message type
func NewAuthRequestFromPB ¶
func NewAuthRequestFromPB(msg *pb.AuthRequest) *AuthRequest
NewAuthRequestFromPB transformer *pb.AuthRequest to *AuthRequest
type AuthResponse ¶
type AuthResponse struct {
AuthJWT string
}
AuthResponse message type
func NewAuthResponseFromPB ¶
func NewAuthResponseFromPB(msg *pb.AuthResponse) *AuthResponse
NewAuthResponseFromPB transformer *pb.AuthResponse to *AuthResponse
type ClientRequestFunc ¶
ClientRequestFunc func
type ClientResponseFunc ¶
ClientResponseFunc func
type ClientService ¶
type ClientService interface { Service ApplyExtraOptions(options ...ClientOption) ReceiveListKeys() chan ListKeysResponse CallListKeys(extCtx context.Context, inReq *ListKeysRequest) error FetchListKeys(extCtx context.Context, inReq *ListKeysRequest) ([]*ListKeysResponse, error) }
ClientService interface
func NewClient ¶
func NewClient(conn *grpc.ClientConn, logger log.Logger, options ...kitGRPC.ClientOption) ClientService
NewClient constructor
type DelKeysRequest ¶
type DelKeysRequest struct {
KID string
}
DelKeysRequest message type
func NewDelKeysRequestFromPB ¶
func NewDelKeysRequestFromPB(msg *pb.DelKeysRequest) *DelKeysRequest
NewDelKeysRequestFromPB transformer *pb.DelKeysRequest to *DelKeysRequest
type DelKeysResponse ¶
type DelKeysResponse struct { }
DelKeysResponse message type
func NewDelKeysResponseFromPB ¶
func NewDelKeysResponseFromPB(msg *pb.DelKeysResponse) *DelKeysResponse
NewDelKeysResponseFromPB transformer *pb.DelKeysResponse to *DelKeysResponse
type Endpoints ¶
type Endpoints struct { NewJWTEndpoint endpoint.Endpoint RenewJWTEndpoint endpoint.Endpoint RevokeJWTEndpoint endpoint.Endpoint AuthEndpoint endpoint.Endpoint RegisterEndpoint endpoint.Endpoint UpdateKeysEndpoint endpoint.Endpoint ListKeysEndpoint endpoint.Endpoint // half duplex DelKeysEndpoint endpoint.Endpoint PublicKeysEndpoint endpoint.Endpoint PingEndpoint endpoint.Endpoint ReadyEndpoint endpoint.Endpoint }
Endpoints struct holds gokit endpoints
func MakeEndpoints ¶
func MakeEndpoints(svc Service, mwares []endpoint.Middleware) Endpoints
MakeEndpoints constructor
func (*Endpoints) WithLogging ¶
WithLogging adds logging middleware
type GRPCServer ¶
type GRPCServer struct { NewJWTGRPCHandler kitGRPC.Handler RenewJWTGRPCHandler kitGRPC.Handler RevokeJWTGRPCHandler kitGRPC.Handler AuthGRPCHandler kitGRPC.Handler RegisterGRPCHandler kitGRPC.Handler UpdateKeysGRPCHandler kitGRPC.Handler ListKeysGRPCHandler kitGRPC.Handler // TODO : half duplex DelKeysGRPCHandler kitGRPC.Handler PublicKeysGRPCHandler kitGRPC.Handler PingGRPCHandler kitGRPC.Handler ReadyGRPCHandler kitGRPC.Handler // contains filtered or unexported fields }
GRPCServer struct holds gokit handlers
func NewGRPCServer ¶
func NewGRPCServer(endpoints Endpoints, logger log.Logger, options ...kitGRPC.ServerOption) (*GRPCServer, error)
NewGRPCServer constructor
func (*GRPCServer) Auth ¶
func (s *GRPCServer) Auth(ctx context.Context, req *pb.AuthRequest) (*pb.AuthResponse, error)
Auth protobuf implementation : no streaming for Auth
func (*GRPCServer) DelKeys ¶
func (s *GRPCServer) DelKeys(ctx context.Context, req *pb.DelKeysRequest) (*pb.DelKeysResponse, error)
DelKeys protobuf implementation : no streaming for DelKeys
func (*GRPCServer) ListKeys ¶
func (s *GRPCServer) ListKeys(req *pb.ListKeysRequest, stream pb.JWTISService_ListKeysServer) error
ListKeys protobuf implementation : half duplex for ListKeys
func (*GRPCServer) NewJWT ¶
func (s *GRPCServer) NewJWT(ctx context.Context, req *pb.NewJWTRequest) (*pb.NewJWTResponse, error)
NewJWT protobuf implementation : no streaming for NewJWT
func (*GRPCServer) Ping ¶
func (s *GRPCServer) Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResponse, error)
Ping protobuf implementation : no streaming for Ping
func (*GRPCServer) PublicKeys ¶
func (s *GRPCServer) PublicKeys(ctx context.Context, req *pb.PublicKeysRequest) (*pb.PublicKeysResponse, error)
PublicKeys protobuf implementation : no streaming for PublicKeys
func (*GRPCServer) Ready ¶
func (s *GRPCServer) Ready(ctx context.Context, req *pb.ReadyRequest) (*pb.ReadyResponse, error)
Ready protobuf implementation : no streaming for Ready
func (*GRPCServer) Register ¶
func (s *GRPCServer) Register(ctx context.Context, req *pb.RegisterRequest) (*pb.RegisterResponse, error)
Register protobuf implementation : no streaming for Register
func (*GRPCServer) RenewJWT ¶
func (s *GRPCServer) RenewJWT(ctx context.Context, req *pb.RenewJWTRequest) (*pb.RenewJWTResponse, error)
RenewJWT protobuf implementation : no streaming for RenewJWT
func (*GRPCServer) RevokeJWT ¶
func (s *GRPCServer) RevokeJWT(ctx context.Context, req *pb.RevokeJWTRequest) (*pb.RevokeJWTResponse, error)
RevokeJWT protobuf implementation : no streaming for RevokeJWT
func (*GRPCServer) UpdateKeys ¶
func (s *GRPCServer) UpdateKeys(ctx context.Context, req *pb.UpdateKeysRequest) (*pb.UpdateKeysResponse, error)
UpdateKeys protobuf implementation : no streaming for UpdateKeys
type JWTPair ¶
type JWTPair struct { ID string `json:"id"` AccessToken string `json:"access_token"` // Short lived auth token RefreshToken string `json:"refresh_token,omitempty"` // Long lived refresh token Expiry jwt.NumericDate `json:"expiry,omitempty"` }
JWTPair holds auth and refresh tokens
type KeysOptions ¶
type KeysOptions struct { SigAlg string // Algorithm to be used for sign SigBits int // Key size in bits for sign EncAlg string // Algorithm to be used for encrypt EncBits int // Key size in bits for encrypt Expiry time.Duration // Value for keys ttl AuthTTL time.Duration // Value for auth jwt ttl RefreshTTL time.Duration // Value for refresh jwt ttl RefreshStrategy string // optional, values are: 'refreshBoth', 'refreshOnExpire', 'noRefresh' (default) }
KeysOptions represents default sig ang enc options
type ListKeysRequest ¶
type ListKeysRequest struct {
Query string
}
ListKeysRequest message type
func NewListKeysRequestFromPB ¶
func NewListKeysRequestFromPB(msg *pb.ListKeysRequest) *ListKeysRequest
NewListKeysRequestFromPB transformer *pb.ListKeysRequest to *ListKeysRequest
type ListKeysResponse ¶
ListKeysResponse message type
func NewListKeysResponseFromPB ¶
func NewListKeysResponseFromPB(msg *pb.ListKeysResponse) *ListKeysResponse
NewListKeysResponseFromPB transformer *pb.ListKeysResponse to *ListKeysResponse
type NewJWTRequest ¶
NewJWTRequest message type
func NewNewJWTRequestFromPB ¶
func NewNewJWTRequestFromPB(msg *pb.NewJWTRequest) *NewJWTRequest
NewNewJWTRequestFromPB transformer *pb.NewJWTRequest to *NewJWTRequest
type NewJWTResponse ¶
type NewJWTResponse struct { ID string AccessToken string RefreshToken string Expiry jwt.NumericDate }
NewJWTResponse message type
func NewNewJWTResponseFromPB ¶
func NewNewJWTResponseFromPB(msg *pb.NewJWTResponse) *NewJWTResponse
NewNewJWTResponseFromPB transformer *pb.NewJWTResponse to *NewJWTResponse
type PingRequest ¶
type PingRequest struct { }
PingRequest message type
func NewPingRequestFromPB ¶
func NewPingRequestFromPB(msg *pb.PingRequest) *PingRequest
NewPingRequestFromPB transformer *pb.PingRequest to *PingRequest
type PingResponse ¶
type PingResponse struct {
Status string
}
PingResponse message type
func NewPingResponseFromPB ¶
func NewPingResponseFromPB(msg *pb.PingResponse) *PingResponse
NewPingResponseFromPB transformer *pb.PingResponse to *PingResponse
type PublicKeysRequest ¶
type PublicKeysRequest struct {
KID string
}
PublicKeysRequest message type
func NewPublicKeysRequestFromPB ¶
func NewPublicKeysRequestFromPB(msg *pb.PublicKeysRequest) *PublicKeysRequest
NewPublicKeysRequestFromPB transformer *pb.PublicKeysRequest to *PublicKeysRequest
type PublicKeysResponse ¶
type PublicKeysResponse struct { KID string Keys *keys.SigEncKeys `json:"keys"` }
PublicKeysResponse message type
func NewPublicKeysResponseFromPB ¶
func NewPublicKeysResponseFromPB(msg *pb.PublicKeysResponse) *PublicKeysResponse
NewPublicKeysResponseFromPB transformer *pb.PublicKeysResponse to *PublicKeysResponse
type ReadyRequest ¶
type ReadyRequest struct { }
ReadyRequest message type
func NewReadyRequestFromPB ¶
func NewReadyRequestFromPB(msg *pb.ReadyRequest) *ReadyRequest
NewReadyRequestFromPB transformer *pb.ReadyRequest to *ReadyRequest
type ReadyResponse ¶
type ReadyResponse struct { Status string Start jwt.NumericDate Up time.Duration }
ReadyResponse message type
func NewReadyResponseFromPB ¶
func NewReadyResponseFromPB(msg *pb.ReadyResponse) *ReadyResponse
NewReadyResponseFromPB transformer *pb.ReadyResponse to *ReadyResponse
type RegisterRequest ¶
type RegisterRequest struct { KID string SigAlg string EncAlg string SigBits int EncBits int Expiry time.Duration AuthTTL time.Duration RefreshTTL time.Duration RefreshStrategy string }
RegisterRequest message type
func NewRegisterRequestFromPB ¶
func NewRegisterRequestFromPB(msg *pb.RegisterRequest) *RegisterRequest
NewRegisterRequestFromPB transformer *pb.RegisterRequest to *RegisterRequest
type RegisterResponse ¶
type RegisterResponse struct { KID string `json:"kid"` AuthJWT string Keys *keys.SigEncKeys `json:"keys"` }
RegisterResponse message type
func NewRegisterResponseFromPB ¶
func NewRegisterResponseFromPB(msg *pb.RegisterResponse) *RegisterResponse
NewRegisterResponseFromPB transformer *pb.RegisterResponse to *RegisterResponse
type RenewJWTRequest ¶
RenewJWTRequest message type
func NewRenewJWTRequestFromPB ¶
func NewRenewJWTRequestFromPB(msg *pb.RenewJWTRequest) *RenewJWTRequest
NewRenewJWTRequestFromPB transformer *pb.RenewJWTRequest to *RenewJWTRequest
type RenewJWTResponse ¶
type RenewJWTResponse struct { ID string AccessToken string RefreshToken string Expiry jwt.NumericDate }
RenewJWTResponse message type
func NewRenewJWTResponseFromPB ¶
func NewRenewJWTResponseFromPB(msg *pb.RenewJWTResponse) *RenewJWTResponse
NewRenewJWTResponseFromPB transformer *pb.RenewJWTResponse to *RenewJWTResponse
type Repository ¶
type Repository interface { NewJWT(ctx context.Context, req *NewJWTRequest) (*NewJWTResponse, error) RenewJWT(ctx context.Context, req *RenewJWTRequest) (*RenewJWTResponse, error) RevokeJWT(ctx context.Context, req *RevokeJWTRequest) (*RevokeJWTResponse, error) Auth(ctx context.Context, req *AuthRequest) (*AuthResponse, error) Register(ctx context.Context, req *RegisterRequest) (*RegisterResponse, error) UpdateKeys(ctx context.Context, req *UpdateKeysRequest) (*UpdateKeysResponse, error) ListKeys(ctx context.Context, req *ListKeysRequest) (*ListKeysResponse, error) DelKeys(ctx context.Context, req *DelKeysRequest) (*DelKeysResponse, error) PublicKeys(ctx context.Context, req *PublicKeysRequest) (*PublicKeysResponse, error) Ping(ctx context.Context, req *PingRequest) (*PingResponse, error) Ready(ctx context.Context, req *ReadyRequest) (*ReadyResponse, error) }
Repository interface
func NewRepository ¶
func NewRepository(logger log.Logger, db interface{}) Repository
NewRepository constructor
type RequestAndStreamListKeys ¶
type RequestAndStreamListKeys struct { Request *pb.ListKeysRequest Stream pb.JWTISService_ListKeysServer }
RequestAndStreamListKeys struct holds request and stream for half duplex
type RevokeJWTRequest ¶
RevokeJWTRequest message type
func NewRevokeJWTRequestFromPB ¶
func NewRevokeJWTRequestFromPB(msg *pb.RevokeJWTRequest) *RevokeJWTRequest
NewRevokeJWTRequestFromPB transformer *pb.RevokeJWTRequest to *RevokeJWTRequest
type RevokeJWTResponse ¶
type RevokeJWTResponse struct { }
RevokeJWTResponse message type
func NewRevokeJWTResponseFromPB ¶
func NewRevokeJWTResponseFromPB(msg *pb.RevokeJWTResponse) *RevokeJWTResponse
NewRevokeJWTResponseFromPB transformer *pb.RevokeJWTResponse to *RevokeJWTResponse
type ServerService ¶
type ServerService interface { Service BroadcastListKeys() chan ListKeysResponse }
ServerService interface type
func NewServerService ¶
func NewServerService(keysrepo *keys.Repository, contEnc jose.ContentEncryption, log log.Logger) ServerService
NewServerService constructor
type Service ¶
type Service interface { NewJWT(ctx context.Context, req *NewJWTRequest) (*NewJWTResponse, error) RenewJWT(ctx context.Context, req *RenewJWTRequest) (*RenewJWTResponse, error) RevokeJWT(ctx context.Context, req *RevokeJWTRequest) (*RevokeJWTResponse, error) Auth(ctx context.Context, req *AuthRequest) (*AuthResponse, error) Register(ctx context.Context, req *RegisterRequest) (*RegisterResponse, error) UpdateKeys(ctx context.Context, req *UpdateKeysRequest) (*UpdateKeysResponse, error) ListKeys(req *pb.ListKeysRequest, stream pb.JWTISService_ListKeysServer) error // half duplex (client request, server streams) DelKeys(ctx context.Context, req *DelKeysRequest) (*DelKeysResponse, error) PublicKeys(ctx context.Context, req *PublicKeysRequest) (*PublicKeysResponse, error) Ping(ctx context.Context, req *PingRequest) (*PingResponse, error) Ready(ctx context.Context, req *ReadyRequest) (*ReadyResponse, error) Log() log.Logger }
Service interface type
type UpdateKeysRequest ¶
type UpdateKeysRequest struct { KID string SigAlg string EncAlg string SigBits int EncBits int Expiry time.Duration AuthTTL time.Duration RefreshTTL time.Duration RefreshStrategy string }
UpdateKeysRequest message type
func NewUpdateKeysRequestFromPB ¶
func NewUpdateKeysRequestFromPB(msg *pb.UpdateKeysRequest) *UpdateKeysRequest
NewUpdateKeysRequestFromPB transformer *pb.UpdateKeysRequest to *UpdateKeysRequest
type UpdateKeysResponse ¶
type UpdateKeysResponse struct { KID string `json:"kid"` AuthJWT string Keys *keys.SigEncKeys `json:"keys"` }
UpdateKeysResponse message type
func NewUpdateKeysResponseFromPB ¶
func NewUpdateKeysResponseFromPB(msg *pb.UpdateKeysResponse) *UpdateKeysResponse
NewUpdateKeysResponseFromPB transformer *pb.UpdateKeysResponse to *UpdateKeysResponse