auth

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthenticationFrom

func GetAuthenticationFrom(ctx context.Context) *authrpc.Authentication

GetAuthenticationFrom is a utility for extracting an Authentication stored on a context.Context instance

func UnaryInterceptor

func UnaryInterceptor(logger *zap.Logger, authenticator Authenticator, o ...containers.Option[InterceptorOptions]) grpc.UnaryServerInterceptor

UnaryInterceptor is a grpc.UnaryServerInterceptor which extracts a clientToken found within the authorization field on the incoming requests metadata. The fields value is expected to be in the form "Bearer <clientToken>".

func WithServerSkipsAuthentication added in v1.17.0

func WithServerSkipsAuthentication(server any) containers.Option[InterceptorOptions]

WithServerSkipsAuthentication can be used to configure an auth unary interceptor which skips authentication when the provided server instance matches the intercepted calls parent server instance. This allows the caller to registers servers which explicitly skip authentication (e.g. OIDC).

Types

type Authenticator

type Authenticator interface {
	GetAuthenticationByClientToken(ctx context.Context, clientToken string) (*authrpc.Authentication, error)
}

Authenticator is the minimum subset of an authentication provider required by the middleware to perform lookups for Authentication instances using a obtained clientToken.

type InterceptorOptions added in v1.17.0

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

InterceptorOptions configure the UnaryInterceptor

type Server

type Server struct {
	auth.UnimplementedAuthenticationServiceServer
	// contains filtered or unexported fields
}

Server is the core AuthenticationServiceServer implementations.

It is the service which presents all Authentications created in the backing auth store.

func NewServer

func NewServer(logger *zap.Logger, store storageauth.Store) *Server

func (*Server) DeleteAuthentication

func (s *Server) DeleteAuthentication(ctx context.Context, req *auth.DeleteAuthenticationRequest) (*emptypb.Empty, error)

DeleteAuthentication deletes the authentication with the supplied ID.

func (*Server) GetAuthentication

func (s *Server) GetAuthentication(ctx context.Context, r *auth.GetAuthenticationRequest) (*auth.Authentication, error)

GetAuthentication returns the Authentication identified by the supplied id.

func (*Server) GetAuthenticationSelf

func (s *Server) GetAuthenticationSelf(ctx context.Context, _ *emptypb.Empty) (*auth.Authentication, error)

GetAuthenticationSelf returns the Authentication which was derived from the request context.

func (*Server) ListAuthentications

ListAuthentications produces a set of authentications for the provided method filter and pagination parameters.

func (*Server) RegisterGRPC added in v1.17.0

func (s *Server) RegisterGRPC(server *grpc.Server)

RegisterGRPC registers the server as an Server on the provided grpc server.

Directories

Path Synopsis
method

Jump to

Keyboard shortcuts

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