
    f
                         d dl mZ d dlmZ d dlmZmZmZ  G d de      Z ej                  e      Z
 ej                  e      Zy)    )get_adapter)ProviderException)OAuth2AdapterOAuth2CallbackViewOAuth2LoginViewc                   &    e Zd ZdZdZdZdZdZd Zy)DataportenOAuth2Adapter
dataportenz&https://auth.dataporten.no/oauth/tokenz.https://auth.dataporten.no/oauth/authorizationz#https://auth.dataporten.no/userinfoz(https://groups-api.dataporten.no/groups/c                 f   dd|j                   z   i}t               j                         j                  | j                  |      }|j                          |j                         d   }|j                         d   |j                  k7  rt        d      | j                         j                  ||      S )a  
        Arguments:
            request - The get request to the callback URL
                        /accounts/dataporten/login/callback.
            app - The corresponding SocialApp model instance
            token - A token object with access token given in token.token
        Returns:
            Should return a dict with user information intended for parsing
            by the methods of the DataportenProvider view, i.e.
            extract_uid(), extract_extra_data(), and extract_common_fields()
        AuthorizationzBearer )headersuseraudiencezDataporten returned a user with an audience field                  which does not correspond to the client id of the                  application.)tokenr   get_requests_sessiongetprofile_urlraise_for_statusjson	client_idr   get_providersociallogin_from_response)selfrequestappr   kwargsr   userinfo_response
extra_datas           k/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/allauth/socialaccount/providers/dataporten/views.pycomplete_loginz&DataportenOAuth2Adapter.complete_login   s     #I$;<
 M!!#S     	 	**, '++-f5

 !!#J/3==@#    "<<
 	
    N)	__name__
__module____qualname__provider_idaccess_token_urlauthorize_urlr   
groups_urlr     r!   r   r	   r	   
   s!    K?DM7K;J,
r!   r	   N)allauth.socialaccount.adapterr   $allauth.socialaccount.providers.baser   ,allauth.socialaccount.providers.oauth2.viewsr   r   r   r	   adapter_viewoauth2_loginoauth2_callbackr)   r!   r   <module>r0      sK    5 B 3
m 3
l ,++,CD1$112IJr!   