oauthpki

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config uses jwt assertions over client_secret for oauth2 authentication of the application. This implementation was made specifically for Azure AD.

https://learn.microsoft.com/en-us/azure/active-directory/develop/certificate-credentials

However this does mostly follow the standard. We can generalize this as we include support for more IDPs.

https://datatracker.ietf.org/doc/html/rfc7523

func NewOauth2PKIConfig

func NewOauth2PKIConfig(params ConfigParams) (*Config, error)

NewOauth2PKIConfig creates the oauth2 config for PKI based auth. It requires the certificate and it's private key. The values should be passed in as PEM encoded values, which is the standard encoding for x509 certs saved to disk. It should look like:

-----BEGIN RSA PRIVATE KEY---- ... -----END RSA PRIVATE KEY-----

-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----

func (*Config) AuthCodeURL

func (ja *Config) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string

func (*Config) Exchange

func (ja *Config) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)

Exchange includes the client_assertion signed JWT.

func (*Config) TokenSource

func (ja *Config) TokenSource(ctx context.Context, token *oauth2.Token) oauth2.TokenSource

type ConfigParams

type ConfigParams struct {
	ClientID       string
	TokenURL       string
	Scopes         []string
	PemEncodedKey  []byte
	PemEncodedCert []byte

	Config promoauth.OAuth2Config
}

Jump to

Keyboard shortcuts

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