Projet

Général

Profil

0001-implement-authentic-provider.patch

Benjamin Dauvergne, 20 juin 2017 17:14

Télécharger (2,16 ko)

Voir les différences:

Subject: [PATCH] implement authentic provider

 authomatic/providers/oauth2.py | 68 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
authomatic/providers/oauth2.py
583 583
        return credentials
584 584

  
585 585

  
586
class Authentic(OAuth2):
587
    """
588
    GitHub |oauth2| provider.
589

  
590
    * Dashboard: https://github.com/settings/developers
591
    * Docs: http://developer.github.com/v3/#authentication
592
    * API reference: http://developer.github.com/v3/
593

  
594
    .. note::
595

  
596

  
597
        .. code-block:: python
598
            :emphasize-lines: 6
599

  
600
            CONFIG = {
601
                'authentic': {
602
                    'class_': oauth2.Authentic,
603
                    'consumer_key': '#####',
604
                    'consumer_secret': '#####',
605
                }
606
            }
607

  
608
    Supported :class:`.User` properties:
609

  
610
    * email
611
    * id
612

  
613
    Unsupported :class:`.User` properties:
614

  
615
    * link
616
    * location
617
    * name
618
    * picture
619
    * username
620
    * birth_date
621
    * city
622
    * country
623
    * gender
624
    * locale
625
    * nickname
626
    * phone
627
    * postal_code
628
    * timezone
629

  
630
    """
631

  
632
    user_authorization_url = 'https://authentic.com/idp/oidc/authorize/'
633
    access_token_url = 'https://authentic.com/idp/oidc/token/'
634
    user_info_url = 'https://authentic.com/idp/oidc/user_info/'
635

  
636
    same_origin = False
637

  
638
    supported_user_attributes = core.SupportedUserAttributes(
639
        email=True,
640
        id=True,
641
        first_name=True,
642
        last_name=True,
643
    )
644

  
645
    @staticmethod
646
    def _x_user_parser(user, data):
647
        user.id = data.get('sub')
648
        user.email = data.get('email')
649
        user.first_name = data.get('given_name')
650
        user.last_name = data.get('family_name')
651
        return user
652

  
653

  
586 654
class Behance(OAuth2):
587 655
    """
588 656
    Behance |oauth2| provider.
589
-