Documentation
¶
Index ¶
- Constants
- Variables
- func NewTestStorage(options TestStorageOptions) storage.Storage
- type ErrorLimiter
- type ErrorProvider
- type ErrorStorage
- func (e ErrorStorage) Begin(_ context.Context) (storage.Tx, error)
- func (e ErrorStorage) Close(_ context.Context) error
- func (e ErrorStorage) CreateAdminSA(_ context.Context, _ model.ValidAdminCreateArgs) error
- func (e ErrorStorage) CreateLink(_ context.Context, _ magiclink.CreateArgs) (secret string, err error)
- func (e ErrorStorage) CreateSA(_ context.Context, _ model.ValidServiceAccountCreateArgs) (model.ServiceAccount, error)
- func (e ErrorStorage) DeleteKey(_ context.Context, _ string) (ok bool, err error)
- func (e ErrorStorage) ReadKey(_ context.Context, _ string) (jwkset.JWK, error)
- func (e ErrorStorage) ReadLink(_ context.Context, _ string) (magiclink.ReadResponse, error)
- func (e ErrorStorage) ReadSA(_ context.Context, _ uuid.UUID) (model.ServiceAccount, error)
- func (e ErrorStorage) ReadSAFromAPIKey(_ context.Context, _ uuid.UUID) (model.ServiceAccount, error)
- func (e ErrorStorage) ReadSigningKey(_ context.Context, _ storage.ReadSigningKeyOptions) (meta jwkset.JWK, err error)
- func (e ErrorStorage) SnapshotKeys(_ context.Context) ([]jwkset.JWK, error)
- func (e ErrorStorage) TestingTruncate(_ context.Context) error
- func (e ErrorStorage) UpdateDefaultSigningKey(_ context.Context, _ string) error
- func (e ErrorStorage) WriteKey(_ context.Context, _ jwkset.JWK) error
- type NopLimiter
- type NopProvider
- type TestClaims
- func (t TestClaims) Equal(c TestClaims) bool
- func (t TestClaims) GetAudience() (jwt.ClaimStrings, error)
- func (t TestClaims) GetExpirationTime() (*jwt.NumericDate, error)
- func (t TestClaims) GetIssuedAt() (*jwt.NumericDate, error)
- func (t TestClaims) GetIssuer() (string, error)
- func (t TestClaims) GetNotBefore() (*jwt.NumericDate, error)
- func (t TestClaims) GetSubject() (string, error)
- type TestStorageOptions
Constants ¶
View Source
const ( // BaseURL is the test base URL for the service. BaseURL = "http://localhost:8080/api/v1/" // Iss is the test issuer for the service. Iss = BaseURL // LogoImageURL is the test service logo for the service. LogoImageURL = "http://example.com/logo.png" // ServiceName is the test service name for the service. ServiceName = "Example service" // LogoClickURL is the test service URL for the service. LogoClickURL = "http://example.com" // LinksExpireAfter is the amount of time links expire after for tests. LinksExpireAfter = 24 * 30 * time.Hour )
Variables ¶
View Source
var ( // APIKey is the test API key for the service. APIKey = uuid.MustParse("40084740-0bc3-455d-b298-e23a31561580") // Aud is the test audience for the service. Aud = uuid.MustParse("ad9e9d84-92ea-4f07-bac9-5d898d59c83b") // ErrMLDTest is the test error for the service. ErrMLDTest = errors.New("mldtest") // TClaims is the test claims for the service. TClaims = TestClaims{Foo: "foo"} // SAUUID is the test service account UUID for the service. SAUUID = uuid.MustParse("1e079d6d-a8b9-4065-aa8d-86906accd211") )
Functions ¶
func NewTestStorage ¶
func NewTestStorage(options TestStorageOptions) storage.Storage
NewTestStorage creates a new test storage.
Types ¶
type ErrorLimiter ¶
type ErrorLimiter struct{}
ErrorLimiter is a rate limiter that always returns an error.
type ErrorProvider ¶
type ErrorProvider struct{}
ErrorProvider is an email provider that always returns an error.
type ErrorStorage ¶
type ErrorStorage struct{}
ErrorStorage is a storage.Storage implementation that always returns an error.
func (ErrorStorage) CreateAdminSA ¶
func (e ErrorStorage) CreateAdminSA(_ context.Context, _ model.ValidAdminCreateArgs) error
func (ErrorStorage) CreateLink ¶
func (e ErrorStorage) CreateLink(_ context.Context, _ magiclink.CreateArgs) (secret string, err error)
func (ErrorStorage) CreateSA ¶
func (e ErrorStorage) CreateSA(_ context.Context, _ model.ValidServiceAccountCreateArgs) (model.ServiceAccount, error)
func (ErrorStorage) ReadLink ¶
func (e ErrorStorage) ReadLink(_ context.Context, _ string) (magiclink.ReadResponse, error)
func (ErrorStorage) ReadSA ¶
func (e ErrorStorage) ReadSA(_ context.Context, _ uuid.UUID) (model.ServiceAccount, error)
func (ErrorStorage) ReadSAFromAPIKey ¶
func (e ErrorStorage) ReadSAFromAPIKey(_ context.Context, _ uuid.UUID) (model.ServiceAccount, error)
func (ErrorStorage) ReadSigningKey ¶
func (e ErrorStorage) ReadSigningKey(_ context.Context, _ storage.ReadSigningKeyOptions) (meta jwkset.JWK, err error)
func (ErrorStorage) SnapshotKeys ¶
func (ErrorStorage) TestingTruncate ¶
func (e ErrorStorage) TestingTruncate(_ context.Context) error
func (ErrorStorage) UpdateDefaultSigningKey ¶
func (e ErrorStorage) UpdateDefaultSigningKey(_ context.Context, _ string) error
type TestClaims ¶
type TestClaims struct {
Foo string `json:"foo"`
}
TestClaims is the test claims for the service.
func (TestClaims) Equal ¶
func (t TestClaims) Equal(c TestClaims) bool
Equal returns true if the two claims are equal.
func (TestClaims) GetAudience ¶ added in v0.5.1
func (t TestClaims) GetAudience() (jwt.ClaimStrings, error)
func (TestClaims) GetExpirationTime ¶ added in v0.5.1
func (t TestClaims) GetExpirationTime() (*jwt.NumericDate, error)
func (TestClaims) GetIssuedAt ¶ added in v0.5.1
func (t TestClaims) GetIssuedAt() (*jwt.NumericDate, error)
func (TestClaims) GetIssuer ¶ added in v0.5.1
func (t TestClaims) GetIssuer() (string, error)
func (TestClaims) GetNotBefore ¶ added in v0.5.1
func (t TestClaims) GetNotBefore() (*jwt.NumericDate, error)
func (TestClaims) GetSubject ¶ added in v0.5.1
func (t TestClaims) GetSubject() (string, error)
type TestStorageOptions ¶
type TestStorageOptions struct {
Key ed25519.PrivateKey
KeyID string
SA model.ServiceAccount
}
TestStorageOptions are the options for creating a test storage.
Click to show internal directories.
Click to hide internal directories.