This section is empty.


View Source
var (
	FakeFederatedToken = "FakeFederatedToken"
	FakeAccessToken    = "FakeAccessToken"
	FakeTrustDomain    = "FakeTrustDomain"
	// FakeSubjectToken is a fake JWT token without signing, anyone can change it if needed by base64 decoding or using online tool like
	FakeSubjectToken = "" // nolint: lll
	/* 751-byte string literal not displayed */
	FakeProjectNum       = "1234567"
	FakeGKEClusterURL    = ""
	FakeExpiresInSeconds = 3600


This section is empty.


type AuthorizationServer

type AuthorizationServer struct {
	Port int
	URL  string
	// contains filtered or unexported fields

    AuthorizationServer mocks google secure token server. nolint: maligned

    func StartNewServer

    func StartNewServer(t *testing.T, conf Config) (*AuthorizationServer, error)

      StartNewServer creates a mock server and starts it. The server listens on port for requests. If port is 0, a randomly chosen port is in use.

      func (*AuthorizationServer) BlockAccessTokenRequest

      func (ms *AuthorizationServer) BlockAccessTokenRequest(block bool)

      func (*AuthorizationServer) BlockFederatedTokenRequest

      func (ms *AuthorizationServer) BlockFederatedTokenRequest(block bool)

      func (*AuthorizationServer) EnableDynamicAccessToken

      func (ms *AuthorizationServer) EnableDynamicAccessToken(enable bool)

        SetAccessToken sets the issued access token to token

        func (*AuthorizationServer) NumGetAccessTokenCalls

        func (ms *AuthorizationServer) NumGetAccessTokenCalls() int

        func (*AuthorizationServer) NumGetFederatedTokenCalls

        func (ms *AuthorizationServer) NumGetFederatedTokenCalls() int

        func (*AuthorizationServer) SetAccessToken

        func (ms *AuthorizationServer) SetAccessToken(token string)

          SetAccessToken sets the issued access token to token

          func (*AuthorizationServer) SetGenAcsTokenError

          func (ms *AuthorizationServer) SetGenAcsTokenError(err error)

          func (*AuthorizationServer) SetGenFedTokenError

          func (ms *AuthorizationServer) SetGenFedTokenError(err error)

          func (*AuthorizationServer) SetTokenLifeTime

          func (ms *AuthorizationServer) SetTokenLifeTime(d int)

            SetTokenLifeTime sets life time of issued access token to d seconds

            func (*AuthorizationServer) Start

            func (ms *AuthorizationServer) Start(port int) error

              Start starts the mock server.

              func (*AuthorizationServer) Stop

              func (ms *AuthorizationServer) Stop() error

                Stop stops he mock server.

                type Config

                type Config struct {
                	Port         int
                	SubjectToken string
                	TrustDomain  string
                	AccessToken  string

                type Duration

                type Duration struct {
                	// Signed seconds of the span of time. Must be from -315,576,000,000
                	// to +315,576,000,000 inclusive. Note: these bounds are computed from:
                	// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
                	Seconds int64 `json:"seconds"`

                Source Files