db

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2019 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	sync.Mutex
	// contains filtered or unexported fields
}

DB emulates a database driver using in-memory data structures.

func New

func New() *DB

New initializes a new "DB" with dummy data.

func (*DB) AddServiceProvider

func (db *DB) AddServiceProvider(service *samlidp.Service) error

AddServiceProvider adds metadata of the SP

func (*DB) AddSession

func (db *DB) AddSession(session *saml.Session) error

AddSession adds new sessions

func (*DB) DeleteServiceProvider

func (db *DB) DeleteServiceProvider(serviceID string) error

DeleteServiceProvider deletes metadata for the given serviceID

func (*DB) DeleteSession

func (db *DB) DeleteSession(sessionID string) error

DeleteSession deletes session

func (*DB) GetServiceProvider

func (db *DB) GetServiceProvider(r *http.Request, serviceProviderID string) (*saml.EntityDescriptor, error)

GetServiceProvider returns spMetadata for given serviceProviderID which is entityID

func (*DB) GetServiceProviders

func (db *DB) GetServiceProviders() (*[]samlidp.Service, error)

GetServiceProviders lists all SP

func (*DB) GetSession

func (db *DB) GetSession(w http.ResponseWriter, r *http.Request, req *saml.IdpAuthnRequest) (*saml.Session, error)

GetSession return saml Session

func (*DB) GetSessions

func (db *DB) GetSessions() (*[]saml.Session, error)

GetSessions lists all session

type FakeDB

type FakeDB struct {
	Name string
}

type IDPStore

type IDPStore struct {
	Services backends.Repository
	Sessions backends.Repository
}

IDPStore represents the IDP store containing the Services and Sessions repositories

func (*IDPStore) AddServiceProvider

func (s *IDPStore) AddServiceProvider(service *samlidp.Service) error

AddServiceProvider register new service provider, update if already exists.

func (*IDPStore) AddSession

func (s *IDPStore) AddSession(session *saml.Session) error

AddSession adds new session in DB

func (*IDPStore) DeleteServiceProvider

func (s *IDPStore) DeleteServiceProvider(serviceID string) error

DeleteServiceProvider deletes the service by serviceID which is EntityID

func (*IDPStore) DeleteSession

func (s *IDPStore) DeleteSession(sessionID string) error

DeleteSession deletes session by sessionID which is cookie value

func (*IDPStore) GetServiceProvider

func (s *IDPStore) GetServiceProvider(r *http.Request, serviceProviderID string) (*saml.EntityDescriptor, error)

GetServiceProvider returns the Service Provider metadata for the service provider ID, which is typically the service provider's metadata URL. If an appropriate service provider cannot be found then the returned error must be os.ErrNotExist.

func (*IDPStore) GetServiceProviders

func (s *IDPStore) GetServiceProviders() (*[]samlidp.Service, error)

GetServiceProviders returns all SP

func (*IDPStore) GetSession

func (s *IDPStore) GetSession(w http.ResponseWriter, r *http.Request, req *saml.IdpAuthnRequest) (*saml.Session, error)

GetSession returns the *Session for this request. If a session cookie already exists and represents a valid session, then the session is returned

func (*IDPStore) GetSessions

func (s *IDPStore) GetSessions() (*[]saml.Session, error)

GetSessions returns all sessions

type Repository

type Repository interface {
	// AddSession adds new session in DB
	AddSession(session *saml.Session) error
	// GetSession looks up a Sessions by the session ID.
	GetSession(w http.ResponseWriter, r *http.Request, req *saml.IdpAuthnRequest) (*saml.Session, error)
	// DeleteSession deletes session by sessionID which is cookie value
	DeleteSession(sessionID string) error
	// GetSessions returns all sessions
	GetSessions() (*[]saml.Session, error)

	// AddServiceProvider register new service provider
	AddServiceProvider(service *samlidp.Service) error
	// GetServiceProvider returns the Service Provider metadata for the service provider IDs
	GetServiceProvider(r *http.Request, serviceProviderID string) (*saml.EntityDescriptor, error)
	// DeleteServiceProvider deletes the service by serviceID which is EntityID
	DeleteServiceProvider(serviceID string) error
	// GetServiceProviders returns all SP
	GetServiceProviders() (*[]samlidp.Service, error)
}

Repository defines interface for accessing DB

func NewIDPStore

func NewIDPStore(cfg *config.DBConfig) (store Repository, cleanup func(), err error)

NewIDPStore creates IDP's repositories

Jump to

Keyboard shortcuts

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