provider

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package provider has the interfaces of the providers people sign in with, such as Google, GitHub and LDAP, which exchange what proves who someone is for an identity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client added in v0.0.15

func Client(ctx context.Context, credentials credential.CredentialProvider, key string) (*schema.OAuthClient, error)

Client returns the OAuth client which is the credential's value, at the key, which needs a client ID. It's read each time it's needed, so a changed secret is used without a restart.

func NewVerifier added in v0.0.15

func NewVerifier() string

NewVerifier returns a new PKCE verifier, or state, which is random

Types

type Provider

type Provider interface {
	// Meta describes the provider, for anyone to see
	Meta() schema.ProviderMeta

	// Exchange returns the identity a credential is for
	Exchange(ctx context.Context, credential schema.Credential) (*schema.Identity, error)
}

Provider is signed in with, and exchanges a credential for an identity: an error, which is not authorized when the credential isn't right, or the identity of the person it's for

type RedirectProvider added in v0.0.15

type RedirectProvider interface {
	Provider

	// AuthCodeURL returns the URL of the provider's sign-in page, which
	// redirects to the redirect URL with a code, and the state, when the
	// person has signed in. The code is only exchanged with the verifier,
	// as PKCE.
	AuthCodeURL(ctx context.Context, redirectURL, state, verifier string) (string, error)
}

RedirectProvider is a provider which is signed in with at its own pages, such as Google's, which redirect back with a code, which is exchanged

Directories

Path Synopsis
Package file keeps sessions in files, in a directory, one for each, named by the SHA-256 of its token, which isn't kept, so they last when the server restarts, without a database.
Package file keeps sessions in files, in a directory, one for each, named by the SHA-256 of its token, which isn't kept, so they last when the server restarts, without a database.
Package github is a provider of GitHub, or GitHub Enterprise, which is signed in with at GitHub, as an OAuth app, which isn't OpenID Connect, so the identity is the user GitHub's API says the token is for.
Package github is a provider of GitHub, or GitHub Enterprise, which is signed in with at GitHub, as an OAuth app, which isn't OpenID Connect, so the identity is the user GitHub's API says the token is for.
Package ldap is a provider of an LDAP directory, which is signed in with a username and password, which is checked with a bind as the user, whose groups are the identity's.
Package ldap is a provider of an LDAP directory, which is signed in with a username and password, which is checked with a bind as the user, whose groups are the identity's.
Package oidc is a provider which is an OpenID Connect issuer, such as Google, Microsoft or Keycloak, which is signed in with at its own pages, and whose ID tokens are checked against its keys.
Package oidc is a provider which is an OpenID Connect issuer, such as Google, Microsoft or Keycloak, which is signed in with at its own pages, and whose ID tokens are checked against its keys.

Jump to

Keyboard shortcuts

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