
    Dsi                     |    d dl Z d dlmZmZ d dlmZmZmZ d dlm	Z	m
Z
 d dlmZ  G d de      Z e       d        Zy)	    N)	AppConfigapps)CriticalWarningregister)OperationalErrorProgrammingError)RequestFactoryc                       e Zd ZdZdZy)MicrosoftAuthConfigmicrosoft_authzMicrosoft AuthN)__name__
__module____qualname__nameverbose_name     _/var/www/python-projects/worksol/worksolenv/lib/python3.12/site-packages/microsoft_auth/apps.pyr   r   	   s    D#Lr   r   c           	         ddl m} ddlm}m} g }t        j                  d      r2t        j                  d      s|j                  t        ddd	
             	 t        |d      s7t               j                  dd      }|j                  j                  |      }n|j                  j                         }|j                  dk(  r|j                  t        ddd
             	 |j&                  rX|j(                  dk(  r|j                  t        ddd
             |j*                  dk(  r|j                  t        ddd
             |D ]  }t-        ||      }	|	dk7  s|	j/                  dd      }
t1        |
      dk7  r/|j                  t        dj3                  |	      d             |c S |
d   |
d   }}	 t5        j6                  |      }	 t-        ||      }t=        |      r|j                  t        d$j3                  |	      d%              |S # |j                   $ r Y Dt"        t$        f$ r  |j                  t        dd             Y qw xY w# t8        $ r2 |j                  t        d j3                  |      d!             |cY c S w xY w# t:        $ r2 |j                  t        d"j3                  |	      d#             |cY c S w xY w)&Nr   )Site   )HOOK_SETTINGSconfigr   zdjango.contrib.sitesz'`django.contrib.sites` is not installedzO`microsoft_auth` requires `django.contrib.sites` to be installed and configuredzmicrosoft_auth.E001)hintidSITE_ID/zexample.com)	HTTP_HOSTzB`example.com` is still a valid site, Microsoft auth might not workzRMicrosoft/Xbox auth uses OAuth, which requires a real redirect URI to come back tozmicrosoft_auth.W002z)`django.contrib.sites` migrations not ranzmicrosoft_auth.W001)r    z,`MICROSOFT_AUTH_CLIENT_ID` is not configuredzr`MICROSOFT_AUTH_LOGIN_ENABLED` is `True`, but `MICROSOFT_AUTH_CLIENT_ID` is empty. Microsoft auth will be disabledzmicrosoft_auth.W003z0`MICROSOFT_AUTH_CLIENT_SECRET` is not configuredzv`MICROSOFT_AUTH_LOGIN_ENABLED` is `True`, but `MICROSOFT_AUTH_CLIENT_SECRET` is empty. Microsoft auth will be disabledzmicrosoft_auth.W004.   z{} is not a valid python pathzmicrosoft_auth.E002z{} is not a valid modulezmicrosoft_auth.E003z{} does not existzmicrosoft_auth.E004z{} is not a callablezmicrosoft_auth.E005)django.contrib.sites.modelsr   confr   r   r   is_installedappendr   hasattrr
   getobjectsget_currentdomainr   DoesNotExistr   r	   MICROSOFT_AUTH_LOGIN_ENABLEDMICROSOFT_AUTH_CLIENT_IDMICROSOFT_AUTH_CLIENT_SECRETgetattrrsplitlenformat	importlibimport_moduleImportErrorAttributeErrorcallable)app_configskwargsr   r   r   errorsrequestcurrent_sitehook_setting_namehook_settingpartsmodule_pathfunction_namemodulefunctions                  r   microsoft_auth_validatorrE      s   0+F)*43D3D4 	95 )		
vy)$&**3-*HG<<33G<L<<335L -/MM.> -
 ****b0MMC0 -
 .."4MMG0 -
 + +v'892 ''Q/E5zQ8??M0 ).q58K	"00=	"6=9 H%/66|D0M+Z MA  ./ 
;(	

D  3::;G0  " ,33LA0 s=   AH 8IJI'*II6JJ6KK)r4   django.appsr   r   django.core.checksr   r   r   django.db.utilsr   r	   django.testr
   r   rE   r   r   r   <module>rJ      s;     ' : : > &$) $
 
| |r   