samlprovider

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadIdpMetadata

func DownloadIdpMetadata(config *SamlServiceProviderConfig) ([]byte, error)

func EntityDescriptor

func EntityDescriptor(bodyBytes []byte) ([]byte, error)

func ExtractNameID

func ExtractNameID(assertionXml string) string

func ExtractSessionIndex

func ExtractSessionIndex(assertionXml string) string

func GetSignedAssertions

func GetSignedAssertions(samlResponse string, cert *tls.Certificate) (string, error)

Types

type EntitiesDescriptor

type EntitiesDescriptor struct {
	XMLName           xml.Name `xml:"EntitiesDescriptor"`
	EntityDescriptors types.EntityDescriptor
}

type SamlHandler

type SamlHandler struct {
	RoleAttributeName string
	AllowedRoles      []string

	Logger *zap.SugaredLogger
	// contains filtered or unexported fields
}

func NewSamlHandler

func NewSamlHandler(config *SamlServiceProviderConfig, provider *SamlServiceProvider) *SamlHandler

func (*SamlHandler) GetSessionId

func (handler *SamlHandler) GetSessionId(r *http.Request) string

func (*SamlHandler) Handle

func (handler *SamlHandler) Handle(w http.ResponseWriter, r *http.Request) (int, error)

type SamlServiceProvider

type SamlServiceProvider struct {
	SessiondataHeaderName string

	SamlServiceProvider *saml2.SAMLServiceProvider
	SamlHandler         *SamlHandler
	Logger              *zap.SugaredLogger
	// contains filtered or unexported fields
}

func NewSamlServiceProviderFromConfig

func NewSamlServiceProviderFromConfig(config *SamlServiceProviderConfig, sessionCache securityprotocol.SessionCache) (*SamlServiceProvider, error)

func (*SamlServiceProvider) CreateLogoutResponse

func (a *SamlServiceProvider) CreateLogoutResponse(logoutRequest *saml2.LogoutRequest, w http.ResponseWriter) (int, error)

func (SamlServiceProvider) GenerateAuthenticationRequest

func (a SamlServiceProvider) GenerateAuthenticationRequest(w http.ResponseWriter, r *http.Request) (int, error)

func (SamlServiceProvider) HandleService

func (*SamlServiceProvider) Metadata

func (provider *SamlServiceProvider) Metadata() (*types.EntityDescriptor, error)

func (*SamlServiceProvider) ParseLogoutPayload

func (a *SamlServiceProvider) ParseLogoutPayload(r *http.Request) (*saml2.LogoutRequest, *types.LogoutResponse, error)

type SamlServiceProviderConfig

type SamlServiceProviderConfig struct {
	ServiceProviderKeystore *tls.Certificate
	EntityId                string
	CookieDomain            string
	CookiePath              string
	AudienceRestriction     string
	SignAuthnRequest        bool
	IdpMetaDataUrl          string
	SessionHeaderName       string
	SessionExpiryHours      string
	SessiondataHeaderName   string
	SkipSignatureValidation bool

	ExternalUrl       string
	SamlMetadataPath  string
	SamlLogoutPath    string
	SamlSLOPath       string
	SamlSSOPath       string
	LogoutLandingPage string

	RoleAttributeName string
	AllowedRoles      []string

	Logger *zap.SugaredLogger
}

func (*SamlServiceProviderConfig) AssertionConsumerServiceUrl

func (config *SamlServiceProviderConfig) AssertionConsumerServiceUrl() string

func (*SamlServiceProviderConfig) SloConsumerServiceUrl

func (config *SamlServiceProviderConfig) SloConsumerServiceUrl() string

Jump to

Keyboard shortcuts

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