istio: istio.io/istio/security/pkg/stsservice/tokenmanager/google/mock Index | Files

package mock

import "istio.io/istio/security/pkg/stsservice/tokenmanager/google/mock"

Index

Package Files

mockserver.go

Variables

var (
    FakeFederatedToken = "FakeFederatedToken"
    FakeAccessToken    = "FakeAccessToken"
    FakeTrustDomain    = "FakeTrustDomain"
    FakeSubjectToken   = "FakeSubjectToken"
    FakeProjectNum     = "1234567"
    FakeGKEClusterURL  = "https://container.googleapis.com/v1/projects/fakeproject/locations/fakelocation/clusters/fakecluster"
)

type AuthorizationServer Uses

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

AuthorizationServer mocks google secure token server. nolint: maligned

func StartNewServer Uses

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 Uses

func (ms *AuthorizationServer) BlockAccessTokenRequest(block bool)

func (*AuthorizationServer) BlockFederatedTokenRequest Uses

func (ms *AuthorizationServer) BlockFederatedTokenRequest(block bool)

func (*AuthorizationServer) EnableDynamicAccessToken Uses

func (ms *AuthorizationServer) EnableDynamicAccessToken(enable bool)

SetAccessToken sets the issued access token to token

func (*AuthorizationServer) NumGetAccessTokenCalls Uses

func (ms *AuthorizationServer) NumGetAccessTokenCalls() int

func (*AuthorizationServer) NumGetFederatedTokenCalls Uses

func (ms *AuthorizationServer) NumGetFederatedTokenCalls() int

func (*AuthorizationServer) SetAccessToken Uses

func (ms *AuthorizationServer) SetAccessToken(token string)

SetAccessToken sets the issued access token to token

func (*AuthorizationServer) SetGenAcsTokenError Uses

func (ms *AuthorizationServer) SetGenAcsTokenError(err error)

func (*AuthorizationServer) SetGenFedTokenError Uses

func (ms *AuthorizationServer) SetGenFedTokenError(err error)

func (*AuthorizationServer) SetTokenLifeTime Uses

func (ms *AuthorizationServer) SetTokenLifeTime(d int)

SetTokenLifeTime sets life time of issued access token to d seconds

func (*AuthorizationServer) Start Uses

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

Start starts the mock server.

func (*AuthorizationServer) Stop Uses

func (ms *AuthorizationServer) Stop() error

Stop stops he mock server.

type Config Uses

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

Package mock imports 12 packages (graph). Updated 2020-02-20. Refresh now. Tools for package owners.