fusionauth

package
v0.0.0-...-bee1497 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Unlicense Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AuthorizeEndpoint ...
	AuthorizeEndpoint = "http://localhost:9011/oauth2/authorize"
	// JWKSEndpoint ...
	JWKSEndpoint = "http://localhost:9011/.well-known/jwks.json"
	// LoginEndpoint ...
	LoginEndpoint = "http://localhost:9011/api/login"
	// PublicKeyEndpoint ...
	PublicKeyEndpoint = "http://localhost:9011/api/jwt/public-key"
	// TokenEndpoint ...
	TokenEndpoint = "http://localhost:9011/oauth2/token"
)

Variables

This section is empty.

Functions

func Client

func Client(tls bool) (*http.Client, error)

Client returns a http.Client instance with TLS transport configured if tls is set to true.

func ContainsValidSigningKey

func ContainsValidSigningKey(ks []Key, alg string) bool

ContainsValidSigningKey looks for the public signing key with (use=sign) and specified signing method (alg).

func PublicSigningKeyMap

func PublicSigningKeyMap(keys []Key, filter string) map[string]Key

PublicSigningKeyMap filters the keyset by JWK property "use" and returns the resulting map.

func RetrievePublicKeyInstances

func RetrievePublicKeyInstances(km map[string]Key) (map[string]Key, error)

RetrievePublicKeyInstances gets the public signing keys from the IDP and parses the PEM key representation.

Types

type AuthConfig

type AuthConfig struct {
	ClientID     string
	ClientSecret string
	GrantType    string
	Issuer       string
	TokenURI     string
	RedirectURI  string // Must match FA config for "Authorized redirect URLs"
}

AuthConfig holds configuration for external IDP integration.

type AuthInfo

type AuthInfo struct {
	AccessToken string  `json:"access_token"`
	ExpiresIn   float64 `json:"expires_in"`
	TokenType   string  `json:"token_type"`
	UserID      string  `json:"userId"`
}

AuthInfo represents incomming data from the identity provider.

func Login

func Login(data url.Values) (AuthInfo, error)

Login uses the provided user credentials to login with the IDM and converts the resulting code grant to JWT token.

type Key

type Key struct {
	Alg          string `json:"alg"`
	ID           string `json:"kid"`
	PublicKeyPEM string `json:"publicKey"`
	Use          string `json:"use"`
	Instance     *rsa.PublicKey
}

Key represents a JSON Web Key

func PublicSigningKey

func PublicSigningKey(keyID string) (Key, error)

PublicSigningKey retrieves the public signing key identified by the passed key ID.

func RetrievePublicKeyInstance

func RetrievePublicKeyInstance(keyID string) (Key, error)

RetrievePublicKeyInstance gets the public signing key from the Identity Provider service and parses the PEM key representation into a key instance.

type KeySet

type KeySet struct {
	Keys []Key `json:"keys,omitempty"`
}

KeySet holds a JSON Web Key Set (JWKS)

func JSONWebKeySet

func JSONWebKeySet(jwksURI string) (KeySet, error)

JSONWebKeySet retrieves the publisched set of JSON Web Keys from the identity provider.

Jump to

Keyboard shortcuts

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