translator

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: 19 Imported by: 0

Documentation

Overview

Package translator provides implementations of the ga4gh.Translator interface for translating between different identity providers and GA4GH identities.

Index

Constants

View Source
const (
	// DbGapTranslatorName is the name of the DbGap passport translator.
	DbGapTranslatorName = "dbgap_translator"
)

Variables

This section is empty.

Functions

func FetchUserinfoClaims

func FetchUserinfoClaims(ctx context.Context, client *http.Client, id *ga4gh.Identity, tok string, translator Translator) (*ga4gh.Identity, error)

FetchUserinfoClaims calls the /userinfo endpoint of an issuer to fetch additional claims.

func GetPassportTranslators

func GetPassportTranslators() *dampb.PassportTranslatorsResponse

func PassportTranslators

func PassportTranslators() map[string]*dampb.PassportTranslator

Types

type DbGapTranslator

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

DbGapTranslator is a ga4gh.Translator that converts dbGap identities into GA4GH identities.

func NewDbGapTranslator

func NewDbGapTranslator(publicKey, selfIssuer string, signer kms.Signer) (*DbGapTranslator, error)

NewDbGapTranslator creates a new DbGapTranslator with the provided public key. If the tokens passed to this translator do not have an audience claim with a value equal to the clientID value then they will be rejected.

func (*DbGapTranslator) TranslateToken

func (s *DbGapTranslator) TranslateToken(ctx context.Context, auth string) (*ga4gh.Identity, error)

TranslateToken implements the ga4gh.Translator interface.

type OIDCIdentityTranslator

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

OIDCIdentityTranslator verifies signatures for tokens returned by an OIDC endpoint and in the standard GA4GH identity format.

func NewOIDCIdentityTranslator

func NewOIDCIdentityTranslator(ctx context.Context, issuer, clientID string) (*OIDCIdentityTranslator, error)

NewOIDCIdentityTranslator creates a new OIDCIdentityTranslator with the provided issuer and client ID.

func (*OIDCIdentityTranslator) TranslateToken

func (s *OIDCIdentityTranslator) TranslateToken(ctx context.Context, auth string) (*ga4gh.Identity, error)

TranslateToken implements the ga4gh.Translator interface.

type Static

type Static struct {
	Identity *ga4gh.Identity
}

Static is a ga4gh.Translator that returns a single static Identity.

func (*Static) TranslateToken

func (s *Static) TranslateToken(context.Context, string) (*ga4gh.Identity, error)

TranslateToken implements the ga4gh.Translator interface.

type Translator

type Translator interface {
	TranslateToken(ctx context.Context, auth string) (*ga4gh.Identity, error)
}

Translator is used to convert an HTTP bearer authorization string that is _not_ in the normal Identity format into an Identity. This is useful when interoperating with systems that do not yet provide a GA4GH identity.

func CreateTranslator

func CreateTranslator(ctx context.Context, iss, translateUsing, clientID, publicKey, selfIssuer string, signer kms.Signer) (Translator, error)

CreateTranslator creates a Translator for a particular token issuer.

Jump to

Keyboard shortcuts

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