Documentation ¶
Index ¶
- func New(store sessions.Store, opts samlsp.Options) (*samlsp.Middleware, error)
- type RequestTracker
- func (t *RequestTracker) GetTrackedRequest(r *http.Request, index string) (*samlsp.TrackedRequest, error)
- func (t *RequestTracker) GetTrackedRequests(r *http.Request) []samlsp.TrackedRequest
- func (t *RequestTracker) StopTrackingRequest(w http.ResponseWriter, r *http.Request, index string) error
- func (t *RequestTracker) TrackRequest(w http.ResponseWriter, r *http.Request, samlRequestID string) (string, error)
- type SessionProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RequestTracker ¶
type RequestTracker struct { Store sessions.Store ServiceProvider *saml.ServiceProvider NamePrefix string Codec samlsp.TrackedRequestCodec MaxAge time.Duration }
RequestTracker tracks pending authentication requests.
func DefaultRequestTracker ¶
func DefaultRequestTracker(store sessions.Store, opts samlsp.Options, serviceProvider *saml.ServiceProvider) *RequestTracker
DefaultRequestTracker creates a new RequestTracker using the store, the saml.SessionProvider and options provided
func (*RequestTracker) GetTrackedRequest ¶
func (t *RequestTracker) GetTrackedRequest(r *http.Request, index string) (*samlsp.TrackedRequest, error)
GetTrackedRequest returns a pending tracked request.
func (*RequestTracker) GetTrackedRequests ¶
func (t *RequestTracker) GetTrackedRequests(r *http.Request) []samlsp.TrackedRequest
GetTrackedRequests returns all the pending tracked requests
func (*RequestTracker) StopTrackingRequest ¶
func (t *RequestTracker) StopTrackingRequest(w http.ResponseWriter, r *http.Request, index string) error
StopTrackingRequest stops tracking the SAML request given by index, which is a string previously returned from TrackRequest
func (*RequestTracker) TrackRequest ¶
func (t *RequestTracker) TrackRequest(w http.ResponseWriter, r *http.Request, samlRequestID string) (string, error)
TrackRequest starts tracking the SAML request with the given ID. It returns an `index` that should be used as the RelayState in the SAMl request flow.
type SessionProvider ¶
type SessionProvider struct { Store sessions.Store Name string Domain string HTTPOnly bool Secure bool MaxAge time.Duration Codec samlsp.SessionCodec }
SessionProvider is an interface implemented by types that can track the active session of a user.
func DefaultSessionProvider ¶
func DefaultSessionProvider(store sessions.Store, opts samlsp.Options) *SessionProvider
DefaultSessionProvider creates a new SessionProvider using the store and options provided
func (*SessionProvider) CreateSession ¶
func (s *SessionProvider) CreateSession(w http.ResponseWriter, r *http.Request, assertion *saml.Assertion) error
CreateSession is called when we have received a valid SAML assertion and should create a new session and modify the http response accordingly, e.g. by setting a cookie.
func (*SessionProvider) DeleteSession ¶
func (s *SessionProvider) DeleteSession(w http.ResponseWriter, r *http.Request) error
DeleteSession is called to modify the response such that it removed the current session, e.g. by deleting a cookie.
func (*SessionProvider) GetSession ¶
GetSession returns the current Session associated with the request, or ErrNoSession if there is no valid session.