Identity Federation
Experimental Features
Federation and Social Login/Signup are still experimental features and may not be ready for production use yet.
Beside being a full identity managenet service, AuthGuard also supports authentication users which are not managed by it directly. AuthGuard is compatible with: any standard LDAP implementation, and any OpenID Connect (OIDC) service. OIDC is what most social login providers, such as Google and Facebook, support.
#
LDAPAuthGuard can connect to an LDAP server to authenticate users. In such scenarios, the LDAP server will be the identity provider, while AuthGuard will handle only the user tokens or sessions.
Before starting, you need to make sure that the LDAP extension is available as part of your distribution. Standard distributions do not include LDAP support, so you will need a custom one. This will change when the LDAP is no longer an experimental feature.
#
Configuration#
ExchangesJust like all other authentication options, LDAP authentication is just an exchange. The extension defines the following exchanges:
- LDAP to Access Token
- LDAP to Authorization Code
- LDAP to ID Token
- LDAP to Session
- LDAP to OTP
- LDAP to Passwordless
All of them are available through /auth/exchange
endpoint. You
can check the OpenAPI documentation on how to use it.
#
Social LoginMost, if not all, of social login providers support OAuth 2.0 and OpenID Connect. AuthGuard does not have a provider-specific implementation, instead you can configure it to connect to any of them.
#
ConfigurationAs we mentioned, you can configure AuthGuard to use any OpenID Connect provider, and you do by defining a client for it.
#
FlowThere are steps to this flow: 1. get an authorization URL, 2. exchange the authorization code for valid tokens.
First you need to request the authorization URL from AuthGuard
by sending a GET request to /oauth/auth_url
with the query
parameter provider
set to one of the providers you defined
in the configuration. AuthGuard will take care of creating the
session state value to be used for interacting with the OAuth
server.
Once your client gets the URL, it should redirect the user to
that URL to perform the authentication. If that step was successful,
then the OAuth server will redirect the user back to your application
with the authorization code. You then send a POST request to
/oauth/authorize
with the name of the provider, the state, and
the authorization code. AuthGuard will then exchange the code
for the tokens from the provider and pass them back to your
application.