mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
368b9d774c
This PR partially addresses #1456, providing SSO SAML support. The flow of the code is as follows. A Kolide user attempts to access a protected resource and is directed to log in. If SSO identity providers (IDP) have been configured by an admin, the user is presented with SSO log in. The user selects SSO, which invokes a call the InitiateSSO passing the URL of the protected resource that the user was originally trying access. Kolide server loads the IDP metadata and caches it along with the URL. We then build an auth request URL for the IDP which is returned to the front end. The IDP calls the server, invoking CallbackSSO with the auth response. We extract the original request id from the response and use it to fetch the cached metadata and the URL. We check the signature of the response, and validate the timestamps. If everything passes we get the user id from the IDP response and use it to create a login session. We then build a page which executes some javascript that will write the token to web local storage, and redirect to the original URL. I've created a test web page in tools/app/authtest.html that can be used to test and debug new IDP's which also illustrates how a front end would interact with the IDP and the server. This page can be loaded by starting Kolide with the environment variable KOLIDE_TEST_PAGE_PATH to the full path of the page and then accessed at https://localhost:8080/test
53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package kolide
|
|
|
|
// Datastore combines all the interfaces in the Kolide DAL
|
|
type Datastore interface {
|
|
UserStore
|
|
QueryStore
|
|
CampaignStore
|
|
PackStore
|
|
LabelStore
|
|
HostStore
|
|
TargetStore
|
|
PasswordResetStore
|
|
SessionStore
|
|
AppConfigStore
|
|
InviteStore
|
|
ScheduledQueryStore
|
|
OptionStore
|
|
DecoratorStore
|
|
FileIntegrityMonitoringStore
|
|
YARAStore
|
|
LicenseStore
|
|
Name() string
|
|
Drop() error
|
|
// MigrateTables creates and migrates the table schemas
|
|
MigrateTables() error
|
|
// MigrateData populates built-in data
|
|
MigrateData() error
|
|
// MigrationStatus returns nil if migrations are complete, and an error
|
|
// if migrations need to be run.
|
|
MigrationStatus() (MigrationStatus, error)
|
|
}
|
|
|
|
type MigrationStatus int
|
|
|
|
const (
|
|
NoMigrationsCompleted = iota
|
|
SomeMigrationsCompleted
|
|
AllMigrationsCompleted
|
|
)
|
|
|
|
// NotFoundError is returned when the datastore resource cannot be found.
|
|
type NotFoundError interface {
|
|
error
|
|
IsNotFound() bool
|
|
}
|
|
|
|
// AlreadyExists is returned when creating a datastore resource that already
|
|
// exists.
|
|
type AlreadyExistsError interface {
|
|
error
|
|
IsExists() bool
|
|
}
|