integrationtests

package
v0.6.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupConcreteToken added in v0.3.0

func LookupConcreteToken(tokenPointer **api.SPIAccessToken) func(ctx context.Context, cl client.Client, binding *api.SPIAccessTokenBinding) (*api.SPIAccessToken, error)

LookupConcreteToken returns a function that can be used as the TestServiceProvider.LookupTokenImpl that just returns a freshly loaded version of the provided token. The token is a pointer to a pointer to the token so that this can also support lazily initialized tokens.

func PersistConcreteMetadata added in v0.3.0

func PersistConcreteMetadata(metadata *api.TokenMetadata) func(context.Context, client.Client, *api.SPIAccessToken) error

PersistConcreteMetadata returns a function that can be used as the TestServiceProvider.PersistMetadataImpl that stores the provided metadata to any token.

Types

type TestServiceProvider

type TestServiceProvider struct {
	LookupTokenImpl           func(context.Context, client.Client, *api.SPIAccessTokenBinding) (*api.SPIAccessToken, error)
	PersistMetadataImpl       func(context.Context, client.Client, *api.SPIAccessToken) error
	GetBaseUrlImpl            func() string
	OAuthScopesForImpl        func(permissions *api.Permissions) []string
	GetTypeImpl               func() api.ServiceProviderType
	GetOauthEndpointImpl      func() string
	CheckRepositoryAccessImpl func(context.Context, client.Client, *api.SPIAccessCheck) (*api.SPIAccessCheckStatus, error)
	MapTokenImpl              func(context.Context, *api.SPIAccessTokenBinding, *api.SPIAccessToken, *api.Token) (serviceprovider.AccessTokenMapper, error)
	ValidateImpl              func(context.Context, serviceprovider.Validated) (serviceprovider.ValidationResult, error)
}

TestServiceProvider is an implementation of the serviceprovider.ServiceProvider interface that can be modified by supplying custom implementations of each of the interface methods. It provides dummy implementations of them, too, so that no null pointer dereferences should occur under normal operation.

func (TestServiceProvider) CheckRepositoryAccess added in v0.5.1

func (t TestServiceProvider) CheckRepositoryAccess(ctx context.Context, cl client.Client, accessCheck *api.SPIAccessCheck) (*api.SPIAccessCheckStatus, error)

func (TestServiceProvider) GetBaseUrl

func (t TestServiceProvider) GetBaseUrl() string

func (TestServiceProvider) GetOAuthEndpoint

func (t TestServiceProvider) GetOAuthEndpoint() string

func (TestServiceProvider) GetType

func (TestServiceProvider) LookupToken

func (TestServiceProvider) MapToken added in v0.5.5

func (TestServiceProvider) OAuthScopesFor added in v0.6.8

func (t TestServiceProvider) OAuthScopesFor(permissions *api.Permissions) []string

func (TestServiceProvider) PersistMetadata added in v0.3.0

func (t TestServiceProvider) PersistMetadata(ctx context.Context, cl client.Client, token *api.SPIAccessToken) error

func (*TestServiceProvider) Reset

func (t *TestServiceProvider) Reset()

func (TestServiceProvider) Validate added in v0.5.5

Jump to

Keyboard shortcuts

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