mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 18:36:30 +02:00
* remove directory providers and support for groups * idp: remove directory providers * better error messages * fix errors * restore postgres * fix test
35 lines
977 B
Go
35 lines
977 B
Go
package authenticate
|
|
|
|
import (
|
|
"github.com/pomerium/pomerium/config"
|
|
"github.com/pomerium/pomerium/internal/identity"
|
|
"github.com/pomerium/pomerium/internal/identity/oauth"
|
|
"github.com/pomerium/pomerium/internal/urlutil"
|
|
)
|
|
|
|
func defaultGetIdentityProvider(options *config.Options, idpID string) (identity.Authenticator, error) {
|
|
authenticateURL, err := options.GetAuthenticateURL()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
redirectURL, err := urlutil.DeepCopy(authenticateURL)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
redirectURL.Path = options.AuthenticateCallbackPath
|
|
|
|
idp, err := options.GetIdentityProviderForID(idpID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return identity.NewAuthenticator(oauth.Options{
|
|
RedirectURL: redirectURL,
|
|
ProviderName: idp.GetType(),
|
|
ProviderURL: idp.GetUrl(),
|
|
ClientID: idp.GetClientId(),
|
|
ClientSecret: idp.GetClientSecret(),
|
|
Scopes: idp.GetScopes(),
|
|
AuthCodeOptions: idp.GetRequestParams(),
|
|
})
|
|
}
|