IdRepoJAXRPCObjectImpl.java revision 6a490d4b01fde313651d02ca8d6ac8db32266d03
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: IdRepoJAXRPCObjectImpl.java,v 1.13 2010/01/06 01:58:27 veiming Exp $
*/
/*
* Portions Copyrighted 2011-2013 ForgeRock AS
*/
/**
* Provides service side implementation of IdRepo for JAX-RPC interface
* <class>DirectoryManagerIF</class>. Does not provide implementation for
* deprecated AMSDK interfaces.
* Remote clients using openssoclientsdk.jar would be calling these
* methods using SOAP.
* Implements identity changes notifications via PLL and also stores
* notifications changes for polling clients.
*/
public abstract class IdRepoJAXRPCObjectImpl implements DirectoryManagerIF {
protected static SSOTokenManager tokenManager;
protected static IdServices idServices;
// Cache of modifications for last 30 minutes & notification URLs
protected static int cacheSize = -1;
protected static String serverPort;
protected static void initialize_cacheSize() {
if (cacheSize > -1) {
return;
}
// Obtain the cache size, if configured
"com.sun.am.event.notification.expire.time");
try {
if (cacheSize < 0) {
cacheSize = 30;
}
} catch(NumberFormatException e) {
cacheSize = 30;
}
if (idRepoDebug.messageEnabled()) {
"EventNotification cache size is set to " + cacheSize);
}
}
private static void initialize_cache() {
}
}
/**
* Initializes this class with system properties.
* Called only by getSSOToken() method. Hence all other methods
* must call either getSSOToken() or initialize() directly.
*/
protected static void initialize_idrepo() {
// Construct serverURL
":" + serverPort;
if (idRepoDebug.messageEnabled()) {
}
// Initialize IdRepo Service Factory
if (idServices == null) {
}
}
// Check URL is not the local server
boolean success = true;
try {
}
} catch (MalformedURLException e) {
if (idRepoDebug.warningEnabled()) {
"isClientOnSameServer() - clientURL is malformed " +
}
success = false;
}
if (success) { // check if it is the same server
if (port == -1) {
// If it is Port 80, and is not explicilty in the URL
}
// Protocol is same - http, so no need to check that
"checkIfClientOnSameServer() "
+ "Received registerNotification request from client: "
+ sameServer);
return sameServer;
} else {
return false;
}
}
public void assignService_idrepo(
}
public String create_idrepo(
}
public void delete_idrepo(
}
public Set getAssignedServices_idrepo(
) throws RemoteException, IdRepoException,
}
public Map getAttributes1_idrepo(
}
}
return res;
}
public Map getAttributes2_idrepo(
amsdkDN);
}
}
return res;
}
if (binaryAttributes != null) {
//shuffle around the data so we can send it across the wire
}
}
}
return ret;
}
public Set getMembers_idrepo(
}
}
return results;
}
public Set getMemberships_idrepo(
}
}
return results;
}
public Map getServiceAttributes_idrepo(
}
public Map getBinaryServiceAttributes_idrepo(
}
}
public Set getSupportedOperations_idrepo(
}
}
return resSet;
}
}
}
return resTypes;
}
// Convert CaseInsensitiveHashSet to HashSet
}
}
return resSet;
}
public boolean isExists_idrepo(
}
public boolean isActive_idrepo(
}
public void setActiveStatus_idrepo(
boolean active
}
public void modifyMemberShip_idrepo(
int operation,
}
public void modifyService_idrepo(
}
public void removeAttributes_idrepo(
}
public Map search1_idrepo(
boolean recursive,
int maxResults,
int maxTime,
}
public Map search2_idrepo(
int maxTime,
int maxResults,
boolean returnAllAttrs,
int filterOp,
boolean recursive,
return IdSearchResultsToMap(idres);
}
public void setAttributes_idrepo(
boolean isAdd,
}
public void setAttributes2_idrepo(
boolean isAdd,
boolean isString
if (!isString) {
int counter = 0;
}
}
}
}
public void changePassword_idrepo(
}
public void unassignService_idrepo(
}
synchronized (idRepoNotificationURLs) {
}
}
}
// Get the cache index for times upto time+2
}
cacheIndex--;
}
if (idRepoDebug.messageEnabled()) {
}
return (answer);
}
}
// Default value if there are any issues with the registration process.
try {
// Check URL is not the local server
if (!isClientOnSameServer(url)) {
synchronized (notificationURLs) {
// Don't add the URL again if we already have it registered
boolean alreadyRegistered = false;
// This allows us to return the existing entry ID to support clients being able to
// de-register the correct entry.
alreadyRegistered = true;
if (idRepoDebug.messageEnabled()) {
}
break;
}
}
// If we didn't find the url in our list, add it
if (!alreadyRegistered) {
try {
} catch (ServerEntryNotFoundException e) {
if (idRepoDebug.messageEnabled()) {
"had a problem getting our serverID ", e);
}
}
// Generate a unique value that includes the serverID to have a better chance of being unique
// in a cluster should a de-register request end up on the wrong server.
if (idRepoDebug.messageEnabled()) {
}
}
}
} else {
// Cannot add this server for notifications
if (idRepoDebug.warningEnabled()) {
+ "cannot add local server: " + url);
}
}
} catch (MalformedURLException e) {
if (idRepoDebug.warningEnabled()) {
"registerNotificationURL invalid URL: " + url, e);
}
}
return id;
}
public Map getSpecialIdentities_idrepo(
return IdSearchResultsToMap(result);
}
// Implementation to process entry changed events
protected static void processEntryChanged_idrepo(
if (idRepoDebug.messageEnabled()) {
}
// Return if cache size is 0 or there are no remote clients
if (idRepoDebug.messageEnabled()) {
"processEntryChaged No registered notification URLs: " +
idRepoNotificationURLs + " and cache size is: " +
}
return;
}
// Construct the XML document for the event change
.append("</Value></AttributeValuePair>")
.append("<AttributeValuePair><Attribute name=\"entityName\" />")
.append("</Value></AttributeValuePair>");
"</Value></AttributeValuePair>");
"name=\"attrNames\"/>");
}
}
}
// Update cache for polling by remote clients
if (cacheSize > 0) {
// Obtain the cache index
// Maintain cacheIndex
}
// Add to cache
if (idRepoDebug.messageEnabled()) {
}
}
// If notification URLs are present, send notifications
if (idRepoDebug.messageEnabled()) {
}
synchronized (idRepoNotificationURLs) {
// Construct NotificationSet
}
try {
if (idRepoDebug.messageEnabled()) {
}
} catch (SendNotificationException ne) {
if (idRepoDebug.warningEnabled()) {
+ "URL from notification list.", ne);
}
// Remove the URL from Notification List
}
}
}
}
long currentTime) {
// remove the last cache entries
if (idRepoDebug.messageEnabled()) {
+ removedIndex);
}
}
// remove expired cache entries
if (idRepoDebug.messageEnabled()) {
+ removedIndex);
}
}
}
// TODO ..check if the Map gets properly populated and sent.
}
}
}
}
return (answer);
}
/**
* Check if agent token ID is appended to the token string.
* if yes, we use it as a restriction context. This is meant
* for cookie hijacking feature where agent appends the agent token ID
* to the user sso token before sending it over to the server for
* validation.
*/
// Initalize the class variables
if (tokenManager == null) {
}
if (index == -1) {
}
try {
/*
* for 7.0 patch-4 agent, IP address maybe send back to server.
* this is a very simple check for IP Address
*/
try {
} catch (Exception e) {
}
} else {
}
new RestrictedTokenAction() {
}
});
} catch (SSOException e) {
} catch (Exception e) {
}
return stoken;
}
}