Help us shape the future of Go! Take the 2026 Go Developer Survey

credentials

package
v0.20.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientSecretPostRP added in v0.20.0

func NewClientSecretPostRP(ctx context.Context, issuer, clientID, clientSecret, redirectURI string, opts ...Option) (rp.RelyingParty, error)

NewClientSecretPostRP returns an rp.RelyingParty that follows the 'client_secret_post' client authentication method defined by the OIDC specification: the client_id and client_secret are sent in the request body. https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication

func NewClientSecretPostRS added in v0.20.0

func NewClientSecretPostRS(ctx context.Context, issuer, clientID, clientSecret string, opts ...Option) (rs.ResourceServer, error)

NewClientSecretPostRS returns an rs.ResourceServer that follows the 'client_secret_post' client authentication method defined by the OIDC specification: the client_id and client_secret are sent in the request body. https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication

func NewInsecureRP added in v0.20.0

func NewInsecureRP(ctx context.Context, issuer, clientID, redirectURI string, opts ...Option) (rp.RelyingParty, error)

NewInsecureRP returns an rp.RelyingParty that sends only the client_id without any client authentication. It must not be used in production.

func NewInsecureRS added in v0.20.0

func NewInsecureRS(ctx context.Context, issuer, clientID string, opts ...Option) (rs.ResourceServer, error)

NewInsecureRS returns an rs.ResourceServer that only sends the client_id in the request body without any client authentication. It must not be used in production.

func NewTLSRP added in v0.20.0

func NewTLSRP(ctx context.Context, issuer, clientID, redirectURI string, tlsConfig *tls.Config, opts ...Option) (rp.RelyingParty, error)

NewTLSRP returns an rp.RelyingParty that authenticates the client using mutual TLS: the TLS client certificate configured in tlsConfig proves the client's identity, while the client_id is still sent in the request body.

func NewTLSRS added in v0.20.0

func NewTLSRS(ctx context.Context, issuer, clientID string, tlsConfig *tls.Config, opts ...Option) (rs.ResourceServer, error)

NewTLSRS returns an rs.ResourceServer that authenticates the client using mutual TLS: the TLS client certificate configured in tlsConfig proves the client's identity, while the client_id is still sent in the request body.

Types

type InsecureProvider added in v0.20.0

type InsecureProvider struct{}

func (InsecureProvider) GetDiscoveryConfig added in v0.20.0

func (p InsecureProvider) GetDiscoveryConfig(ctx context.Context, issuer string) (*oidc.DiscoveryConfiguration, error)

GetDiscoveryConfig performs a direct OIDC discovery.

func (InsecureProvider) RelyingParty added in v0.20.0

func (p InsecureProvider) RelyingParty(ctx context.Context, oidc *oidcv1.OIDC, redirectURI string) (rp.RelyingParty, error)

func (InsecureProvider) ResourceServer added in v0.20.0

func (p InsecureProvider) ResourceServer(ctx context.Context, clientID, issuer string) (rs.ResourceServer, error)

type Option added in v0.20.0

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

Option configures a credentials constructor.

func WithDiscoveryConfig added in v0.20.0

func WithDiscoveryConfig(disc *oidc.DiscoveryConfiguration) Option

WithDiscoveryConfig provides a pre-fetched OIDC discovery configuration. When set, constructors use the provided config directly and skip the OIDC discovery HTTP call.

type Provider added in v0.20.0

type Provider interface {
	ResourceServer(ctx context.Context, clientID, issuer string) (rs.ResourceServer, error)
	RelyingParty(ctx context.Context, oidc *oidcv1.OIDC, redirectURI string) (rp.RelyingParty, error)
	GetDiscoveryConfig(ctx context.Context, issuer string) (*oidc.DiscoveryConfiguration, error)
}

Provider constructs an rs.ResourceServer, an rp.RelyingParty, and fetches raw OIDC discovery configuration for the given issuer.

Jump to

Keyboard shortcuts

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