saml

package
v0.0.0-...-2873e01 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchIDPMetadata

func FetchIDPMetadata(ctx context.Context, u url.URL) (*saml.EntityDescriptor, error)

FetchIDPMetadata loads the idp metadata, usually the url is configured in settings

func TemplateProvider

func TemplateProvider(url, name string) templateProvider

TemplateProvider adds a wrapper to the button data that is displayed on the login form

func UpdateSettings

func UpdateSettings(source *types.AppSettings, dest *settings.Settings)

UpdateSettings applies the app settings to the auth specific settings

Types

type IdpIdentityPayload

type IdpIdentityPayload struct {
	Name       string
	Handle     string
	Identifier string
}

type SamlSPArgs

type SamlSPArgs struct {
	Enabled bool

	AcsURL  string
	MetaURL string
	SloURL  string

	SignRequests    bool
	SignatureMethod string

	Binding string

	// user meta from idp
	IdentityPayload IdpIdentityPayload

	IdpURL      url.URL
	Host        url.URL
	Certificate *x509.Certificate
	PrivateKey  *rsa.PrivateKey
	IdpMeta     *saml.EntityDescriptor
}

type SamlSPService

type SamlSPService struct {
	Enabled bool

	IdpURL      url.URL
	Host        url.URL
	IDPUserMeta *IdpIdentityPayload
	IDPMeta     *saml.EntityDescriptor
	// contains filtered or unexported fields
}

func NewSamlSPService

func NewSamlSPService(log *zap.Logger, args SamlSPArgs) (s *SamlSPService, err error)

NewSamlSPService loads the certificates and registers the already fetched IDP metadata into the SAML middleware

func (*SamlSPService) GuessIdentifier

func (ssp *SamlSPService) GuessIdentifier(payload map[string][]string) string

GuessIdentifier tries to guess the necessary (email) key for external authentication

func (*SamlSPService) Handler

func (ssp *SamlSPService) Handler() *samlsp.Middleware

func (*SamlSPService) NameIdentifier

func (ssp *SamlSPService) NameIdentifier() string

func (*SamlSPService) ServeHTTP

func (ssp *SamlSPService) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP enables us to use the service directly in the router

Jump to

Keyboard shortcuts

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