Documentation ¶
Overview ¶
Package tokensapi provides implementations of tokens API defined in /proto/tokens/
Index ¶
- Variables
- type DAMTokens
- func (s *DAMTokens) DeleteToken(ctx context.Context, req *tpb.DeleteTokenRequest) (*epb.Empty, error)
- func (s *DAMTokens) GCPDeleteToken(ctx context.Context, ids []string) error
- func (s *DAMTokens) GCPListTokens(ctx context.Context, ids []string) ([]*tpb.Token, error)
- func (s *DAMTokens) GetToken(_ context.Context, req *tpb.GetTokenRequest) (*tpb.Token, error)
- func (s *DAMTokens) ListTokens(ctx context.Context, req *tpb.ListTokensRequest) (*tpb.ListTokensResponse, error)
- type StubTokens
- func (s *StubTokens) DeleteToken(_ context.Context, req *tpb.DeleteTokenRequest) (*epb.Empty, error)
- func (s *StubTokens) GetToken(_ context.Context, req *tpb.GetTokenRequest) (*tpb.Token, error)
- func (s *StubTokens) ListTokens(_ context.Context, req *tpb.ListTokensRequest) (*tpb.ListTokensResponse, error)
- type TokensHandler
Constants ¶
This section is empty.
Variables ¶
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 ¶
GCPDeleteToken revokes a token. ids are project ID, user ID, and token ID.
func (*DAMTokens) GCPListTokens ¶
GCPListTokens lists the tokens. ids are project ID and user ID.
func (*DAMTokens) ListTokens ¶
func (s *DAMTokens) ListTokens(ctx context.Context, req *tpb.ListTokensRequest) (*tpb.ListTokensResponse, error)
ListTokens lists the tokens.
type StubTokens ¶
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 ¶
func (s *StubTokens) ListTokens(_ context.Context, req *tpb.ListTokensRequest) (*tpb.ListTokensResponse, error)
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.