middleware

package
v3.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ZitadelKeyPath = "ZITADEL_KEY_PATH"
)

Variables

This section is empty.

Functions

func OSKeyPath

func OSKeyPath() string

func SetOrgID

func SetOrgID(ctx context.Context, orgID string) context.Context

SetOrgID passes the orgID used for the organization context (where the api calls are executed)

Types

type AuthInterceptor

type AuthInterceptor struct {
	oauth2.TokenSource
}

func NewAuthenticator

func NewAuthenticator(issuer string, jwtProfileTokenSource JWTProfileTokenSource, scopes ...string) (*AuthInterceptor, error)

NewAuthenticator creates an interceptor which authenticates a service account with a provided JWT Profile (using a key.json either as file or data). There returned token will be used for authorization in all calls if expired, the token will be automatically refreshed

func (*AuthInterceptor) Stream

func (interceptor *AuthInterceptor) Stream() grpc.StreamClientInterceptor

func (*AuthInterceptor) Unary

func (interceptor *AuthInterceptor) Unary() grpc.UnaryClientInterceptor

type JWTProfileTokenSource

type JWTProfileTokenSource func(issuer string, scopes []string) (oauth2.TokenSource, error)

func JWTProfileFromFileData

func JWTProfileFromFileData(ctx context.Context, fileData []byte) JWTProfileTokenSource

func JWTProfileFromKeyAndUserID

func JWTProfileFromKeyAndUserID(ctx context.Context, key []byte, keyID, userID string) JWTProfileTokenSource

func JWTProfileFromPath

func JWTProfileFromPath(ctx context.Context, keyPath string) JWTProfileTokenSource

type OrgInterceptor

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

func NewOrgInterceptor

func NewOrgInterceptor(orgID string) *OrgInterceptor

NewOrgInterceptor statically set the organisation context for every call

If you need to switch between multiple organisations for different requests, use the SetOrgID function directly on your calls (see example/mgmt/mgmt.go)

func (*OrgInterceptor) Stream

func (interceptor *OrgInterceptor) Stream() grpc.StreamClientInterceptor

func (*OrgInterceptor) Unary

func (interceptor *OrgInterceptor) Unary() grpc.UnaryClientInterceptor

Jump to

Keyboard shortcuts

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