testkit

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIfSubjectEquals

func CheckIfSubjectEquals(t *testing.T, expectedSubject string, certificate *x509.Certificate)

CheckIfSubjectEquals verifies that specified subject is equal to this in certificate

func CreateCsr

func CreateCsr(t *testing.T, certInfo CertInfo, keys *rsa.PrivateKey) []byte

CreateCsr creates CSR request

func CreateKey

func CreateKey(t *testing.T) *rsa.PrivateKey

Create Key generates rsa.PrivateKey

func CrtResponseToPemBytes

func CrtResponseToPemBytes(t *testing.T, certResponse *CrtResponse) []byte

CrtResponseToPemBytes decodes certificate form CrtResponse and return pemBlock.Bytes

func DecodeAndParseCert

func DecodeAndParseCert(t *testing.T, crtResponse *CrtResponse) *x509.Certificate

DecodeAndParseCert decodes base64 encoded certificate and parses it

func EncodeBase64

func EncodeBase64(src []byte) string

Types

type ApiInfo

type ApiInfo struct {
	MetadataURL     string `json:"metadataUrl"`
	EventsURL       string `json:"eventsUrl"`
	CertificatesUrl string `json:"certificatesUrl"`
}

type CertInfo

type CertInfo struct {
	Subject      string `json:"subject"`
	Extensions   string `json:"extensions"`
	KeyAlgorithm string `json:"key-algorithm"`
}

type ConnectorClient

type ConnectorClient interface {
	CreateToken(t *testing.T) TokenResponse
	GetInfo(t *testing.T, url string) (*InfoResponse, *Error)
	CreateClientCert(t *testing.T, csr, url string) (*CrtResponse, *Error)
}

func NewConnectorClient

func NewConnectorClient(remoteEnv, internalAPIUrl, externalAPIUrl string) ConnectorClient

type CrtResponse

type CrtResponse struct {
	Crt string `json:"crt"`
}

type CsrRequest

type CsrRequest struct {
	Csr string `json:"csr"`
}

type Error

type Error struct {
	StatusCode    int
	ErrorResponse ErrorResponse
}

type ErrorResponse

type ErrorResponse struct {
	Code  int    `json:"code"`
	Error string `json:"error"`
}

type InfoResponse

type InfoResponse struct {
	CertUrl     string   `json:"csrUrl"`
	Api         ApiInfo  `json:"api"`
	Certificate CertInfo `json:"certificate"`
}

type TestConfig

type TestConfig struct {
	InternalAPIUrl string
	ExternalAPIUrl string
	GatewayUrl     string
}

func ReadConfig

func ReadConfig() (TestConfig, error)

type TokenResponse

type TokenResponse struct {
	URL   string `json:"url"`
	Token string `json:"token"`
}

Jump to

Keyboard shortcuts

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