Integrating C applications with the Authentication Service

You can use a C application to invoke the Authentication Service for basic authentication or token assertion.

Procedure

  1. To use the Authentication Service to perform basic authentication, perform the following steps:
    1. Read the configuration information.
    2. Create the WS-Trust request (RST) that has the username token.
    3. Send the WS-Trust request (RST) using a HTTP client package.
    4. Process the response (RSTR) from the Authentication Service as follows:
      • Retrieve the token and token related information, for example, the expiration time.
      • Verify the signature of the response that the Authentication Service returns.
      • Retrieve the user and group information from the response that the Authentication Service returns.
  2. To use the Authentication Service to perform validation of a token that is passed from the application invoking the Authentication Service, perform the following steps:
    1. Read the configuration information.
    2. Check whether the token is in the cache.
      • If it is and is still valid, retrieve the token and user and group information from the cache. Complete processing.
      • If it is not, create the WS-Trust request (RST) that has the token.
    3. Send the WS-Trust request (RST) using a HTTP client, such as libCurl.
    4. Process the response (RSTR) from the Authentication Service as follows:
      • Retrieve the token and token related information, for example, the expiration time.
      • Verify the signature of the response that the Authentication Service returns.
      • Retrieve the user and group information from the response that the Authentication Service returns.
      • Add the token to the token cache.