middleware

package
v2.0.0-...-c383979 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

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 NewAuthInterceptor deprecated

func NewAuthInterceptor(issuer, keyPath string, scopes ...string) (*AuthInterceptor, error)

NewAuthInterceptor creates an interceptor which authenticates a service account with JWT Profile using a key.json. There returned token will be used for authorization in all calls if expired, the token will be automatically refreshed

Deprecated: use NewAuthenticator(issuer, JWTProfileFromPath(keyPath), scopes...) instead

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(fileData []byte) JWTProfileTokenSource

func JWTProfileFromKeyAndUserID

func JWTProfileFromKeyAndUserID(key []byte, keyID, userID string) JWTProfileTokenSource

func JWTProfileFromPath

func JWTProfileFromPath(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