server

package
v0.0.0-...-422f14d Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTrackedRequest = errors.New("saml: tracked request not present")

ErrNoTrackedRequest is returned for invalid and expired relay states

Functions

This section is empty.

Types

type PrefixStore

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

PrefixStore enables multiple sessions to be stored in a single session store by automatically pre-pending a prefix to tokens.

func NewPrefixStore

func NewPrefixStore(prefix string, store scs.Store) *PrefixStore

NewPrefixStore wraps a session store so it can be shared.

func (*PrefixStore) Commit

func (s *PrefixStore) Commit(token string, b []byte, expiry time.Time) (err error)

Commit adds the session token and data to the store.

func (*PrefixStore) Delete

func (s *PrefixStore) Delete(token string) (err error)

Delete removes the session token and data from the store.

func (*PrefixStore) Find

func (s *PrefixStore) Find(token string) (b []byte, found bool, err error)

Find returns the data for a session token from the store.

type Server

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

Server provides an HTTP server.

func New

func New(ctx context.Context) (*Server, error)

New creates a new Server.

func (*Server) CreateSession

func (s *Server) 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 (*Server) DeleteSession

func (s *Server) 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 (*Server) GetSession

func (s *Server) GetSession(r *http.Request) (samlsp.Session, error)

GetSession returns the current samlsp.Session associated with the request, or ErrNoSession if there is no valid session.

func (*Server) GetTrackedRequest

func (s *Server) GetTrackedRequest(r *http.Request, index string) (*samlsp.TrackedRequest, error)

GetTrackedRequest returns a pending tracked request.

func (*Server) GetTrackedRequests

func (s *Server) GetTrackedRequests(r *http.Request) []samlsp.TrackedRequest

GetTrackedRequests returns all the pending tracked requests

func (*Server) LambdaHandler

LambdaHandler processes a single Lambda event.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts the server waiting for network connections.

func (*Server) StartLambdaHandler

func (s *Server) StartLambdaHandler()

StartLambdaHandler starts the server waiting for events from AWS Lambda.

func (*Server) StopTrackingRequest

func (s *Server) 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 (*Server) TrackRequest

func (s *Server) 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.

Jump to

Keyboard shortcuts

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