Source Code Cross Referenced for SingleSignOnEntry.java in  » Sevlet-Container » tomcat-catalina » org » apache » catalina » authenticator » 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 » Sevlet Container » tomcat catalina » org.apache.catalina.authenticator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 1999-2001,2004 The Apache Software Foundation.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.apache.catalina.authenticator;
017:
018:        import java.security.Principal;
019:
020:        import org.apache.catalina.Session;
021:        import org.apache.catalina.authenticator.Constants;
022:
023:        /**
024:         * A class that represents entries in the cache of authenticated users.
025:         * This is necessary to make it available to
026:         * <code>AuthenticatorBase</code> subclasses that need it in order to perform
027:         * reauthentications when SingleSignOn is in use.
028:         *
029:         * @author  B Stansberry, based on work by Craig R. McClanahan
030:         * @version $Revision: 1.5 $
031:         *
032:         * @see SingleSignOn
033:         * @see AuthenticatorBase#reauthenticateFromSSO
034:         */
035:        public class SingleSignOnEntry {
036:            // ------------------------------------------------------  Instance Fields
037:
038:            protected String authType = null;
039:
040:            protected String password = null;
041:
042:            protected Principal principal = null;
043:
044:            protected Session sessions[] = new Session[0];
045:
046:            protected String username = null;
047:
048:            protected boolean canReauthenticate = false;
049:
050:            // ---------------------------------------------------------  Constructors
051:
052:            /**
053:             * Creates a new SingleSignOnEntry
054:             *
055:             * @param principal the <code>Principal</code> returned by the latest
056:             *                  call to <code>Realm.authenticate</code>.
057:             * @param authType  the type of authenticator used (BASIC, CLIENT-CERT,
058:             *                  DIGEST or FORM)
059:             * @param username  the username (if any) used for the authentication
060:             * @param password  the password (if any) used for the authentication
061:             */
062:            public SingleSignOnEntry(Principal principal, String authType,
063:                    String username, String password) {
064:                super ();
065:                updateCredentials(principal, authType, username, password);
066:            }
067:
068:            public SingleSignOnEntry() {
069:            }
070:
071:            // ------------------------------------------------------- Package Methods
072:
073:            /**
074:             * Adds a <code>Session</code> to the list of those associated with
075:             * this SSO.
076:             *
077:             * @param sso       The <code>SingleSignOn</code> valve that is managing
078:             *                  the SSO session.
079:             * @param session   The <code>Session</code> being associated with the SSO.
080:             */
081:            public synchronized void addSession(SingleSignOn sso,
082:                    Session session) {
083:                for (int i = 0; i < sessions.length; i++) {
084:                    if (session == sessions[i])
085:                        return;
086:                }
087:                Session results[] = new Session[sessions.length + 1];
088:                System.arraycopy(sessions, 0, results, 0, sessions.length);
089:                results[sessions.length] = session;
090:                sessions = results;
091:                session.addSessionListener(sso);
092:            }
093:
094:            /**
095:             * Removes the given <code>Session</code> from the list of those
096:             * associated with this SSO.
097:             *
098:             * @param session  the <code>Session</code> to remove.
099:             */
100:            public synchronized void removeSession(Session session) {
101:                Session[] nsessions = new Session[sessions.length - 1];
102:                for (int i = 0, j = 0; i < sessions.length; i++) {
103:                    if (session == sessions[i])
104:                        continue;
105:                    nsessions[j++] = sessions[i];
106:                }
107:                sessions = nsessions;
108:            }
109:
110:            /**
111:             * Returns the <code>Session</code>s associated with this SSO.
112:             */
113:            public synchronized Session[] findSessions() {
114:                return (this .sessions);
115:            }
116:
117:            /**
118:             * Gets the name of the authentication type originally used to authenticate
119:             * the user associated with the SSO.
120:             *
121:             * @return "BASIC", "CLIENT-CERT", "DIGEST", "FORM" or "NONE"
122:             */
123:            public String getAuthType() {
124:                return (this .authType);
125:            }
126:
127:            /**
128:             * Gets whether the authentication type associated with the original
129:             * authentication supports reauthentication.
130:             *
131:             * @return  <code>true</code> if <code>getAuthType</code> returns
132:             *          "BASIC" or "FORM", <code>false</code> otherwise.
133:             */
134:            public boolean getCanReauthenticate() {
135:                return (this .canReauthenticate);
136:            }
137:
138:            /**
139:             * Gets the password credential (if any) associated with the SSO.
140:             *
141:             * @return  the password credential associated with the SSO, or
142:             *          <code>null</code> if the original authentication type
143:             *          does not involve a password.
144:             */
145:            public String getPassword() {
146:                return (this .password);
147:            }
148:
149:            /**
150:             * Gets the <code>Principal</code> that has been authenticated by
151:             * the SSO.
152:             */
153:            public Principal getPrincipal() {
154:                return (this .principal);
155:            }
156:
157:            /**
158:             * Gets the username provided by the user as part of the authentication
159:             * process.
160:             */
161:            public String getUsername() {
162:                return (this .username);
163:            }
164:
165:            /**
166:             * Updates the SingleSignOnEntry to reflect the latest security
167:             * information associated with the caller.
168:             *
169:             * @param principal the <code>Principal</code> returned by the latest
170:             *                  call to <code>Realm.authenticate</code>.
171:             * @param authType  the type of authenticator used (BASIC, CLIENT-CERT,
172:             *                  DIGEST or FORM)
173:             * @param username  the username (if any) used for the authentication
174:             * @param password  the password (if any) used for the authentication
175:             */
176:            public void updateCredentials(Principal principal, String authType,
177:                    String username, String password) {
178:
179:                this.principal = principal;
180:                this.authType = authType;
181:                this.username = username;
182:                this.password = password;
183:                this.canReauthenticate = (Constants.BASIC_METHOD
184:                        .equals(authType) || Constants.FORM_METHOD
185:                        .equals(authType));
186:            }
187:
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.