2015-08-18 05:57:27 +05:30
|
|
|
package connector
|
|
|
|
|
|
|
|
import (
|
2015-12-08 06:49:55 +05:30
|
|
|
"errors"
|
2015-08-18 05:57:27 +05:30
|
|
|
"html/template"
|
|
|
|
"net/http"
|
|
|
|
"net/url"
|
|
|
|
|
2015-12-08 06:49:55 +05:30
|
|
|
"github.com/coreos/dex/repo"
|
2015-08-18 05:57:27 +05:30
|
|
|
"github.com/coreos/go-oidc/oidc"
|
|
|
|
"github.com/coreos/pkg/health"
|
|
|
|
)
|
|
|
|
|
2015-12-08 06:49:55 +05:30
|
|
|
var ErrorNotFound = errors.New("connector not found in repository")
|
|
|
|
|
2015-08-18 05:57:27 +05:30
|
|
|
type Connector interface {
|
|
|
|
ID() string
|
|
|
|
LoginURL(sessionKey, prompt string) (string, error)
|
|
|
|
Register(mux *http.ServeMux, errorURL url.URL)
|
|
|
|
|
|
|
|
// Sync triggers any long-running tasks needed to maintain the
|
|
|
|
// Connector's operation. For example, this would encompass
|
|
|
|
// repeatedly caching any remote resources for local use.
|
|
|
|
Sync() chan struct{}
|
|
|
|
|
|
|
|
// TrustedEmailProvider indicates whether or not we can trust that email claims coming from this provider.
|
|
|
|
TrustedEmailProvider() bool
|
|
|
|
|
|
|
|
health.Checkable
|
|
|
|
}
|
|
|
|
|
|
|
|
//go:generate genconfig -o config.go connector Connector
|
|
|
|
type ConnectorConfig interface {
|
|
|
|
ConnectorID() string
|
|
|
|
ConnectorType() string
|
|
|
|
Connector(ns url.URL, loginFunc oidc.LoginFunc, tpls *template.Template) (Connector, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type ConnectorConfigRepo interface {
|
|
|
|
All() ([]ConnectorConfig, error)
|
2015-12-08 06:49:55 +05:30
|
|
|
GetConnectorByID(repo.Transaction, string) (ConnectorConfig, error)
|
2015-08-18 05:57:27 +05:30
|
|
|
}
|