
    k7i/                     V    S SK Jr  S SKJr  S SKJr  S SKJr  SSKJr   " S S\5      r	g	)
    )is_valid_url)
BaseClaims)
JsonWebKey)InvalidClaimError   )scope_to_listc                       \ rS rSr/ SQrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rSS jr\S 5       rSrg)ClientMetadataClaims	   )redirect_uristoken_endpoint_auth_methodgrant_typesresponse_typesclient_name
client_urilogo_uriscopecontactstos_uri
policy_urijwks_urijwkssoftware_idsoftware_versionc                    U R                  5         U R                  5         U R                  5         U R                  5         U R	                  5         U R                  5         U R                  5         U R                  5         U R                  5         U R                  5         U R                  5         U R                  5         U R                  5         U R                  5         U R                  5         U R                  5         g N)_validate_essential_claimsvalidate_redirect_uris#validate_token_endpoint_auth_methodvalidate_grant_typesvalidate_response_typesvalidate_client_namevalidate_client_urivalidate_logo_urivalidate_scopevalidate_contactsvalidate_tos_urivalidate_policy_urivalidate_jwks_urivalidate_jwksvalidate_software_idvalidate_software_versionselfs    W/home/james-whalen/.local/lib/python3.13/site-packages/authlib/oauth2/rfc7591/claims.pyvalidateClientMetadataClaims.validate   s    '')##%002!!#$$&!!#  "    " !!#&&(    c                 l    U R                  S5      nU(       a  U H  nU R                  SU5        M     gg)ax  Array of redirection URI strings for use in redirect-based flows
such as the authorization code and implicit flows.  As required by
Section 2 of OAuth 2.0 [RFC6749], clients using flows with
redirection MUST register their redirection URI values.
Authorization servers that support dynamic registration for
redirect-based flows MUST implement support for this metadata
value.
r   N)get_validate_uri)r.   urisuris      r/   r   +ClientMetadataClaims.validate_redirect_uris/   s4     xx(""?C8  r2   c                 <    SU ;  a  SU S'   U R                  S5        g)zPString indicator of the requested authentication method for the
token endpoint.
r   client_secret_basicN_validate_claim_valuer-   s    r/   r   8ClientMetadataClaims.validate_token_endpoint_auth_method=   s&    
 (t31FD-.""#?@r2   c                 &    U R                  S5        g)zUArray of OAuth 2.0 grant type strings that the client can use at
the token endpoint.
r   Nr;   r-   s    r/   r    )ClientMetadataClaims.validate_grant_typesF   s     	""=1r2   c                 &    U R                  S5        g)zdArray of the OAuth 2.0 response type strings that the client can
use at the authorization endpoint.
r   Nr;   r-   s    r/   r!   ,ClientMetadataClaims.validate_response_typesL   s     	""#34r2   c                     g)aK  Human-readable string name of the client to be presented to the
end-user during authorization.  If omitted, the authorization
server MAY display the raw "client_id" value to the end-user
instead.  It is RECOMMENDED that clients always send this field.
The value of this field MAY be internationalized, as described in
Section 2.2.
N r-   s    r/   r"   )ClientMetadataClaims.validate_client_nameR       r2   c                 &    U R                  S5        g)aY  URL string of a web page providing information about the client.
If present, the server SHOULD display this URL to the end-user in
a clickable fashion.  It is RECOMMENDED that clients always send
this field.  The value of this field MUST point to a valid web
page.  The value of this field MAY be internationalized, as
described in Section 2.2.
r   Nr5   r-   s    r/   r#   (ClientMetadataClaims.validate_client_uri[        	<(r2   c                 &    U R                  S5        g)a  URL string that references a logo for the client.  If present, the
server SHOULD display this image to the end-user during approval.
The value of this field MUST point to a valid image file.  The
value of this field MAY be internationalized, as described in
Section 2.2.
r   NrG   r-   s    r/   r$   &ClientMetadataClaims.validate_logo_urie   s     	:&r2   c                 &    U R                  S5        g)a:  String containing a space-separated list of scope values (as
described in Section 3.3 of OAuth 2.0 [RFC6749]) that the client
can use when requesting access tokens.  The semantics of values in
this list are service specific.  If omitted, an authorization
server MAY register a client with a default set of scopes.
r   Nr;   r-   s    r/   r%   #ClientMetadataClaims.validate_scopen   s     	""7+r2   c                 X    SU ;   a$  [        U S   [        5      (       d  [        S5      egg)a  Array of strings representing ways to contact people responsible
for this client, typically email addresses.  The authorization
server MAY make these contact addresses available to end-users for
support requests for the client.  See Section 6 for information on
Privacy Considerations.
r   N)
isinstancelistr   r-   s    r/   r&   &ClientMetadataClaims.validate_contactsw   s1     jj1A4&H&H#J// 'Ir2   c                 &    U R                  S5        g)a  URL string that points to a human-readable terms of service
document for the client that describes a contractual relationship
between the end-user and the client that the end-user accepts when
authorizing the client.  The authorization server SHOULD display
this URL to the end-user if it is provided.  The value of this
field MUST point to a valid web page.  The value of this field MAY
be internationalized, as described in Section 2.2.
r   NrG   r-   s    r/   r'   %ClientMetadataClaims.validate_tos_uri   s     	9%r2   c                 &    U R                  S5        g)a  URL string that points to a human-readable privacy policy document
that describes how the deployment organization collects, uses,
retains, and discloses personal data.  The authorization server
SHOULD display this URL to the end-user if it is provided.  The
value of this field MUST point to a valid web page.  The value of
this field MAY be internationalized, as described in Section 2.2.
r   NrG   r-   s    r/   r(   (ClientMetadataClaims.validate_policy_uri   rI   r2   c                 &    U R                  S5        g)a|  URL string referencing the client's JSON Web Key (JWK) Set
[RFC7517] document, which contains the client's public keys.  The
value of this field MUST point to a valid JWK Set document.  These
keys can be used by higher-level protocols that use signing or
encryption.  For instance, these keys might be used by some
applications for validating signed requests made to the token
endpoint when using JWTs for client authentication [RFC7523].  Use
of this parameter is preferred over the "jwks" parameter, as it
allows for easier key rotation.  The "jwks_uri" and "jwks"
parameters MUST NOT both be present in the same request or
response.
r   NrG   r-   s    r/   r)   &ClientMetadataClaims.validate_jwks_uri   s     	:&r2   c                     SU ;   a@  SU ;   a  [        S5      eU S   n [        R                  " U5      nU(       d  [        S5      egg! [         a  n[        S5      UeSnAff = f)a  Client's JSON Web Key Set [RFC7517] document value, which contains
the client's public keys.  The value of this field MUST be a JSON
object containing a valid JWK Set.  These keys can be used by
higher-level protocols that use signing or encryption.  This
parameter is intended to be used by clients that cannot use the
"jwks_uri" parameter, such as native clients that cannot host
public URLs.  The "jwks_uri" and "jwks" parameters MUST NOT both
be present in the same request or response.
r   r   N)r   r   import_key_set
ValueError)r.   r   key_setexcs       r/   r*   "ClientMetadataClaims.validate_jwks   ss     T>T!'//<D9$33D9+F33    9'/S89s   (A 
A#AA#c                     g)a~  A unique identifier string (e.g., a Universally Unique Identifier
(UUID)) assigned by the client developer or software publisher
used by registration endpoints to identify the client software to
be dynamically registered.  Unlike "client_id", which is issued by
the authorization server and SHOULD vary between instances, the
"software_id" SHOULD remain the same for all instances of the
client software.  The "software_id" SHOULD remain the same across
multiple updates or versions of the same piece of software.  The
value of this field is not intended to be human readable and is
usually opaque to the client and authorization server.
NrC   r-   s    r/   r+   )ClientMetadataClaims.validate_software_id   rE   r2   c                     g)a  A version identifier string for the client software identified by
"software_id".  The value of the "software_version" SHOULD change
on any update to the client software identified by the same
"software_id".  The value of this field is intended to be compared
using string equality matching and no other comparison semantics
are defined by this specification.  The value of this field is
outside the scope of this specification, but it is not intended to
be human readable and is usually opaque to the client and
authorization server.  The definition of what constitutes an
update to client software that would trigger a change to this
value is specific to the software itself and is outside the scope
of this specification.
NrC   r-   s    r/   r,   .ClientMetadataClaims.validate_software_version   rE   r2   Nc                 p    Uc  U R                  U5      nU(       a  [        USS9(       d  [        U5      eg g )NF)fragments_allowed)r4   r   r   )r.   keyr7   s      r/   r5   "ClientMetadataClaims._validate_uri   s3    ;((3-C|C5A#C(( B3r2   c                   ^^	^
 UR                  S5      m
UR                  S5      m	UR                  S5      mUR                  S5      n0 nT
b  [        T
5      m
U
4S jnSU0US'   T	b7  T	 Vs/ s H  n[        UR                  5       5      PM     snm	U	4S jnSU0US	'   Tb  [        T5      mU4S
 jnSU0US'   Ub  SU0US'   U$ s  snf )zFGenerate claims options validation from Authorization Server metadata.scopes_supportedresponse_types_supportedgrant_types_supported%token_endpoint_auth_methods_supportedc                 ^   > U(       d  g[        [        U5      5      nTR                  U5      $ )NT)setr   
issuperset)claimsvaluescopesrg   s      r/   _validate_scope@ClientMetadataClaims.get_claims_options.<locals>._validate_scope   s)    ]512'226::r2   r0   r   c                    > U(       a*  U Vs/ s H  n[        UR                  5       5      PM     snOS1/n[        U4S jU 5       5      $ s  snf )Ncodec              3   .   >#    U  H
  nUT;   v   M     g 7fr   rC   ).0response_typerh   s     r/   	<genexpr>\ClientMetadataClaims.get_claims_options.<locals>._validate_response_types.<locals>.<genexpr>   s      )7 "%==)7s   )rl   splitall)rn   ro   itemsr   rh   s       r/   _validate_response_typesIClientMetadataClaims.get_claims_options.<locals>._validate_response_types   sR     @EU;UES'U;F8*   )7   <s   #Ar   c                 P   > U(       a  [        U5      OS1nTR                  U5      $ )Nauthorization_code)rl   rm   )rn   ro   r   ri   s      r/   _validate_grant_typesFClientMetadataClaims.get_claims_options.<locals>._validate_grant_types  s'     -2c%j8L7M,77DDr2   r   valuesr   )r4   rl   rz   )clsmetadataauth_methods_supportedoptionsrq   r|   r}   r   ri   rh   rg   s           @@@r/   get_claims_options'ClientMetadataClaims.get_claims_options   s    $<<(:;#+<<0J#K  (-D E!).U!V'"#34; !+O<GG#/0H(0HuEKKM"0H($	 *45M(NG$% ,$'(=$>!E '12G%HGM"!-5=?U4VG01?(s   ,#CrC   r   )__name__
__module____qualname____firstlineno__REGISTERED_CLAIMSr0   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r5   classmethodr   __static_attributes__rC   r2   r/   r
   r
   	   st    $)$9A25)',0	&)' 9.) 2 2r2   r
   N)
authlib.common.urlsr   authlib.joser   r   authlib.jose.errorsr   rfc6749r   r
   rC   r2   r/   <module>r      s"    , # # 1 #I: Ir2   