Documentation ¶
Index ¶
- Variables
- func ObtainClaimsFromContext(ctx context.Context) entities.TokenClaims
- func ObtainClaimsFromMetadata(ctx context.Context) (claims entities.TokenClaims, err error)
- type AuthenticateDelivery
- func (delivery *AuthenticateDelivery) Authenticate(ctx context.Context, request *pb.AuthRequest) (*pb.AuthResponse, error)
- func (delivery *AuthenticateDelivery) DefaultInterceptor(ctx context.Context) (context.Context, error)
- func (delivery *AuthenticateDelivery) Validate(ctx context.Context, request *pb.ValidateRequest) (*pb.AuthResponse, error)
- type ContextKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ContextKeyClaims defines claims context key provided by token. ContextKeyClaims = ContextKey("auth-claims") )
Functions ¶
func ObtainClaimsFromContext ¶
func ObtainClaimsFromContext(ctx context.Context) entities.TokenClaims
ObtainClaimsFromContext obtains token claims from given context with value.
func ObtainClaimsFromMetadata ¶
func ObtainClaimsFromMetadata(ctx context.Context) (claims entities.TokenClaims, err error)
ObtainClaimsFromMetadata obtains token claims from given context with gRPC metadata.
Types ¶
type AuthenticateDelivery ¶
type AuthenticateDelivery struct {
// contains filtered or unexported fields
}
AuthenticateDelivery is gRPC handler delivery of authentication/authorization.
func NewAuthenticateDelivery ¶
func NewAuthenticateDelivery(log *zap.Logger, repository employee.Repository) *AuthenticateDelivery
NewAuthenticateDelivery returns new Auth gRPC delivery.
func (*AuthenticateDelivery) Authenticate ¶
func (delivery *AuthenticateDelivery) Authenticate(ctx context.Context, request *pb.AuthRequest) (*pb.AuthResponse, error)
Authenticate gRPC handler that checks credentials and generates AuthResponse with token and claims.
func (*AuthenticateDelivery) DefaultInterceptor ¶
func (delivery *AuthenticateDelivery) DefaultInterceptor(ctx context.Context) (context.Context, error)
DefaultInterceptor is default ahtentication/authorization interceptor, validates only token correctness without performing any role specific authorization.
func (*AuthenticateDelivery) Validate ¶
func (delivery *AuthenticateDelivery) Validate(ctx context.Context, request *pb.ValidateRequest) (*pb.AuthResponse, error)
type ContextKey ¶
type ContextKey string
ContextKey auth gRPC context key.
func (ContextKey) String ¶
func (c ContextKey) String() string
Click to show internal directories.
Click to hide internal directories.