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
- To use the Authentication Service to perform basic authentication, perform the following
steps:
- Read the configuration information.
- Create the WS-Trust request (RST) that has the username token.
- Send the WS-Trust request (RST) using a HTTP client package.
- 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.
- 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:
- Read the configuration information.
- 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.
- Send the WS-Trust request (RST) using a HTTP client, such as libCurl.
- 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.