oauthsigner

package
v2.24.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadPrivateKey

func LoadPrivateKey(path urischeme.URIScheme) (interface{}, error)

Types

type AccessTokenType

type AccessTokenType string
const AccessTokenType_JWT AccessTokenType = "jwt"

type Client

type Client struct {
	ID                  string                 `yaml:"id"`
	SecretFile          urischeme.URIScheme    `yaml:"secretFile"`
	Owner               string                 `yaml:"owner"`
	AccessTokenLifetime time.Duration          `yaml:"accessTokenLifetime"`
	AllowedGrantTypes   []GrantType            `yaml:"allowedGrantTypes"`
	AllowedAudiences    []string               `yaml:"allowedAudiences"`
	AllowedScopes       []string               `yaml:"allowedScopes"`
	JWTPrivateKey       PrivateKeyJWTConfig    `yaml:"jwtPrivateKey"`
	InsertTokenClaims   map[string]interface{} `yaml:"insertTokenClaims"`

	// runtime
	Secret string `yaml:"-"`
}

func (*Client) Validate

func (c *Client) Validate() error

type Config

type Config struct {
	PrivateKeyFile urischeme.URIScheme `yaml:"privateKeyFile" json:"privateKeyFile"`
	Domain         string              `yaml:"domain" json:"domain"`
	OwnerClaim     string              `yaml:"ownerClaim" json:"ownerClaim"`
	DeviceIDClaim  string              `yaml:"deviceIDClaim" json:"deviceIDClaim"`
	Clients        OAuthClientsConfig  `yaml:"clients" json:"clients"`
}

func (*Config) GetAuthority

func (c *Config) GetAuthority() string

func (*Config) GetDomain

func (c *Config) GetDomain() string

func (*Config) Validate

func (c *Config) Validate() error

type GrantType

type GrantType string
const (
	GrantTypeClientCredentials GrantType = "client_credentials"
)

type OAuthClientsConfig

type OAuthClientsConfig []*Client

func (OAuthClientsConfig) Find

func (c OAuthClientsConfig) Find(id string) *Client

type OAuthSigner

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

func New

func New(ctx context.Context, config Config, getOpenIDConfiguration validator.GetOpenIDConfigurationFunc, customTokenIssuerClients map[string]pkgJwt.TokenIssuerClient, fileWatcher *fsnotify.Watcher, logger log.Logger, tracerProvider trace.TracerProvider) (*OAuthSigner, error)

func (*OAuthSigner) Close

func (s *OAuthSigner) Close()

func (*OAuthSigner) GetAuthority

func (s *OAuthSigner) GetAuthority() string

func (*OAuthSigner) GetClients

func (s *OAuthSigner) GetClients() OAuthClientsConfig

func (*OAuthSigner) GetDeviceIDClaim

func (s *OAuthSigner) GetDeviceIDClaim() string

func (*OAuthSigner) GetDomain

func (s *OAuthSigner) GetDomain() string

func (*OAuthSigner) GetJWK

func (s *OAuthSigner) GetJWK() jwk.Key

func (*OAuthSigner) GetOwnerClaim

func (s *OAuthSigner) GetOwnerClaim() string

func (*OAuthSigner) GetValidator

func (s *OAuthSigner) GetValidator(clientID string) (*validator.Validator, bool)

func (*OAuthSigner) Sign

func (s *OAuthSigner) Sign(token jwt.Token) ([]byte, error)

func (*OAuthSigner) SignRaw

func (s *OAuthSigner) SignRaw(data []byte) ([]byte, error)

type PrivateKeyJWTConfig

type PrivateKeyJWTConfig struct {
	Enabled       bool             `yaml:"enabled"`
	Authorization validator.Config `yaml:"authorization,omitempty"`
}

func (*PrivateKeyJWTConfig) Validate

func (c *PrivateKeyJWTConfig) Validate() error

Jump to

Keyboard shortcuts

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