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     = "" /* 753 byte string literal not displayed */
    FakeProjectNum       = "1234567"
    FakeGKEClusterURL    = "https://container.googleapis.com/v1/projects/fakeproject/locations/fakelocation/clusters/fakecluster"
    FakeExpiresInSeconds = 3600
)

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
}

type Duration Uses

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"`
}

Package mock imports 10 packages (graph) and is imported by 1 packages. Updated 2021-01-02. Refresh now. Tools for package owners.