Hi,
I am currently migrating authentication from local to OAUTH (authentik) and while it generally works, some pieces are missing when logging in via OAUTH.
Most notably, contact_email doesn’t get populated at all and email gets populated with the xxxx@auth.local address.
Without a valid email address, for example sharing via email doesn’t work obviously.
Here’s the relevant piece of my seahub_settings.py:
ENABLE_OAUTH = True
OAUTH_CREATE_UNKNOWN_USER = True
OAUTH_ACTIVATE_USER_AFTER_CREATION = True
OAUTH_ENABLE_INSECURE_TRANSPORT = True
OAUTH_CLIENT_ID = "xxx"
OAUTH_CLIENT_SECRET = "yyyy"
OAUTH_REDIRECT_URL = 'https://seafile.example.com/oauth/callback/'
OAUTH_PROVIDER = 'authentik-auth.example.com'
OAUTH_AUTHORIZATION_URL = 'https://auth.example.com/application/o/authorize/'
OAUTH_TOKEN_URL = 'https://auth.example.com/application/o/token/'
OAUTH_USER_INFO_URL = 'https://auth.example.com/application/o/userinfo/'
OAUTH_SCOPE = [ "openid", "profile", "email",]
OAUTH_ATTRIBUTE_MAP = {
"name": (True, "name"),
"email": (True, "contact_email"),
"email": (True, "email"),
"email": (True, "uid"),
}
As you can see, I tried hard to make seafile accept the email sent by authentik.
authentik sends something like this:
{'sub': 'XXXX', 'email': 'foobar@example.com', 'email_verified': True, 'name': 'Foo Bar', 'given_name': 'Foo Bar', 'preferred_username': 'foobar', 'nickname': 'foobar', 'groups': ['foobar foobars']
So the email field is clearly there, but it never shows in any of the database tables
MariaDB [ccnet_db]> select id,email from EmailUser;
+----+---------------------------------------------+
| id | email |
+----+---------------------------------------------+
| 17 | 283b8855f97e42e4afe2a4d9e81a1c24@auth.local |
MariaDB [seahub_db]> select id,username,uid from social_auth_usersocialauth;
+----+---------------------------------------------+------------------+
| id | username | uid |
+----+---------------------------------------------+------------------+
| 7 | 283b8855f97e42e4afe2a4d9e81a1c24@auth.local | foobar@example.com |
So how do I convince seafile to populate email/contact_email with the fitting OAUTH properties?