Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMissingReqData returns when the certain required data is missing ErrMissingReqData = status.Errorf(codes.Unauthenticated, "Missing required data") // ErrMissingAccessToken returns when access token is missing from the request data ErrMissingAccessToken = status.Errorf(codes.Unauthenticated, "Access token is required") // ErrInvalidAccessToken returns when the access token provided is invalid ErrInvalidAccessToken = status.Errorf(codes.Unauthenticated, "Access token is invalid") // ErrAccessDenied returns when the data provided is not sufficient to provide access to the requested method ErrAccessDenied = status.Errorf(codes.PermissionDenied, "Access denied") )
Functions ¶
func GetCurrentUserID ¶ added in v0.0.3
GetCurrentUserID returns the current user's ID
func GetCurrentUserRole ¶ added in v0.0.3
GetCurrentUserRole returns the current user's role
func MetadataByKey ¶
MetadataByKey returns the value of the first metadata with the provided key
func SetSessionData ¶ added in v0.0.3
SetSessionData sets the data to be stored in the session store. The values are passed as a map of (string) key => (string) value
Types ¶
type AuthInterceptor ¶
type AuthInterceptor struct {
// contains filtered or unexported fields
}
AuthInterceptor is a grpc interceptor for authentication and authorization
func NewAuthInterceptor ¶
func NewAuthInterceptor(jwtManager *manager.JWT) *AuthInterceptor
NewAuthInterceptor returns a new auth interceptor
func (*AuthInterceptor) Stream ¶
func (interceptor *AuthInterceptor) Stream() grpc.StreamServerInterceptor
Stream returns a server interceptor function to authenticate and authorize stream RPC
func (*AuthInterceptor) Unary ¶
func (interceptor *AuthInterceptor) Unary() grpc.UnaryServerInterceptor
Unary returns a server interceptor function to authenticate and authorize unary RPC
Click to show internal directories.
Click to hide internal directories.