use of com.sun.identity.policy.remote.PolicyService in project OpenAM by OpenRock.
the class ResourceResultCache method removeRemotePolicyListener.
/**
* Removes a listener registered with policy service to recieve
* notifications on policy changes
* @param appToken session token identifying the client
* @param serviceName service name
* @param notificationURL end point on the client that listens for
* notifications
*/
public boolean removeRemotePolicyListener(SSOToken appToken, String serviceName, String notificationURL) {
boolean status = false;
URL policyServiceURL = null;
remotePolicyListeners.remove(notificationURL);
if (appToken != null) {
try {
policyServiceURL = getPolicyServiceURL(appToken);
} catch (PolicyException pe) {
debug.error("ResourceResultCache.removeRemotePolicyListener():" + "Can not remove policy listner:", pe);
}
}
if ((appToken != null) && (policyServiceURL != null)) {
RemoveListenerRequest rmReq = new RemoveListenerRequest();
rmReq.setServiceName(serviceName);
rmReq.setNotificationURL(notificationURL);
PolicyRequest policyReq = new PolicyRequest();
policyReq.setAppSSOToken(appToken.getTokenID().toString());
policyReq.setMethodID(PolicyRequest.POLICY_REQUEST_REMOVE_POLICY_LISTENER);
policyReq.setRemoveListenerRequest(rmReq);
try {
PolicyService ps = sendPLLRequest(policyServiceURL, policyReq);
if (ps != null) {
if (debug.messageEnabled()) {
debug.message("ResourceResultCache." + "removeRemotePolicyListener():" + "result=" + ps.toXMLString());
}
PolicyResponse psres = ps.getPolicyResponse();
if (psres.getMethodID() == PolicyResponse.POLICY_REMOVE_LISTENER_RESPONSE) {
status = true;
}
} else {
debug.message("ResourceResultCache." + "removeRemotePolicyListener():" + "no result");
}
} catch (Exception e) {
debug.error("ResourceResultCache.removeRemotePolicyListener():", e);
}
}
return status;
}
Aggregations