provider

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 38 Imported by: 4 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AttributeEmail int = iota
	AttributeFullName
	AttributeGivenName
	AttributeSurname
	AttributeUsername
	AttributeUserID
)
View Source
const (
	PostBinding     = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
	RedirectBinding = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
	SOAPBinding     = "urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
)
View Source
const (
	DefaultTimeFormat                = "2006-01-02T15:04:05.999999Z"
	StatusCodeSuccess                = "urn:oasis:names:tc:SAML:2.0:status:Success"
	StatusCodeVersionMissmatch       = "urn:oasis:names:tc:SAML:2.0:status:VersionMismatch"
	StatusCodeAuthNFailed            = "urn:oasis:names:tc:SAML:2.0:status:AuthnFailed"
	StatusCodeInvalidAttrNameOrValue = "urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue"
	StatusCodeInvalidNameIDPolicy    = "urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy"
	StatusCodeRequestDenied          = "urn:oasis:names:tc:SAML:2.0:status:RequestDenied"
	StatusCodeRequestUnsupported     = "urn:oasis:names:tc:SAML:2.0:status:RequestUnsupported"
	StatusCodeUnsupportedBinding     = "urn:oasis:names:tc:SAML:2.0:status:UnsupportedBinding"
	StatusCodeResponder              = "urn:oasis:names:tc:SAML:2.0:status:Responder"
	StatusCodePartialLogout          = "urn:oasis:names:tc:SAML:2.0:status:PartialLogout"
)

Variables

This section is empty.

Functions

func CreateRouter

func CreateRouter(p *Provider, interceptors ...HttpInterceptor) *mux.Router

func NewID

func NewID() string

func Readiness

func Readiness(w http.ResponseWriter, r *http.Request, probes ...ProbesFn)

Types

type Attributes

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

func (*Attributes) GetNameID

func (a *Attributes) GetNameID() *saml.NameIDType

func (*Attributes) GetSAML

func (a *Attributes) GetSAML() []*saml.AttributeType

func (*Attributes) SetEmail

func (a *Attributes) SetEmail(value string)

func (*Attributes) SetFullName

func (a *Attributes) SetFullName(value string)

func (*Attributes) SetGivenName

func (a *Attributes) SetGivenName(value string)

func (*Attributes) SetSurname

func (a *Attributes) SetSurname(value string)

func (*Attributes) SetUserID

func (a *Attributes) SetUserID(value string)

func (*Attributes) SetUsername

func (a *Attributes) SetUsername(value string)

type AuthRequestForm

type AuthRequestForm struct {
	AuthRequest string
	Encoding    string
	RelayState  string
	SigAlg      string
	Sig         string
	Binding     string
}

type AuthResponseForm

type AuthResponseForm struct {
	RelayState                  string
	SAMLResponse                string
	AssertionConsumerServiceURL string
}

type AuthStorage

type AuthStorage interface {
	CreateAuthRequest(context.Context, *samlp.AuthnRequestType, string, string, string, string) (models.AuthRequestInt, error)
	AuthRequestByID(context.Context, string) (models.AuthRequestInt, error)
}

type Certificate

type Certificate struct {
	Path           string
	PrivateKeyPath string
	CaPath         string
}

type Config

type Config struct {
	MetadataEndpoint *op.Endpoint
	MetadataConfig   *MetadataConfig
	IDPConfig        *IdentityProviderConfig

	Organisation  *Organisation
	ContactPerson *ContactPerson
}

type ContactPerson

type ContactPerson struct {
	ContactType     md.ContactTypeType
	Company         string
	GivenName       string
	SurName         string
	EmailAddress    string
	TelephoneNumber string
}

type Endpoint

type Endpoint struct {
	Path string `yaml:"Path"`
	URL  string `yaml:"URL"`
}

type EndpointConfig

type EndpointConfig struct {
	Certificate   Endpoint `yaml:"Certificate"`
	Callback      Endpoint `yaml:"Callback"`
	SingleSignOn  Endpoint `yaml:"SingleSignOn"`
	SingleLogOut  Endpoint `yaml:"SingleLogOut"`
	Artifact      Endpoint `yaml:"Artifact"`
	SLOArtifact   Endpoint `yaml:"SLOArtifact"`
	NameIDMapping Endpoint `yaml:"NameIDMapping"`
	Attribute     Endpoint `yaml:"Attribute"`
}

type EntityStorage

type EntityStorage interface {
	GetCA(context.Context, chan<- key.CertificateAndKey)
	GetMetadataSigningKey(context.Context, chan<- key.CertificateAndKey)
}

type HttpInterceptor

type HttpInterceptor func(http.Handler) http.Handler

type IDPStorage

type IDPStorage interface {
	AuthStorage
	IdentityProviderStorage
	UserStorage
	Health(context.Context) error
}

type IdentityProvider

type IdentityProvider struct {
	EntityID   string
	Metadata   *md.IDPSSODescriptorType
	AAMetadata *md.AttributeAuthorityDescriptorType

	CertificateEndpoint           op.Endpoint
	CallbackEndpoint              op.Endpoint
	SingleSignOnEndpoint          op.Endpoint
	SingleLogoutEndpoint          op.Endpoint
	ArtifactResulationEndpoint    op.Endpoint
	SLOArtifactResulationEndpoint op.Endpoint
	NameIDMappingEndpoint         op.Endpoint
	AttributeEndpoint             op.Endpoint
	// contains filtered or unexported fields
}

func NewIdentityProvider

func NewIdentityProvider(metadataEndpoint *op.Endpoint, conf *IdentityProviderConfig, storage IDPStorage) (*IdentityProvider, error)

func (*IdentityProvider) DeleteServiceProvider

func (p *IdentityProvider) DeleteServiceProvider(entityID string) error

func (*IdentityProvider) GetRoutes

func (p *IdentityProvider) GetRoutes() []*Route

func (*IdentityProvider) GetServiceProvider

func (p *IdentityProvider) GetServiceProvider(ctx context.Context, entityID string) (*serviceprovider.ServiceProvider, error)

type IdentityProviderConfig

type IdentityProviderConfig struct {
	MetadataIDPConfig *MetadataIDPConfig

	SignatureAlgorithm  string
	DigestAlgorithm     string
	EncryptionAlgorithm string

	WantAuthRequestsSigned string

	Endpoints *EndpointConfig `yaml:"Endpoints"`
}

type IdentityProviderStorage

type IdentityProviderStorage interface {
	GetEntityByID(ctx context.Context, entityID string) (*serviceprovider.ServiceProvider, error)
	GetEntityIDByAppID(ctx context.Context, entityID string) (string, error)
	GetResponseSigningKey(context.Context, chan<- key.CertificateAndKey)
}

type LogoutRequestForm

type LogoutRequestForm struct {
	LogoutRequest string
	Encoding      string
	RelayState    string
}

type LogoutResponse

type LogoutResponse struct {
	LogoutTemplate *template.Template
	RelayState     string
	SAMLResponse   string
	LogoutURL      string

	RequestID string
	Issuer    string
	ErrorFunc func(err error)
}

type LogoutResponseForm

type LogoutResponseForm struct {
	RelayState   string
	SAMLResponse string
	LogoutURL    string
}

type MetadataConfig

type MetadataConfig struct {
	Path               string
	URL                string
	SignatureAlgorithm string
}

type MetadataIDPConfig

type MetadataIDPConfig struct {
	ValidUntil    string
	CacheDuration string
	ErrorURL      string
}

type Option

type Option func(o *Provider) error

func WithHttpInterceptors

func WithHttpInterceptors(interceptors ...HttpInterceptor) Option

type Organisation

type Organisation struct {
	Name        string
	DisplayName string
	URL         string
}

type ProbesFn

type ProbesFn func(context.Context) error

func ReadyStorage

func ReadyStorage(s Storage) ProbesFn

type Provider

type Provider struct {
	MetadataEndpoint *op.Endpoint
	Metadata         *md.EntityDescriptorType

	IdentityProvider *IdentityProvider
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(
	ctx context.Context,
	storage Storage,
	conf *Config,
	providerOpts ...Option,
) (*Provider, error)

func (*Provider) GetMetadata

func (p *Provider) GetMetadata() (*md.EntityDescriptorType, error)

func (*Provider) Health

func (p *Provider) Health(ctx context.Context) error

func (*Provider) HttpHandler

func (p *Provider) HttpHandler() http.Handler

func (*Provider) Probes

func (p *Provider) Probes() []ProbesFn

func (*Provider) Storage

func (p *Provider) Storage() Storage

type Response

type Response struct {
	PostTemplate    *template.Template
	ProtocolBinding string
	RelayState      string
	AcsUrl          string
	Signature       string
	SigAlg          string
	ErrorFunc       func(err error)

	RequestID string
	Issuer    string
	Audience  string
	SendIP    string
}

type Route

type Route struct {
	Endpoint   string
	HandleFunc http.HandlerFunc
}

type UserStorage

type UserStorage interface {
	SetUserinfoWithUserID(ctx context.Context, userinfo models.AttributeSetter, userID string, attributes []int) (err error)
	SetUserinfoWithLoginName(ctx context.Context, userinfo models.AttributeSetter, loginName string, attributes []int) (err error)
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
xml
md

Jump to

Keyboard shortcuts

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