To write a Policy Management application
The SiteMinder SDK contains a sample of how to use the classes and methods in the Java Policy Management API.
To establish a connection to the Policy Server, use the SmApiConnection class of the Utilities package. This class holds the Agent API handle through which Java API requests are sent.
There are two types of connection handles in this class:
You can establish multiple connections to the Policy Server through the single Agent API object instance.
A session object is obtained when a user or administrator successfully logs in. In this case, an administrator login is required, since only administrators can perform policy management.
To log in a SiteMinder administrator and establish an administrator session, call the login() method in the SmApiSession class of the Utilities package.
Once login is successful, the session object will hold a valid administrator session specification.
After obtaining a valid session, create a Policy Management API object by passing the session to the constructor of the SmPolicyApiImpl class—for example:
SmPolicyApi policyApi = new SmPolicyApiImpl (apiSession);
In the example, policyApi is the new Policy Management API object and apiSession is the session obtained when the administrator successfully logged in.
After you obtain a session object and create a Policy Management API object, you are ready to make Policy Management requests. Most of the methods in the Policy Management API are categorized according to the SiteMinder object that a given method acts upon—for example, agents, policies, and rules.
There is also a Utilities category for methods that perform services, such as cache and encryption key management. Use these categories to help you find a particular Policy Management API method to use in your custom policy management applications.
Note: The methods in the policyapi package can only be called from a Siteminder administrator session.
When you are finished making Policy Management API requests, log out the administrator by calling the logout() method in the SmApiSession class of the Utilities package.
Important! After you have called the logout() method, the connection handle becomes invalid. Do not reference it again.
Copyright © 2015 CA Technologies.
All rights reserved.
|
|