Documentation ¶
Overview ¶
Package translator provides implementations of the ga4gh.Translator interface for translating between different identity providers and GA4GH identities.
Index ¶
- Constants
- func FetchUserinfoClaims(ctx context.Context, client *http.Client, id *ga4gh.Identity, tok string, ...) (*ga4gh.Identity, error)
- func GetPassportTranslators() *dampb.PassportTranslatorsResponse
- func PassportTranslators() map[string]*dampb.PassportTranslator
- type DbGapTranslator
- type OIDCIdentityTranslator
- type Static
- type Translator
Constants ¶
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, signingPrivateKey string) (*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 ¶
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 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, selfSigningKey string) (Translator, error)
CreateTranslator creates a Translator for a particular token issuer.