samlprovider

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 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 GetSessionCache added in v1.0.9

func GetSessionCache(samlServiceProvider *SamlServiceProvider) *securityprotocol.SessionCache

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
	Config              *SamlServiceProviderConfig
	// 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

type WrappingSessionCache added in v1.0.9

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

func (WrappingSessionCache) DeleteSessionData added in v1.0.9

func (w WrappingSessionCache) DeleteSessionData(sessionId string) error

func (WrappingSessionCache) FindSessionDataForSessionId added in v1.0.9

func (w WrappingSessionCache) FindSessionDataForSessionId(sessionId string) (*securityprotocol.SessionData, error)

func (WrappingSessionCache) SaveSessionData added in v1.0.9

func (w WrappingSessionCache) SaveSessionData(data *securityprotocol.SessionData) error

Jump to

Keyboard shortcuts

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