TeskaLabs / seacat-auth

SeaCat Auth provides authentication, authorization, identity management, session management and other access control features.
GNU General Public License v3.0
11 stars 7 forks source link

External login webhook #286

Closed byewokko closed 10 months ago

byewokko commented 11 months ago

closes #282

When an unknown user logs in via external identity provider, a webhook is triggered. The target service can register the user and send back their credential ID. If the response contains a valid credential_id, the login proceeds as successful.

Registration webhook

Example

Config:

[seacatauth:external_login]
registration_webhook_uri=http://localhost:8089/external_registration

Request (from Seacat Auth):

POST http://localhost:8089/external_registration
{
  "provider_type": "google",
  "authorization_response": {
    "scope": "email profile openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
    "authuser": "0",
    "prompt": "consent"
  },
  "user_info": {
    "iss": "accounts.google.com",
    "sub": "01234567890123456789",
    "email": "abcdefgh@gmail.com",
    "email_verified": true
  }
}

Response (from the webhook client):

{"credential_id": "mongodb:custom:abcd123456789"}