<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
  <services>
    <service name="oauth2-client" target="risotto" engine="cheetah"/>
  </services>
  <variables>
    <family name="oauth2_client" description="OAuth2 client">
      <variable name="oauth2_client_server_domainname" type="domainname" description="OAuth2 server domain name" mandatory='True' supplier="OAuth2"/>
      <variable name="oauth2_is_client_application" type="boolean" description="OAuth2 client is an application" mandatory='True'>
        <value>False</value>
      </variable>
      <variable name="oauth2_client_name" description="OAuth2 client name" mandatory='True' supplier="OAuth2:name"/>
      <variable name="oauth2_client_description" description="OAuth2 client description" mandatory='True' supplier="OAuth2:description"/>
      <variable name="oauth2_client_login" type="web_address" description="OAuth2 URL to valid login" supplier="OAuth2:login"/>
      <family name="external">
        <variable name="oauth2_client_external" type="web_address" description="OAuth2 client external" mandatory='True' multi="True" supplier="OAuth2:external"/>
        <variable name="oauth2_client_family" description="OAuth2 family" supplier="OAuth2:family">
          <value>users</value>
        </variable>
      </family>
      <variable name="oauth2_client_category" description="OAuth2 category" mandatory='True' supplier="OAuth2:category">
        <value>Défaut</value>
      </variable>
      <variable name="oauth2_client_logo" description="OAuth2 logo" mandatory='True' supplier="OAuth2:logo">
        <value>demo.png</value>
      </variable>
      <variable name="oauth2_client_id" description="OAuth2 ID" mandatory='True' hidden='True'/>
      <variable name="oauth2_client_secret" type="password" description="OAuth2 secret" mandatory='True' hidden='True' supplier="OAuth2:secret"/>
      <variable name="oauth2_client_token_signature_algo" type="choice" description="OAuth2 token signature algorithm" mandatory='True' hidden='True' supplier="OAuth2:token_signature_algo">
        <value>HS512</value>
        <choice>HS512</choice>
        <choice>RS256</choice>
      </variable>
      <variable name="oauth2_clients" description="Remote clients" type="domainname" multi="True" provider="OAuth2Client"/>
      <variable name="oauth2_server_domainname" type="domainname" description="OAuth2 server domain name" mandatory='True' provider="OAuth2Client:external_domain"/>
    </family>
  </variables>
  <constraints>
    <fill name="normalize_family">
      <param type="variable">domain_name_eth0</param>
      <target>oauth2_client_id</target>
    </fill>
    <fill name="get_password">
      <param name="server_name" type="variable">domain_name_eth0</param>
      <param name="username" type="variable">oauth2_client_id</param>
      <param name="description">remote</param>
      <param name="type">cleartext</param>
      <param name="hide" type="variable">hide_secret</param>
      <target>oauth2_client_secret</target>
    </fill>
    <fill name="calc_oauth2_client_external">
      <param type="variable" optional="True">revprox_client_external_domainnames</param>
      <param type="variable" optional="True">revprox_client_location</param>
      <target>oauth2_client_external</target>
    </fill>
    <condition name="disabled_if_in" source="oauth2_is_client_application">
      <param>False</param>
      <target type="variable">oauth2_client_name</target>
      <target type="variable">oauth2_client_description</target>
      <target type="variable">oauth2_client_external</target>
      <target type="variable">oauth2_client_family</target>
    </condition>
  </constraints>
</rougail>
