server

package
v2.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const AuthContextKey = AuthContextKeyType("token")

AuthContextKey is a key used in RPC context to retrieve the token info with using context.Value.

View Source
const DefaultJWKSURL = "http://localhost:8080/v1/auth/certs"

DefaultJWKSURL is the default JWKS url pointing to a local authentication server.

Variables

This section is empty.

Functions

func StreamPublicEndpointFilter

func StreamPublicEndpointFilter(c *config, info *grpc.StreamServerInfo) bool

StreamPublicEndpointFilter is a filter that ignores calls to the public endpoints

func StreamReflectionFilter

func StreamReflectionFilter(_ *config, info *grpc.StreamServerInfo) bool

StreamReflectionFilter is a filter that ignores calls to the reflection endpoint

func StreamServerInterceptorWithFilter

func StreamServerInterceptorWithFilter(c *config, in grpc.StreamServerInterceptor, filter ...func(c *config, info *grpc.StreamServerInfo) bool) grpc.StreamServerInterceptor

StreamServerInterceptorWithFilter wraps a grpc.StreamServerInterceptor and only invokes the interceptor, if the filter function does not return true.

func UnaryPublicEndpointFilter

func UnaryPublicEndpointFilter(c *config, info *grpc.UnaryServerInfo) bool

UnaryPublicEndpointFilter is a filter that ignores calls to the public endpoints

func UnaryReflectionFilter

func UnaryReflectionFilter(_ *config, info *grpc.UnaryServerInfo) bool

UnaryReflectionFilter is a filter that ignores calls to the reflection endpoint

func UnaryServerInterceptorWithFilter

func UnaryServerInterceptorWithFilter(c *config, in grpc.UnaryServerInterceptor, filter ...func(c *config, info *grpc.UnaryServerInfo) bool) grpc.UnaryServerInterceptor

UnaryServerInterceptorWithFilter wraps a grpc.UnaryServerInterceptor and only invokes the interceptor, if the filter function does not return true.

Types

type AuthConfig

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

AuthConfig contains all necessary parameters that are needed to configure an authentication middleware.

func (*AuthConfig) AuthFunc

func (config *AuthConfig) AuthFunc() grpc_auth.AuthFunc

AuthFunc returns a grpc_auth.AuthFunc that authenticates incoming gRPC requests based on the configuration properties.

type AuthContextKeyType

type AuthContextKeyType string

AuthContextKeyType is a key type that is used in context.WithValue to store the token info in the RPC context. It should exclusively be used with the value of AuthContextKey.

Why is this needed? To avoid conflicts, the string type should not be used directly but they should be type-aliased.

type OpenIDConnectClaim

type OpenIDConnectClaim struct {
	*jwt.RegisteredClaims
	*ProfileClaim
}

OpenIDConnectClaim represents a claim that supports some aspects of a token issued by an OpenID Connect provider. It contains the regular registered JWT claims as well as some specific optional claims, which are empty if Open ID Connect is not used.

type ProfileClaim

type ProfileClaim struct {
	PreferredUsername string `json:"preferred_username"`
	Name              string `json:"name"`
	GivenName         string `json:"given_name"`
	FamilyName        string `json:"family_name"`
}

ProfileClaim represents claims that are contained in the profile scope of OpenID Connect.

type Server

type Server = grpc.Server

Server is a typealias for grpc.Server so that users of this package do not need to import the grpc packages directly.

func StartGRPCServer

func StartGRPCServer(addr string, opts ...StartGRPCServerOption) (sock net.Listener, srv *Server, err error)

StartGRPCServer starts a gRPC server listening on the given address. The server can be configured using the supplied opts, e.g., to register various Clouditor services. The server itself is started in a separate Go routine, therefore this function will NOT block.

type StartGRPCServerOption

type StartGRPCServerOption func(c *config)

StartGRPCServerOption is a type for functional style options that can configure the StartGRPCServer function.

func WithAdditionalGRPCOpts

func WithAdditionalGRPCOpts(opts []grpc.ServerOption) StartGRPCServerOption

WithAdditionalGRPCOpts is an option to add an additional gRPC dial options in the REST server communication to the backend.

func WithAssessment

WithAssessment is an option for StartGRPCServer to register a assessment.AssessmentServer at start.

func WithDiscovery

WithDiscovery is an option for StartGRPCServer to register a discovery.DiscoveryServer at start.

func WithEvaluation

WithEvaluation is an option for StartGRPCServer to register a evaluation.EvaluationServer at start.

func WithEvidenceStore

func WithEvidenceStore(svc evidence.EvidenceStoreServer) StartGRPCServerOption

WithEvidenceStore is an option for StartGRPCServer to register a evidence.EvidenceStoreServer at start.

func WithExperimentalDiscovery

func WithExperimentalDiscovery(svc discovery.ExperimentalDiscoveryServer) StartGRPCServerOption

WithExperimentalDiscovery is an option for StartGRPCServer to register a discovery.ExperimentalDiscoveryServer at start.

func WithJWKS

func WithJWKS(url string) StartGRPCServerOption

WithJWKS is an option to provide a URL that contains a JSON Web Key Set (JWKS). The JWKS will be used to validate tokens coming from RPC clients against public keys contains in the JWKS.

func WithOrchestrator

WithOrchestrator is an option for StartGRPCServer to register a orchestrator.OrchestratorServer at start.

func WithPublicEndpoints

func WithPublicEndpoints(endpoints []string) StartGRPCServerOption

WithReflection is an option for StartGRPCServer to enable gRPC reflection.

func WithPublicKey

func WithPublicKey(publicKey *ecdsa.PublicKey) StartGRPCServerOption

WithPublicKey is an option to directly provide a ECDSA public key which is used to verify tokens coming from RPC clients.

func WithReflection

func WithReflection() StartGRPCServerOption

WithReflection is an option for StartGRPCServer to enable gRPC reflection.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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