policy_services

package
v0.69.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GraphqlClient

type GraphqlClient interface {
	Run(ctx context.Context, req *graphql.Request, resp interface{}) error
}

type GraphqlData

type GraphqlData struct {
	TenantInfo TenantResponse
}

type TenantIdReader

type TenantIdReader interface {
	Read(parentCtx context.Context) (string, error)
}

type TenantKey

type TenantKey string

type TenantResponse

type TenantResponse struct {
	TenantId string
}

type TenantRetriever

type TenantRetriever interface {
	RetrieveTenant(ctx context.Context) (string, error)
}

TenantRetriever Retrieves a tenant by a issuer/audiences from the context. It uses the iam service's graphql endpoint. The responses are cached in memory because tenant mappings do not change frequently It uses the tenantInfo query internally.

type TenantRetrieverService

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

func NewCustomTenantRetriever

func NewCustomTenantRetriever(tr TenantIdReader) *TenantRetrieverService

NewCustomTenantRetriever Creates a tenant retriever that has a custom implementation of the TenantIdReader interface. The result of the reader will be cached. A local and a graphql tenant Reader are already contained in this package.

func NewLocalTenantRetriever

func NewLocalTenantRetriever(tenantId string) *TenantRetrieverService

NewLocalTenantRetriever Creates a Tenant reader that returns a hardcoded tenant id for local testing. The idea is to use a tenant id that can be set to the environment, so you do not need an iam service running locally

func NewTenantRetriever

func NewTenantRetriever(ctx context.Context, iamUrl string, timeout *time.Duration) *TenantRetrieverService

NewTenantRetriever Creates a retriever to get tenant ids from the iam service. The iamUrl parameter should be the graphql endpoint of the iam-service.

func (*TenantRetrieverService) RetrieveOrAdd

func (tenantRetriever *TenantRetrieverService) RetrieveOrAdd(ctx context.Context, key TenantKey) (string, error)

func (*TenantRetrieverService) RetrieveTenant

func (tenantRetriever *TenantRetrieverService) RetrieveTenant(ctx context.Context) (string, error)

Jump to

Keyboard shortcuts

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