faketokensapi

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package faketokensapi includes a mock server of token apis. Deprecated: use package tokensapi instead.

Index

Constants

This section is empty.

Variables

View Source
var FakeToken = &tpb.Token{
	Name:      "fake-token",
	Issuer:    "fake-issuer",
	Audience:  "fake-audience",
	Subject:   "fake-subject",
	IssuedAt:  1573850929,
	ExpiresAt: 1573847329,
	Scope:     "fake-scope",
	Client: &tpb.Client{
		Id:          "fake-client-id",
		Name:        "fake-client-name",
		Description: "fake-client-description",
	},
	Target: "fake-target",
	Metadata: map[string]string{
		"client_desc": "fake-client-ui-description",
	},
	Type: "fake-type",
}

FakeToken is a fake token. TODO: move these fakes to test file once implemented.

Functions

This section is empty.

Types

type DAMTokens

type DAMTokens struct {
	// contains filtered or unexported fields
}

DAMTokens is implments the tokens API for DAM. Currently support GCP tokens.

func NewDAMTokens

func NewDAMTokens(store storage.Store, saw *saw.AccountWarehouse) *DAMTokens

NewDAMTokens creates a new DAMTokens.

func (*DAMTokens) DeleteToken

func (s *DAMTokens) DeleteToken(ctx context.Context, req *tpb.DeleteTokenRequest) (*epb.Empty, error)

DeleteToken revokes a token.

func (*DAMTokens) GCPDeleteToken

func (s *DAMTokens) GCPDeleteToken(ctx context.Context, ids []string) error

GCPDeleteToken revokes a token. ids are project ID, user ID, and token ID.

func (*DAMTokens) GCPListTokens

func (s *DAMTokens) GCPListTokens(ctx context.Context, ids []string) ([]*tpb.Token, error)

GCPListTokens lists the tokens. ids are project ID and user ID.

func (*DAMTokens) GetToken

func (s *DAMTokens) GetToken(_ context.Context, req *tpb.GetTokenRequest) (*tpb.Token, error)

GetToken returns the token.

func (*DAMTokens) ListTokens

ListTokens lists the tokens.

type StubTokens

type StubTokens struct {
	Token *tpb.Token
}

StubTokens is a stub implementation.

func (*StubTokens) DeleteToken

func (s *StubTokens) DeleteToken(_ context.Context, req *tpb.DeleteTokenRequest) (*epb.Empty, error)

DeleteToken revokes a token.

func (*StubTokens) GetToken

func (s *StubTokens) GetToken(_ context.Context, req *tpb.GetTokenRequest) (*tpb.Token, error)

GetToken returns the token.

func (*StubTokens) ListTokens

ListTokens lists the tokens.

type TokensHandler

type TokensHandler struct {
	// contains filtered or unexported fields
}

TokensHandler is a HTTP handler wrapping a GRPC server.

func NewTokensHandler

func NewTokensHandler(s tgpb.TokensServer) *TokensHandler

NewTokensHandler returns a new TokensHandler.

func (*TokensHandler) DeleteToken

func (h *TokensHandler) DeleteToken(w http.ResponseWriter, r *http.Request)

DeleteToken handles DeleteToken HTTP requests.

func (*TokensHandler) GetToken

func (h *TokensHandler) GetToken(w http.ResponseWriter, r *http.Request)

GetToken handles GetToken HTTP requests.

func (*TokensHandler) ListTokens

func (h *TokensHandler) ListTokens(w http.ResponseWriter, r *http.Request)

ListTokens handles ListTokens HTTP requests.

Jump to

Keyboard shortcuts

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