tokensapi

package
v0.9.15 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package tokensapi provides implementations of tokens API defined in /proto/tokens/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteTokenFactory added in v0.9.3

func DeleteTokenFactory(tokenPath string, providers []TokenProvider, store storage.Store) *handlerfactory.Options

DeleteTokenFactory creates a http handler for "/(identity|dam)/v1alpha/users/{user}/tokens/{token_id}"

func ListTokensFactory added in v0.9.3

func ListTokensFactory(tokensPath string, providers []TokenProvider, store storage.Store) *handlerfactory.Options

ListTokensFactory creates a http handler for "/(identity|dam)/v1alpha/users/{user}/tokens" TODO should support filter parameters.

Types

type GCP added in v0.9.3

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

GCP tokens management, implments TokenProvider interface.

func NewGCPTokenManager added in v0.9.3

func NewGCPTokenManager(saProject, defaultBroker string, saw *saw.AccountWarehouse) *GCP

NewGCPTokenManager creates a GCP object

func (*GCP) DeleteToken added in v0.9.3

func (s *GCP) DeleteToken(ctx context.Context, user, tokenID string, store storage.Store, tx storage.Tx) error

DeleteToken revokes a token.

func (*GCP) ListTokens added in v0.9.3

func (s *GCP) ListTokens(ctx context.Context, user string, store storage.Store, tx storage.Tx) ([]*Token, error)

ListTokens lists the tokens.

func (*GCP) TokenPrefix added in v0.9.3

func (s *GCP) TokenPrefix() string

TokenPrefix of GCP provided tokens.

type Hydra added in v0.9.3

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

Hydra tokens management, implments TokenProvider interface.

func NewHydraTokenManager added in v0.9.3

func NewHydraTokenManager(hydraAdminURL, issuer string, clients func(tx storage.Tx) (map[string]*cpb.Client, error)) *Hydra

NewHydraTokenManager creates a Hydra token manger.

func (*Hydra) DeleteToken added in v0.9.3

func (s *Hydra) DeleteToken(ctx context.Context, user, tokenID string, store storage.Store, tx storage.Tx) error

DeleteToken revokes a token.

func (*Hydra) ListTokens added in v0.9.3

func (s *Hydra) ListTokens(ctx context.Context, user string, store storage.Store, tx storage.Tx) ([]*Token, error)

ListTokens lists the tokens.

func (*Hydra) TokenPrefix added in v0.9.3

func (s *Hydra) TokenPrefix() string

TokenPrefix of Hydra provided tokens.

type Token added in v0.9.3

type Token struct {
	User        string
	RawTokenID  string
	TokenPrefix string
	IssuedAt    int64
	ExpiresAt   int64
	Issuer      string
	Subject     string
	Audience    string
	Scope       string
	ClientID    string
	ClientName  string
	ClientUI    map[string]string
	Platform    string
}

Token is used in TokenProvider below.

type TokenProvider added in v0.9.3

type TokenProvider interface {
	ListTokens(ctx context.Context, user string, store storage.Store, tx storage.Tx) ([]*Token, error)
	DeleteToken(ctx context.Context, user, tokenID string, store storage.Store, tx storage.Tx) error
	TokenPrefix() string
}

TokenProvider includes methods for token management.

Jump to

Keyboard shortcuts

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