Source Code Cross Referenced for DSameSecurityManager.java in  » Portal » Open-Portal » com » sun » portal » search » rdmserver » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.search.rdmserver 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
004:         */
005:
006:        package com.sun.portal.search.rdmserver;
007:
008:        import com.iplanet.am.util.AdminUtils;
009:        import com.sun.portal.search.rdm.*;
010:        import com.sun.portal.search.db.SToken;
011:        import javax.servlet.http.*;
012:        import com.iplanet.sso.*;
013:        import java.security.AccessController;
014:        import com.sun.identity.security.DecryptAction;
015:        import com.sun.identity.security.*;
016:        import com.sun.portal.search.community.CommunityDatabaseSecurityModule;
017:        import com.sun.portal.search.db.DatabaseSecurityModule;
018:        import com.sun.portal.search.db.RDMAuthenticationModule;
019:        import com.sun.portal.search.util.SearchLogger;
020:        import java.util.logging.Level;
021:        import com.sun.portal.admin.common.util.AdminUtil;
022:
023:        /**
024:         *  Implementation of RDMAuthenticationModule in DSame
025:         */
026:        public class DSameSecurityManager implements  RDMAuthenticationModule {
027:
028:            static boolean group_support = false;
029:            static final String ADMIN_CN = "cn=Top-level Admin Role";
030:            static String role_admin = null;
031:
032:            public DSameSecurityManager() {
033:            }
034:
035:            public String toString() {
036:                return "DSame -RDMAuthenticationModule";
037:            }
038:
039:            /** Setup the RDMRequest Security Token
040:             * Security infomation in req proceed request
041:             * @param request the HttpServletRequest Object for checking cookies
042:             * @param req the RDMRequest Object
043:             */
044:            public boolean initRDMSToken(Object request, RDMRequest req)
045:                    throws Exception {
046:                SSOTokenManager manager = SSOTokenManager.getInstance();
047:                SSOToken token = null;
048:                String proxyDN = null;
049:                final String user = req.getHeader().getUser();
050:                String pw = req.getHeader().getPassword();
051:                String rdmsso = req.getHeader().getAccessToken();
052:                if (user != null) {
053:                    if (pw == null)
054:                        pw = ""; /* no password */
055:                    String cleanTextPw = new String(AccessController
056:                            .doPrivileged(new DecryptAction(pw)).toString());
057:                    try {
058:                        token = com.sun.portal.util.SSOUtil.createSSOToken(
059:                                user, cleanTextPw);
060:                    } catch (SSOException e) {
061:                        SearchLogger.getLogger().log(
062:                                Level.WARNING,
063:                                "Failed to create stoken by user/password ["
064:                                        + user + ":" + pw + "] with exception:"
065:                                        + e);
066:                    }
067:                } else if (rdmsso != null) {
068:                    try {
069:                        token = manager.createSSOToken(rdmsso);
070:                    } catch (SSOException e) {
071:                        SearchLogger.getLogger().log(
072:                                Level.WARNING,
073:                                "Failed to create stoken by sessionid ["
074:                                        + rdmsso + "] with exception:" + e);
075:                    }
076:                }
077:                if (token == null || manager.isValidToken(token) == false) {
078:
079:                    if (request != null
080:                            && request instanceof  HttpServletRequest) {
081:                        try {
082:                            token = manager
083:                                    .createSSOToken((HttpServletRequest) request);
084:                            proxyDN = (String) ((HttpServletRequest) request)
085:                                    .getParameter("proxyDN");
086:                        } catch (SSOException e) {
087:                            SearchLogger.getLogger().log(
088:                                    Level.WARNING,
089:                                    "Failed to create stoken by httprequest with exception:"
090:                                            + e);
091:                        }
092:                    }
093:                }
094:                if (token != null && manager.isValidToken(token) == true) {
095:                    SToken st = new SToken((Object) token, true, true, true);
096:                    // setting the proxying context from external request
097:                    if (proxyDN != null) {
098:                        st.setProxyDN(proxyDN);
099:                    }
100:                    req.setSToken(st);
101:                    return true;
102:                }
103:                return false;
104:
105:            }
106:
107:            public DatabaseSecurityModule[] getAssociatedSecurityModules() {
108:                DatabaseSecurityModule[] myModules = new DatabaseSecurityModule[2];
109:                myModules[0] = (DatabaseSecurityModule) new DSameDatabaseSecurityModule();
110:                myModules[1] = (DatabaseSecurityModule) new CommunityDatabaseSecurityModule();
111:                return myModules;
112:            }
113:
114:            public String getDefaultDatabaseSecurityModuleName() {
115:                return DSameDatabaseSecurityModule.myName;
116:            }
117:
118:            //
119:            // Check if the current user is super user kinds
120:            //
121:            public boolean isPrivilegedUser(SToken stoken) throws Exception {
122:                String domainSuperUserDN = AdminUtil.getPortalDomainContext()
123:                        .getSuperUser();
124:
125:                SSOToken ssoToken = (SSOToken) stoken.getNativeToken();
126:                if (ssoToken != null) {
127:                    String userDN = ssoToken.getPrincipal().getName();
128:
129:                    if (userDN.equals(AdminUtils.getAdminDN())
130:                            || userDN.equals(domainSuperUserDN)) {
131:                        return true;
132:                    }
133:                }
134:                return false;
135:            }
136:
137:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.