
    qhX                        S r / SQrSSKrSSKrSSKrSSKrSSKJr  SSKJ	r	   \R                  " 5       rSrSrSrS	r\\4rS
r\R&                  " S5      r\R&                  " S5      r\R&                  " S5      rSr/ SQr " S S\5      r " S S\5      r\" 5       r0 q " S S\5      r S r! " S S\5      r" " S S\5      r#g! \ a    Sr Nf = f)z#Extension argument processing code
)
MessageNamespaceMap
no_defaultregisterNamespaceAlias	OPENID_NSBARE_NS
OPENID1_NS
OPENID2_NSSREG_URIIDENTIFIER_SELECT    N)oidutil)kvformz2http://specs.openid.net/auth/2.0/identifier_selectzhttp://openid.net/sreg/1.0zhttp://openid.net/signon/1.0zhttp://openid.net/signon/1.1z http://specs.openid.net/auth/2.0zNull namespacezOpenID namespacezBare namespacei  )nsmodeerror	return_tocontact	referencesigned
assoc_typesession_type
dh_modulusdh_gendh_consumer_public
claimed_ididentityrealminvalidate_handleop_endpointresponse_noncesigassoc_handle
trust_rootopenidc                       \ rS rSrSrSrg)UndefinedOpenIDNamespaceQ   zjRaised if the generic OpenID namespace is accessed when there
is no OpenID namespace set for this message. N__name__
__module____qualname____firstlineno____doc____static_attributes__r(       @/var/www/html/env/lib/python3.13/site-packages/openid/message.pyr&   r&   Q   s    4r0   r&   c                       \ rS rSrSrS rSrg)InvalidOpenIDNamespaceV   zpRaised if openid.ns is not a recognized value.

For recognized values, see L{Message.allowed_openid_namespaces}
c                 X    SnU R                   (       a  USU R                   S   < 3-  nU$ )NzInvalid OpenID Namespace r   args)selfss     r1   __str__InvalidOpenIDNamespace.__str__\   s(    &99$))A,))Ar0   r(   N)r*   r+   r,   r-   r.   r;   r/   r(   r0   r1   r3   r3   V   s    
r0   r3   c                       \ rS rSrSrSrg)NamespaceAliasRegistrationErrorl   zD
Raised when an alias or namespace URI has already been registered.
r(   Nr)   r(   r0   r1   r>   r>   l   s     	r0   r>   c                     [         R                  U5      U :X  a  gU [        [         R                  5       5      ;   a  [	        SU < S35      eU[         ;   a  [	        SU< S35      eU [         U'   g)a"  
Registers a (namespace URI, alias) mapping in a global namespace
alias map.  Raises NamespaceAliasRegistrationError if either the
namespace URI or alias has already been registered with a
different value.  This function is required if you want to use a
namespace with an OpenID 1 message.
NzNamespace uri z already registeredzAlias )registered_aliasesgetlistvaluesr>   )namespace_urialiass     r1   r   r   s   ss     e$5/66899-5BEG 	G ""-/4/8 9 	9 !.ur0   c                      \ rS rSrSr\\\/rS"S jr	\
S 5       r\
S 5       rS rS rS	 rS
 rS rS rS r\
" \5      rS rS rS r  S#S jrS rS rS rS rS rS rS"S jrS rS r S r!S r"S r#S r$S r%S"S  jr&S!r'g)$r      a  
In the implementation of this object, None represents the global
namespace as well as a namespace with no key.

@cvar namespaces: A dictionary specifying specific
    namespace-URI to alias mappings that should be used when
    generating namespace aliases.

@ivar ns_args: two-level dictionary of the values in this message,
    grouped by namespace URI. The first level is the namespace
    URI.
Nc                 z    0 U l         [        5       U l        Uc  SU l        gU[        ;   nU R                  X5        g)zCreate an empty Message.

@raises InvalidOpenIDNamespace: if openid_namespace is not in
    L{Message.allowed_openid_namespaces}
N)r8   r   
namespaces_openid_ns_uriOPENID1_NAMESPACESsetOpenIDNamespace)r9   openid_namespaceimplicits      r1   __init__Message.__init__   s<     	&.#"&D'+==H##$4?r0   c                 B   U " 5       n0 nUR                  5        H^  u  pE[        U[        5      (       a  [        SU< 35      e UR	                  SS5      u  pgUS:w  a  XRR                  [        U4'   MZ  XSW'   M`     UR                  U5        U$ ! [
         a    Sn NEf = f)zAConstruct a Message containing a set of POST arguments.

        zLquery dict must have one value for each key, not lists of values.  Query is .   Nr$   )	items
isinstancerC   	TypeErrorsplit
ValueErrorr8   r   _fromOpenIDArgs)clsr8   r9   openid_argskeyvalueprefixrests           r1   fromPostArgsMessage.fromPostArgs   s    
 u **,JC%&&GK!O P P"yya0 !,1		7C.)$)D! ' 	[)  s   BBBc                 6    U " 5       nUR                  U5        U$ )zConstruct a Message from a parsed KVForm message.

@raises InvalidOpenIDNamespace: if openid.ns is not in
    L{Message.allowed_openid_namespaces}
)rZ   )r[   r\   r9   s      r1   fromOpenIDArgsMessage.fromOpenIDArgs   s     u[)r0   c                    / nUR                  5        Ht  u  p4 UR                  SS5      u  pVUS:X  a  U R                  R                  XF5        M=  U[        :X  a  US:X  a  U R                  US5        Ma  UR                  XVU45        Mv     U R                  5       (       d  U R                  [        S5        U H~  u  pVnU R                  R                  U5      nUcH  U R                  U5      nUc  U R                  5       nU< SU< 3nOU R                  R                  XuSS9  U R                  XvU5        M     g ! [         a    [        nUn GN#f = f)NrS   rT   r   FT)rO   )rU   rX   rY   NULL_NAMESPACErJ   addAliasrM   appendgetOpenIDNamespacer   getNamespaceURI_getDefaultNamespacesetArg)r9   r\   ns_argsr`   r^   ns_aliasns_keyns_uris           r1   rZ   Message._fromOpenIDArgs   s9    ',,.KD#'::c1#5 
 4((7^+$''u5%89 /  &&((##J5 *1%Xu__44X>F~228<>!446F(0&9FOO,,V,MKK. *1#  )s   D;;EEc                 X    U R                  5       (       a  [        R                  U5      $ g)zOOpenID 1 compatibility: look for a default namespace URI to
use for this alias.N)	isOpenID1rA   rB   )r9   mystery_aliass     r1   rl   Message._getDefaultNamespace   s%     >>%))-88r0   c                     [        U[        5      (       a
  [        USS9nXR                  ;  a  [	        U5      eU R
                  R                  U[        U5        Xl        g)zSet the OpenID namespace URI used in this message.

@raises InvalidOpenIDNamespace: if the namespace is not in
    L{Message.allowed_openid_namespaces}
utf-8encodingN)	rV   bytesstrallowed_openid_namespacesr3   rJ   rh   rg   rK   )r9   openid_ns_urirO   s      r1   rM   Message.setOpenIDNamespace   sP     mU++@M > >>(77  I+r0   c                     U R                   $ N)rK   r9   s    r1   rj   Message.getOpenIDNamespace  s    """r0   c                 0    U R                  5       [        ;   $ r   )rj   rL   r   s    r1   rt   Message.isOpenID1  s    &&(,>>>r0   c                 0    U R                  5       [        :H  $ r   )rj   r	   r   s    r1   	isOpenID2Message.isOpenID2  s    &&(J66r0   c                 L    U R                  [        R                  " U5      5      $ )z%Create a Message from a KVForm string)rd   r   kvToDict)r[   kvform_strings     r1   
fromKVFormMessage.fromKVForm  s    !!&//-"@AAr0   c                 .    [         R                  " U 5      $ r   )copydeepcopyr   s    r1   r   Message.copy  s    }}T""r0   c                    0 nU R                   R                  5        HQ  u  p#U R                   R                  U5      (       a  M'  U[        :X  a  SnOSU-   n[        R
                  " U5      X'   MS     U R                  R                  5        H1  u  u  p$nU R                  X$5      n[        R
                  " U5      X'   M3     U$ )zS
Return all arguments with openid. in front of namespaced arguments.
@return bytes
z	openid.nsz
openid.ns.)rJ   rU   
isImplicitrg   r   	toUnicoder8   getKey)r9   r8   rq   rF   rp   r^   r]   s          r1   
toPostArgsMessage.toPostArgs   s    
  "__224MF))&11&$%-",,V4DL 5 (,yy'8#Ve++f-C))%0DI (9
 r0   c                     U R                  5       n0 nUR                  5        H-  u  p4UR                  S5      (       d  [        S5      eXBUSS '   M/     U$ )zOReturn all namespaced arguments, failing if any
non-namespaced arguments exist.openid.znThis message can only be encoded as a POST, because it contains arguments that are not prefixed with "openid."   N)r   rU   
startswithrY   )r9   	post_argskvargskvs        r1   toArgsMessage.toArgs8  sb     OO%	OO%DA<<	** NO O !"qu & r0   c                    [         c  [        S5      eUc   e[         R                  S5      nU(       a'  UR                  5        H  u  pVXdR                  U'   M     [
        R                  " U5      UR                  S'   SUR                  S'   SUR                  S'   SUR                  S	'   U R                  5       R                  5        HX  u  pWS
[
        R                  " U5      [
        R                  " U5      S.nUR                  [         R                  SU5      5        MZ     [         R                  SS[
        R                  " U5      S.5      n	UR                  U	5        [        [         R                  USS9SS9$ )a  Generate HTML form markup that contains the values in this
message, to be HTTP POSTed as x-www-form-urlencoded UTF-8.

@param action_url: The URL to which the form will be POSTed
@type action_url: str

@param form_tag_attrs: Dictionary of attributes to be added to
    the form tag. 'accept-charset' and 'enctype' have defaults
    that can be overridden. If a value is supplied for
    'action' or 'method', it will be replaced.
@type form_tag_attrs: {unicode: unicode}

@param submit_text: The text that will appear on the submit
    button for this form.
@type submit_text: unicode

@returns: A string containing (X)HTML markup for a form that
    encodes the values in this Message object.
@rtype: str
z#This function requires ElementTree.formactionpostmethodzUTF-8zaccept-charsetz!application/x-www-form-urlencodedenctypehidden)typenamer^   inputsubmit)r   r^   rx   ry   )ElementTreeRuntimeErrorElementrU   attribr   r   r   ri   r|   tostring)
r9   
action_urlform_tag_attrssubmit_textr   r   attrr^   attrsr   s
             r1   toFormMarkupMessage.toFormMarkupH  sT   0 DEE%%%""6*,224
$(D! 5 !( 1 1* =H &H(/$%!DI??,224KD ))$/ **51E
 KK++GU;< 5 $$''467 	F;''w'?#% 	%r0   c                 J    [         R                  " XR                  5       5      $ )zTGenerate a GET URL with the parameters in this message
attached as query parameters.)r   
appendArgsr   )r9   base_urls     r1   toURLMessage.toURL  s     !!(OO,=>>r0   c                 J    [         R                  " U R                  5       5      $ )zGenerate a KVForm string that contains the parameters in
this message. This will fail if the message contains arguments
outside of the 'openid.' prefix.
)r   dictToKVr   r   s    r1   toKVFormMessage.toKVForm  s    
 t{{}--r0   c                     [        U R                  5       R                  5       5      n[        R                  R                  U5      $ )z#Generate an x-www-urlencoded string)sortedr   rU   urllibparse	urlencode)r9   r8   s     r1   toURLEncodedMessage.toURLEncoded  s1    doo'--/0||%%d++r0   c                    [        U[        5      (       a
  [        USS9nU[        :X  a$  U R                  c  [        S5      eU R                  nU[        :w  a$  [        U[        5      (       d  [        SU< 35      eU[        :w  aW  SU;  aQ  Sn[        R                  " X!4-  [        5        US:X  a+  Sn[        R                  " U[        4-  [        5        [        $ U$ )	zConvert an input value into the internally used values of
this object

@param namespace: The string or constant to convert
@type namespace: str or unicode or BARE_NS or OPENID_NS
rx   ry   zOpenID namespace not setz6Namespace must be BARE_NS, OPENID_NS or a string. got :z7OpenID 2.0 namespace identifiers SHOULD be URIs. Got %rsregz'Using %r instead of "sreg" as namespace)rV   r{   r|   r   rK   r&   r   rW   warningswarnDeprecationWarningr
   )r9   	namespacefmts      r1   _fixNSMessage._fixNS  s     i''I8I	!""*./IJJ //	
9c(B(B  Cy$8KCMM#-/ABF"?8,&&*  r0   c                 D    U R                  U5      nX4U R                  ;   $ r   r   r8   )r9   r   rp   s      r1   hasKeyMessage.hasKey  s"    KK	*	"dii//r0   c                     U R                  U5      nU[        :X  a  U$ U R                  R                  U5      nUc  gU[        :X  a  UnSU-   $ U< SU< 3nSU-   $ )z0Get the key for a particular namespaced argumentNrS   r   )r   r   rJ   getAliasrg   )r9   r   rp   ro   tails        r1   r   Message.getKey  sm    KK	*	M??++I6 ~%D 4 '/D4r0   c                     U R                  U5      nX4n U R                  U   $ ! [         a    U[        L a  [        X45      eUs $ f = f)a:  Get a value for a namespaced key.

@param namespace: The namespace in the message for this key
@type namespace: str

@param key: The key to get within this namespace
@type key: str

@param default: The value to use if this key is absent from
    this message. Using the special value
    openid.message.no_default will result in this method
    raising a KeyError instead of returning the default.

@rtype: str or the type of default
@raises KeyError: if default is no_default
@raises UndefinedOpenIDNamespace: if the message has not yet
    had an OpenID namespace set
)r   r8   KeyErrorr   )r9   r   r]   defaultargs_keys        r1   getArgMessage.getArg  sX    & KK	*	#	99X&& 	*$	/00		s   % !A	A	c                 D   U R                  U5      n/ nU R                  R                  5        He  u  u  p4nX1:X  d  M  [        U[        5      (       a  [        USS9nOUn[        U[        5      (       a  [        USS9nOUnUR                  Xg45        Mg     [        U5      $ )zGet the arguments that are defined for this namespace URI

@returns: mapping from namespaced keys to values
@returntype: dict of {str:bytes}
rx   ry   )r   r8   rU   rV   r{   r|   ri   dict)r9   r   r8   pair_nsrp   r^   r   r   s           r1   getArgsMessage.getArgs  s     KK	*	*.))//*;&g#fe,,FW5AAeU++EG4AAQF# +< Dzr0   c                 |    U R                  U5      nUR                  5        H  u  p4U R                  XU5        M     g)zmSet multiple key/value pairs in one call

@param updates: The values to set
@type updates: {unicode:unicode}
N)r   rU   rm   )r9   r   updatesr   r   s        r1   
updateArgsMessage.updateArgs  s2     KK	*	MMODAKK	a( $r0   c                     Uc   eUc   eU R                  U5      n[        U[        5      (       a
  [        USS9nX0R                  X4'   U[
        La  U R                  R                  U5        gg)z'Set a single argument in this namespaceNrx   ry   )r   rV   r{   r|   r8   r   rJ   add)r9   r   r]   r^   s       r1   rm   Message.setArg  sm       KK	*	eU##0E&+		9"#W$OO	* %r0   c                 B    U R                  U5      nU R                  X4	 g r   r   )r9   r   r]   s      r1   delArgMessage.delArg  s    KK	*	IIy&'r0   c                     SU R                   R                  < SU R                   R                  < SU R                  < S3$ )N<rS   r6   >)	__class__r+   r*   r8   r   s    r1   __repr__Message.__repr__  s.    #~~88#~~66		C 	Cr0   c                 4    U R                   UR                   :H  $ r   r7   r9   others     r1   __eq__Message.__eq__  s    yyEJJ&&r0   c                     X:X  + $ r   r(   r   s     r1   __ne__Message.__ne__  s    ""r0   c                    US:X  a  U R                  5       $ UR                  S5      (       a5  U R                  R                  USS  5      nUc  U[        :X  a  [
        eU$ U$  UR                  SS5      u  pEU R                  R                  U5      nUc  UnU R                  5       nU R                  UWU5      $ ! [         a    S n N6f = f)Nr   zns.   rS   rT   )	rj   r   rJ   rk   r   r   rX   rY   r   )r9   aliased_keyr   urirF   r]   r   s          r1   getAliasedArgMessage.getAliasedArg!  s    $**,,!!%((//11+ab/BC{j("N"N
	8$**32JE
 007B:C((*B{{2sG,,  	B	s   #B: :C	C	)rK   r8   rJ   r   )NContinue)(r*   r+   r,   r-   r.   r   THE_OTHER_OPENID1_NSr	   r}   rP   classmethodra   rd   rZ   rl   rM   rj   rt   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rm   r   r   r   r   r  r/   r(   r0   r1   r   r      s     ",-A: N@  6  #/J	,#?7B Z(J#0$ %)!+7%r?
.,
 D0 &:*)
+(C'#-r0   r   c                   ^    \ rS rSrSrS rS rS rS rS r	S r
SS	 jrS
 rS rS rS rSrg)r   i>  zBMaintains a bijective map between namespace uris and aliases.
    c                 .    0 U l         0 U l        / U l        g r   )alias_to_namespacenamespace_to_aliasimplicit_namespacesr   s    r1   rP   NamespaceMap.__init__B  s    "$"$#% r0   c                 8    U R                   R                  U5      $ r   )r
  rB   r9   rE   s     r1   r   NamespaceMap.getAliasG  s    &&**=99r0   c                 8    U R                   R                  U5      $ r   )r	  rB   )r9   rF   s     r1   rk   NamespaceMap.getNamespaceURIJ  s    &&**511r0   c                 ,    [        U R                  5      $ )z*Return an iterator over the namespace URIs)iterr
  r   s    r1   iterNamespaceURIsNamespaceMap.iterNamespaceURIsM      D++,,r0   c                 ,    [        U R                  5      $ )z#Return an iterator over the aliases)r  r	  r   s    r1   iterAliasesNamespaceMap.iterAliasesQ  r  r0   c                 6    U R                   R                  5       $ )zGIterate over the mapping

@returns: iterator of (namespace_uri, alias)
)r
  rU   r   s    r1   rU   NamespaceMap.itemsU  s    
 &&,,..r0   c                    [        U[        5      (       a
  [        USS9nU[        ;  d   U< S35       e[        U[        5      (       a  SU;  d   U< S35       eU R                  R                  U5      nUb  XA:w  a  SnXQX$U4-  n[        U5      eU R                  R                  U5      nUb  Xr:w  a  Sn[        XQX'4-  5      eU[        :X  d)  [        U5      [        [        4;   d   [        U5      5       eXR                  ;  d   eXR                  U'   X R                  U'   U(       a  U R                  R                  U5        U$ )zBAdd an alias from this namespace URI to the desired alias
        rx   ry   z" is not an allowed namespace aliasrS   z must not contain a dotz;Cannot map %r to alias %r. %r is already mapped to alias %rz;Cannot map %r to alias %r. It is already mapped to alias %r)rV   r{   r|   OPENID_PROTOCOL_FIELDSr	  rB   r   r
  rg   r   reprr  ri   )r9   rE   desired_aliasrO   current_namespace_urir   msgrF   s           r1   rh   NamespaceMap.addAlias\  so    mU++@M $:: 	I9FH	I:
 mS))m+ B2?AB+
 !% 7 7 ; ;M J!-%66C &( (C3- ''++M:!76C3!FFGG/]#Sz1	H484G	H 2$<$<<<<1>.1>.$$++M:r0   c                     U R                   R                  U5      nUb  U$ Sn S[        U5      -   n U R                  X5        U$ ! [         a    US-  n Of = fM9  )zPAdd this namespace URI to the mapping, without caring what
alias it ends up withr   extrT   )r
  rB   r|   rh   r   )r9   rE   rF   is       r1   r   NamespaceMap.add  ss     ''++M:L CFNEm3   Q	 s   A AAc                     XR                   ;   $ r   )r
  r  s     r1   	isDefinedNamespaceMap.isDefined  s     7 777r0   c                 $    U R                  U5      $ r   )r(  r  s     r1   __contains__NamespaceMap.__contains__  s    ~~m,,r0   c                     XR                   ;   $ r   )r  r  s     r1   r   NamespaceMap.isImplicit  s     8 888r0   )r	  r  r
  N)F)r*   r+   r,   r-   r.   rP   r   rk   r  r  rU   rh   r   r(  r+  r   r/   r(   r0   r1   r   r   >  s?    &
:2--/,\$*8-9r0   r   )$r.   __all__r   r   urllib.requestr   urllib.errorr$   r   r   importElementTreer   ImportErrorr   r
   r   r  rL   r	   Symbolrg   r   r   OPENID1_URL_LIMITr  rY   r&   r3   objectr   rA   	Exceptionr>   r   r   r   r(   r0   r1   <module>r8     s        ++-K I  ( ,
5 !55  0
  01 NN-.	 ..)
*   44z 4

Z 
 X
  	i 	.0p-f p-fh96 h9Y   Ks   C CC