From 20c28b34e7406ce0e6516f51986b53606e9821ec Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Tue, 20 Jun 2017 17:14:00 +0200 Subject: [PATCH] implement authentic provider --- authomatic/providers/oauth2.py | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/authomatic/providers/oauth2.py b/authomatic/providers/oauth2.py index 16de03b..ed8b8dd 100644 --- a/authomatic/providers/oauth2.py +++ b/authomatic/providers/oauth2.py @@ -583,6 +583,74 @@ class Amazon(OAuth2): return credentials +class Authentic(OAuth2): + """ + GitHub |oauth2| provider. + + * Dashboard: https://github.com/settings/developers + * Docs: http://developer.github.com/v3/#authentication + * API reference: http://developer.github.com/v3/ + + .. note:: + + + .. code-block:: python + :emphasize-lines: 6 + + CONFIG = { + 'authentic': { + 'class_': oauth2.Authentic, + 'consumer_key': '#####', + 'consumer_secret': '#####', + } + } + + Supported :class:`.User` properties: + + * email + * id + + Unsupported :class:`.User` properties: + + * link + * location + * name + * picture + * username + * birth_date + * city + * country + * gender + * locale + * nickname + * phone + * postal_code + * timezone + + """ + + user_authorization_url = 'https://authentic.com/idp/oidc/authorize/' + access_token_url = 'https://authentic.com/idp/oidc/token/' + user_info_url = 'https://authentic.com/idp/oidc/user_info/' + + same_origin = False + + supported_user_attributes = core.SupportedUserAttributes( + email=True, + id=True, + first_name=True, + last_name=True, + ) + + @staticmethod + def _x_user_parser(user, data): + user.id = data.get('sub') + user.email = data.get('email') + user.first_name = data.get('given_name') + user.last_name = data.get('family_name') + return user + + class Behance(OAuth2): """ Behance |oauth2| provider. -- 2.1.4