test

package
v2.23.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	OwnerClaim    = testOAuthUri.OwnerClaimKey
	DeviceIDClaim = testOAuthUri.DeviceIDClaimKey
)

Variables

View Source
var JWTPrivateKeyOAuthClient = oauthsigner.Client{
	ID:                  "JWTPrivateKeyClient",
	SecretFile:          "data:,JWTPrivateKeyClientSecret",
	AccessTokenLifetime: 0,
	AllowedGrantTypes:   []oauthsigner.GrantType{oauthsigner.GrantTypeClientCredentials},
	AllowedAudiences:    nil,
	AllowedScopes:       nil,
	JWTPrivateKey: oauthsigner.PrivateKeyJWTConfig{
		Enabled:       true,
		Authorization: config.MakeValidatorConfig(),
	},
}
View Source
var ServiceOAuthClient = oauthsigner.Client{
	ID:                  "serviceClient",
	SecretFile:          "data:,serviceClientSecret",
	Owner:               "1",
	AccessTokenLifetime: 0,
	AllowedGrantTypes:   []oauthsigner.GrantType{oauthsigner.GrantTypeClientCredentials},
	AllowedAudiences:    nil,
	AllowedScopes:       nil,
	InsertTokenClaims:   map[string]interface{}{"hardcodedClaim": true},
}

Functions

func DeleteTokens added in v2.23.0

func DeleteTokens(ctx context.Context, t *testing.T, tokenIDs []string, token string)

func GetAccessToken

func GetAccessToken(t *testing.T, expectedCode int, opts ...func(opts *AccessTokenOptions)) map[string]string

func GetDefaultAccessToken

func GetDefaultAccessToken(t *testing.T, opts ...func(opts *AccessTokenOptions)) string

func GetJWTValidator

func GetJWTValidator(jwkURL string) *jwt.Validator

func GetSecret

func GetSecret(t require.TestingT, clientID string) string

func HTTPURI added in v2.23.0

func HTTPURI(uri string) string

func MakeConfig

func MakeConfig(t require.TestingT) service.Config

func MakeStoreConfig added in v2.23.0

func MakeStoreConfig() storeConfig.Config

func New

func New(t require.TestingT, cfg service.Config) func()

func NewMongoStore added in v2.23.0

func NewMongoStore(t require.TestingT) (*storeMongo.Store, func())

func SetUp

func SetUp(t require.TestingT) (tearDown func())

func WithAccessTokenAudience

func WithAccessTokenAudience(audience string) func(opts *AccessTokenOptions)

func WithAccessTokenClientID

func WithAccessTokenClientID(clientID string) func(opts *AccessTokenOptions)

func WithAccessTokenClientSecret

func WithAccessTokenClientSecret(clientSecret string) func(opts *AccessTokenOptions)

func WithAccessTokenGrantType

func WithAccessTokenGrantType(grantType string) func(opts *AccessTokenOptions)

func WithAccessTokenHost

func WithAccessTokenHost(host string) func(opts *AccessTokenOptions)

func WithAccessTokenJWT

func WithAccessTokenJWT(jwt string) func(opts *AccessTokenOptions)

func WithAccessTokenOptions

func WithAccessTokenOptions(options AccessTokenOptions) func(opts *AccessTokenOptions)

func WithContext

func WithContext(ctx context.Context) func(opts *AccessTokenOptions)

func WithExpiration added in v2.23.0

func WithExpiration(expiration time.Time) func(opts *AccessTokenOptions)

func WithPostFrom

func WithPostFrom(enabled bool) func(opts *AccessTokenOptions)

Types

type AccessTokenOptions

type AccessTokenOptions struct {
	Host         string
	ClientID     string
	ClientSecret string
	GrantType    string
	Audience     string
	JWT          string
	PostForm     bool
	Expiration   time.Time
	Ctx          context.Context
}

Jump to

Keyboard shortcuts

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