Source Code Cross Referenced for AccessController.java in  » Web-Framework » TURBINE » org » apache » turbine » modules » actions » 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 » Web Framework » TURBINE » org.apache.turbine.modules.actions 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.turbine.modules.actions;
002:
003:        /*
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *   http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:
022:        import org.apache.commons.logging.Log;
023:        import org.apache.commons.logging.LogFactory;
024:
025:        import org.apache.turbine.modules.Action;
026:        import org.apache.turbine.services.security.TurbineSecurity;
027:        import org.apache.turbine.util.RunData;
028:        import org.apache.turbine.util.security.AccessControlList;
029:        import org.apache.turbine.util.security.TurbineSecurityException;
030:
031:        import org.apache.turbine.om.security.User;
032:
033:        /**
034:         * This action doPerforms an Access Control List and places it into
035:         * the RunData object, so it is easily available to modules.  The ACL
036:         * is also placed into the session.  Modules can null out the ACL to
037:         * force it to be rebuilt based on more information.
038:         *
039:         * <p>
040:         *
041:         * Turbine uses a User-Role-Permission arrangement for access control.
042:         * Users are assigned Roles.  Roles are assigned Permissions.  Turbine
043:         * modules then check the Permission required for an action or
044:         * information with the set of Permissions currently associated with
045:         * the session (which are dependent on the user associated with the
046:         * session.)
047:         *
048:         * <p>
049:         *
050:         * The criteria for assigning Roles/Permissions is application
051:         * dependent, in some cases an application may change a User's Roles
052:         * during the session.  To achieve flexibility, the ACL takes an
053:         * Object parameter, which the application can use to doPerform the
054:         * ACL.
055:         *
056:         * <p>
057:         *
058:         * This action is special in that it should only be executed by the
059:         * Turbine servlet.
060:         *
061:         * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
062:         * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
063:         * @author <a href="quintonm@bellsouth.net">Quinton McCombs</a>
064:         * @version $Id: AccessController.java 534527 2007-05-02 16:10:59Z tv $
065:         */
066:        public class AccessController extends Action {
067:
068:            /** Logging */
069:            private static Log log = LogFactory.getLog(AccessController.class);
070:
071:            /**
072:             * If there is a user and the user is logged in, doPerform will
073:             * set the RunData ACL.  The list is first sought from the current
074:             * session, otherwise it is loaded through
075:             * <code>TurbineSecurity.getACL()</code> and added to the current
076:             * session.
077:             *
078:             * @see org.apache.turbine.services.security.TurbineSecurity
079:             * @param data Turbine information.
080:             * @exception TurbineSecurityException problem with the security service.
081:             */
082:            public void doPerform(RunData data) throws TurbineSecurityException {
083:                User user = data.getUser();
084:
085:                if (!TurbineSecurity.isAnonymousUser(user)
086:                        && user.hasLoggedIn()) {
087:                    log.debug("Fetching ACL for " + user.getName());
088:                    AccessControlList acl = (AccessControlList) data
089:                            .getSession().getAttribute(
090:                                    AccessControlList.SESSION_KEY);
091:                    if (acl == null) {
092:                        log
093:                                .debug("No ACL found in Session, building fresh ACL");
094:                        acl = TurbineSecurity.getACL(user);
095:                        data.getSession().setAttribute(
096:                                AccessControlList.SESSION_KEY, acl);
097:
098:                        log.debug("ACL is " + acl);
099:                    }
100:                    data.setACL(acl);
101:                }
102:            }
103:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.