Configuring the clientConfig.xml file


File wih the Client Application configuration. This configuration loads when the OAuth class is initialized. This parameters can be changed with the setters defined in the OAuth class.

The format of this file is the following:

<?xml version="1.0" encoding="UTF-8"?>
<OAuthClient>    

    <!--Authorization Server Configuration-->
    <AuthServerConfig>
        <!-- Type of the assertion
          SAML2 = "urn:oasis:names:tc:SAML:2.0:assertion";
          PAPI = "urn:mace:rediris.es:papi";
        -->
        <AssertionType>urn:mace:rediris.es:papi</AssertionType>
        <!--  The access grant type included in the request. 
        In this library the type is "assertion". -->
        <GrantType>assertion</GrantType>
        <!-- Authorization Server URL.-->
        <AuthServerURL>
        	url_of_the_auth_server/oauth_as/tokenEndpoint.php
       	</AuthServerURL>
    </AuthServerConfig>
    
 <!--Resource Server Configuration*-->
    <ResServerConfig>
        <!--Format of the resource request:
            HEADER = "HTTP_Authorization_Header";
            GET = "URI_Query_Parameter";
            BODY = "Form-Encoded_Body_Parameter";
        -->
        <RequestType>
        	HTTP_Authorization_Header
        </RequestType>
        <!--Resource Server URL.-->
        <ResServerURL>
        	url_of_the_resource_server/oauth_server/serverEndpoint.php
        </ResServerURL>
        <ResponseFormats>
            <Scope id="http://www.rediris.es/sir/api/sps_available.php">
                <FormatClass>
                	DefaultFormattingResource
                </FormatClass>
                <FormatFile>
                	/url/DefaultFormattingResource.class.php
                </FormatFile>
            </Scope>
        </ResponseFormats>
    </ResServerConfig>    
    
 <!--Client App Configuration-->
    <ClientConfig>
        <ClientID>
        	app_client_1
        </ClientID>
        <ClientSecret>
  	      example_key
        </ClientSecret>
        <!-- Error Response type. 
        HTML or JSON.. -->
        <ErrorResponseType>
        	HTML
        </ErrorResponseType>
        <DefaultScope>
        	http://www.rediris.es/sir/api/sps_available.php
        </DefaultScope>
        <DebugActive>
        	TRUE
        </DebugActive>
    </ClientConfig>
</OAuthClient>

Response Formats

We must give format to the different resources obtained. Each scope have one IFormattingResource Class defined.

<?xml version="1.0" encoding="UTF-8"?>
<ResponseFormats>
    <Scope id="http://www.rediris.es/sir/api/sps_available.php">
        <FormatClass>DefaultFormattingResource</FormatClass>
        <FormatFile>/url/DefaultFormattingResource.class.php</FormatFile>
    </Scope>
</ResponseFormats>

Where:

  • Scope 'id' will be the URI of the scope
  • FormatClass will be the name of the class that implements IFormattingResource.
  • FormatFile will be the path to the file where it's defined the class that implements IFormattingResource.