oidc

package
v0.68.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package oidc provides utilities for working with OIDC ID tokens.

This package is experimental and subject to change.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDToken

type IDToken struct {
	Value string
}

IDToken represents an OIDC ID token that can be exchanged for a Databricks access token.

type IDTokenSource

type IDTokenSource interface {
	IDToken(ctx context.Context, audience string) (*IDToken, error)
}

IDTokenSource is anything that returns an IDToken given an audience.

func NewEnvIDTokenSource

func NewEnvIDTokenSource(env string) IDTokenSource

NewEnvIDTokenSource returns an IDTokenSource that reads the IDtoken from environment variable env.

Note that the IDTokenSource does not cache the token and will read the token from environment variable env each time.

func NewFileTokenSource

func NewFileTokenSource(path string) IDTokenSource

NewFileTokenSource returns an IDTokenSource that reads the ID token from a file. The file should contain a single line with the token.

type IDTokenSourceFn

type IDTokenSourceFn func(ctx context.Context, audience string) (*IDToken, error)

IDTokenSourceFn is an adapter to allow the use of ordinary functions as IDTokenSource.

Example:

   ts := IDTokenSourceFn(func(ctx context.Context, aud string) (*IDToken, error) {
		return &IDToken{}, nil
   })

func (IDTokenSourceFn) IDToken

func (fn IDTokenSourceFn) IDToken(ctx context.Context, audience string) (*IDToken, error)

Jump to

Keyboard shortcuts

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