Versions in this module Expand all Collapse all v0 v0.5.0 Mar 19, 2024 Changes in this version + var ErrNoSession = errors.New("saml: session not present") + func AttributeFromContext(ctx context.Context, name string) string + func ContextWithSession(ctx context.Context, session Session) context.Context + func DefaultOnError(w http.ResponseWriter, _ *http.Request, err error) + func DefaultServiceProvider(opts Options) saml.ServiceProvider + func FetchMetadata(ctx context.Context, httpClient *http.Client, metadataURL url.URL) (*saml.EntityDescriptor, error) + func ParseMetadata(data []byte) (*saml.EntityDescriptor, error) + func RequireAttribute(name, value string) func(http.Handler) http.Handler + type Attributes map[string][]string + func (a Attributes) Get(key string) string + type CookieRequestTracker struct + Codec TrackedRequestCodec + MaxAge time.Duration + NamePrefix string + RelayStateFunc func(w http.ResponseWriter, r *http.Request) string + SameSite http.SameSite + ServiceProvider *saml.ServiceProvider + func DefaultRequestTracker(opts Options, serviceProvider *saml.ServiceProvider) CookieRequestTracker + func (t CookieRequestTracker) GetTrackedRequest(r *http.Request, index string) (*TrackedRequest, error) + func (t CookieRequestTracker) GetTrackedRequests(r *http.Request) []TrackedRequest + func (t CookieRequestTracker) StopTrackingRequest(w http.ResponseWriter, r *http.Request, index string) error + func (t CookieRequestTracker) TrackRequest(w http.ResponseWriter, r *http.Request, samlRequestID string) (string, error) + type CookieSessionProvider struct + Codec SessionCodec + Domain string + HTTPOnly bool + MaxAge time.Duration + Name string + SameSite http.SameSite + Secure bool + func DefaultSessionProvider(opts Options) CookieSessionProvider + func (c CookieSessionProvider) CreateSession(w http.ResponseWriter, r *http.Request, assertion *saml.Assertion) error + func (c CookieSessionProvider) DeleteSession(w http.ResponseWriter, r *http.Request) error + func (c CookieSessionProvider) GetSession(r *http.Request) (Session, error) + type ErrorFunction func(w http.ResponseWriter, r *http.Request, err error) + type JWTSessionClaims struct + Attributes Attributes + SAMLSession bool + func (c JWTSessionClaims) GetAttributes() Attributes + type JWTSessionCodec struct + Audience string + Issuer string + Key *rsa.PrivateKey + MaxAge time.Duration + SigningMethod jwt.SigningMethod + func DefaultSessionCodec(opts Options) JWTSessionCodec + func (c JWTSessionCodec) Decode(signed string) (Session, error) + func (c JWTSessionCodec) Encode(s Session) (string, error) + func (c JWTSessionCodec) New(assertion *saml.Assertion) (Session, error) + type JWTTrackedRequestClaims struct + SAMLAuthnRequest bool + type JWTTrackedRequestCodec struct + Audience string + Issuer string + Key *rsa.PrivateKey + MaxAge time.Duration + SigningMethod jwt.SigningMethod + func DefaultTrackedRequestCodec(opts Options) JWTTrackedRequestCodec + func (s JWTTrackedRequestCodec) Decode(signed string) (*TrackedRequest, error) + func (s JWTTrackedRequestCodec) Encode(value TrackedRequest) (string, error) + type Middleware struct + Binding string + OnError func(w http.ResponseWriter, r *http.Request, err error) + RequestTracker RequestTracker + ResponseBinding string + ServiceProvider saml.ServiceProvider + Session SessionProvider + func New(opts Options) (*Middleware, error) + func (m *Middleware) CreateSessionFromAssertion(w http.ResponseWriter, r *http.Request, assertion *saml.Assertion, ...) + func (m *Middleware) HandleStartAuthFlow(w http.ResponseWriter, r *http.Request) + func (m *Middleware) RequireAccount(handler http.Handler) http.Handler + func (m *Middleware) ServeACS(w http.ResponseWriter, r *http.Request) + func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (m *Middleware) ServeMetadata(w http.ResponseWriter, _ *http.Request) + type Options struct + AllowIDPInitiated bool + Certificate *x509.Certificate + CookieName string + CookieSameSite http.SameSite + DefaultRedirectURI string + EntityID string + ForceAuthn bool + HTTPClient *http.Client + IDPMetadata *saml.EntityDescriptor + Intermediates []*x509.Certificate + Key *rsa.PrivateKey + LogoutBindings []string + RelayStateFunc func(w http.ResponseWriter, r *http.Request) string + RequestedAuthnContext *saml.RequestedAuthnContext + SignRequest bool + URL url.URL + UseArtifactResponse bool + type RequestTracker interface + GetTrackedRequest func(r *http.Request, index string) (*TrackedRequest, error) + GetTrackedRequests func(r *http.Request) []TrackedRequest + StopTrackingRequest func(w http.ResponseWriter, r *http.Request, index string) error + TrackRequest func(w http.ResponseWriter, r *http.Request, samlRequestID string) (index string, err error) + type Session interface + func SessionFromContext(ctx context.Context) Session + type SessionCodec interface + Decode func(string) (Session, error) + Encode func(s Session) (string, error) + New func(assertion *saml.Assertion) (Session, error) + type SessionProvider interface + CreateSession func(w http.ResponseWriter, r *http.Request, assertion *saml.Assertion) error + DeleteSession func(w http.ResponseWriter, r *http.Request) error + GetSession func(r *http.Request) (Session, error) + type SessionWithAttributes interface + GetAttributes func() Attributes + type TrackedRequest struct + Index string + SAMLRequestID string + URI string + type TrackedRequestCodec interface + Decode func(signed string) (*TrackedRequest, error) + Encode func(value TrackedRequest) (string, error)