01: package com.sun.portal.rproxy.configservlet.server;
02:
03: import java.rmi.RemoteException;
04: import java.security.AccessController;
05: import java.util.Map;
06:
07: import com.iplanet.am.util.AdminUtils;
08: import com.iplanet.sso.SSOException;
09: import com.iplanet.sso.SSOToken;
10: import com.iplanet.sso.SSOTokenManager;
11: import com.sun.identity.security.AdminTokenAction;
12: import com.sun.identity.sm.SMSException;
13: import com.sun.identity.sm.ServiceSchema;
14: import com.sun.identity.sm.ServiceSchemaManager;
15: import com.sun.portal.rproxy.configservlet.Request;
16: import com.sun.portal.rproxy.configservlet.Response;
17: import com.sun.portal.rproxy.configservlet.ServiceHandler;
18:
19: public class GlobalAttributesServiceHandler implements ServiceHandler {
20:
21: public GlobalAttributesServiceHandler() {
22: }
23:
24: public Response handleRequest(Request request)
25: throws RemoteException {
26: try {
27: SSOToken token = getSSOToken(request);
28: ServiceSchemaManager schemaMgr = new ServiceSchemaManager(
29: request.getServiceName(), token);
30: ServiceSchema schema = schemaMgr.getGlobalSchema();
31: Map attrs = schema.getAttributeDefaults();
32: Response response = new Response(request.getServiceName(),
33: request.getRequestType(), attrs);
34: return response;
35:
36: } catch (SSOException ssoe) {
37: throw new RemoteException(
38: "Not able to get Global Attributes", ssoe);
39: } catch (SMSException smse) {
40: throw new RemoteException(
41: "Not able to get Global Attributes", smse);
42: }
43: }
44:
45: private SSOToken getSSOToken(Request request)
46: throws RemoteException {
47:
48: String password = new String(AdminUtils.getAdminPassword());
49: return (SSOToken) AccessController
50: .doPrivileged(AdminTokenAction.getInstance());
51: /*
52: * SSOTokenManager tokenManager = SSOTokenManager.getInstance(); return
53: * tokenManager.createSSOToken(new java.security.Principal() { public
54: * String getName() { return AdminUtils.getAdminDN(); } }, password);
55: */// // Removal of SSOToken deprecated API's CR #6273654
56: }
57: }
|