saml

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 16 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 {
	ID                   string
	DisplayName          string
	EntityID             string // SP entity ID; defaults to MetadataURL
	MetadataURL          string // public SP metadata URL
	ACSURL               string // Assertion Consumer Service (callback) URL
	IDPMetadataURL       string
	IDPMetadataXML       string
	SPCertPEM            string
	SPKeyPEM             string
	RequireEmailVerified bool
	AllowIDPInitiated    bool
	HTTPClient           *http.Client
	// EphemeralKey is set when SP key material was generated at startup (dev only).
	EphemeralKey bool
}

Config describes a platform-wide SAML 2.0 IdP / SP pair.

type Provider

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

Provider implements identity.FederationProvider for SAML 2.0.

func New

func New(cfg Config) (*Provider, error)

New builds a SAML SP from IdP metadata and optional SP key material.

func (*Provider) AuthURL

func (p *Provider) AuthURL(state, redirectURI string) (string, error)

AuthURL builds an HTTP-Redirect AuthnRequest URL (RelayState = state).

func (*Provider) AuthURLWithID

func (p *Provider) AuthURLWithID(state, redirectURI string) (authURL, requestID string, err error)

AuthURLWithID returns the IdP redirect URL and AuthnRequest ID.

func (*Provider) DisplayName

func (p *Provider) DisplayName() string

func (*Provider) EphemeralKey

func (p *Provider) EphemeralKey() bool

EphemeralKey reports whether the SP signing key was generated at process start.

func (*Provider) Exchange

func (p *Provider) Exchange(ctx context.Context, code, redirectURI string) (identity.FederatedClaims, error)

Exchange maps SAMLResponse (base64) into claims. Prefer ExchangeAssertion from ACS.

func (*Provider) ExchangeAssertion

func (p *Provider) ExchangeAssertion(ctx context.Context, response, redirectURI string, possibleRequestIDs []string) (identity.FederatedClaims, error)

ExchangeAssertion validates a SAMLResponse and maps it to FederatedClaims.

func (*Provider) MetadataXML

func (p *Provider) MetadataXML() ([]byte, error)

MetadataXML returns the SP EntityDescriptor.

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) Type

func (p *Provider) Type() string

Jump to

Keyboard shortcuts

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