Source Code Cross Referenced for AuthUser.java in  » Web-Server » Jigsaw » org » w3c » jigsaw » auth » 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 Server » Jigsaw » org.w3c.jigsaw.auth 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // AuthUser.java
002:        // $Id: AuthUser.java,v 1.8 2002/06/26 17:55:05 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1996.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.jigsaw.auth;
007:
008:        import java.util.Hashtable;
009:
010:        import org.w3c.tools.resources.Attribute;
011:        import org.w3c.tools.resources.AttributeHolder;
012:        import org.w3c.tools.resources.AttributeRegistry;
013:        import org.w3c.tools.resources.Resource;
014:        import org.w3c.tools.resources.ResourceContext;
015:        import org.w3c.tools.resources.StringArrayAttribute;
016:        import org.w3c.tools.resources.StringAttribute;
017:
018:        /**
019:         * The basic description of a user.
020:         * A user is defined by the following set of attributes: its name, its email
021:         * adress, some comments. Than it can have either an IP adress, and/or 
022:         * a password.
023:         * <p>If an IP adress is provided, the user will be authentified by its
024:         * incoming connection IP address. Moreover, if a password is provided, 
025:         * before being authentified, the client will be challenged for it.
026:         * <p>Finally a user can be registered in any number of groups.
027:         */
028:
029:        public class AuthUser extends Resource {
030:            /**
031:             * Attribute index - The email adress of the user.
032:             */
033:            protected static int ATTR_EMAIL = -1;
034:            /**
035:             * Attribute index - The comments for this user.
036:             */
037:            protected static int ATTR_COMMENTS = -1;
038:            /**
039:             * Attribute index - The IP adress of the user.
040:             */
041:            protected static int ATTR_IPADDR = -1;
042:            /**
043:             * Attribute index - The optional password for the user.
044:             */
045:            protected static int ATTR_PASSWORD = -1;
046:            /**
047:             * Attribute index - The list of groups this user belongs to.
048:             */
049:            protected static int ATTR_GROUPS = -1;
050:
051:            static {
052:                Attribute a = null;
053:                Class cls = null;
054:
055:                try {
056:                    cls = Class.forName("org.w3c.jigsaw.auth.AuthUser");
057:                } catch (Exception ex) {
058:                    ex.printStackTrace();
059:                    System.exit(1);
060:                }
061:                // The user email address
062:                a = new StringAttribute("email", null, Attribute.EDITABLE);
063:                ATTR_EMAIL = AttributeRegistry.registerAttribute(cls, a);
064:                // The comments for the user
065:                a = new StringAttribute("comments", null, Attribute.EDITABLE);
066:                ATTR_COMMENTS = AttributeRegistry.registerAttribute(cls, a);
067:                // The IP address of the user (optional)
068:                a = new IPTemplatesAttribute("ipaddress", null,
069:                        Attribute.EDITABLE);
070:                ATTR_IPADDR = AttributeRegistry.registerAttribute(cls, a);
071:                // The password for the user
072:                a = new PasswordAttribute("password", null, Attribute.EDITABLE);
073:                ATTR_PASSWORD = AttributeRegistry.registerAttribute(cls, a);
074:                // The groups the user belong to.
075:                a = new StringArrayAttribute("groups", null, Attribute.EDITABLE);
076:                ATTR_GROUPS = AttributeRegistry.registerAttribute(cls, a);
077:            }
078:
079:            /**
080:             * Get this user's name.
081:             * We use the resource identifier as the user name here.
082:             */
083:
084:            public String getName() {
085:                return getIdentifier();
086:            }
087:
088:            /**
089:             * Get the user email address.
090:             */
091:
092:            public String getEmail() {
093:                return (String) getValue(ATTR_EMAIL, null);
094:            }
095:
096:            /**
097:             * Get the user associated comments.
098:             */
099:
100:            public String getComments() {
101:                return (String) getValue(ATTR_COMMENTS, null);
102:            }
103:
104:            /**
105:             * Get the user IP templates.
106:             */
107:
108:            public short[][] getIPTemplates() {
109:                return (short[][]) getValue(ATTR_IPADDR, null);
110:            }
111:
112:            /**
113:             * Get the user password.
114:             */
115:
116:            public String getPassword() {
117:                return (String) getValue(ATTR_PASSWORD, null);
118:            }
119:
120:            /**
121:             * Set a new password for this user.
122:             * @param passwd The new user's password.
123:             */
124:
125:            public void setPassword(String passwd) {
126:                setString(ATTR_PASSWORD, passwd);
127:            }
128:
129:            /**
130:             * Get the user groups.
131:             */
132:
133:            public String[] getGroups() {
134:                return (String[]) getValue(ATTR_GROUPS, null);
135:            }
136:
137:            /**
138:             * Create a new user.
139:             * @param name The user's name.
140:             */
141:
142:            public static AuthUser makeUser(String name, ResourceContext context) {
143:                Hashtable defs = new Hashtable(3);
144:                defs.put(id, name);
145:                defs.put(co, context);
146:                AuthUser user = new AuthUser();
147:                user.initialize(defs);
148:                return user;
149:            }
150:
151:            /**
152:             * Create a new user.
153:             * @param name The user's name.
154:             */
155:            public static AuthUser makeUser(Resource res, String name,
156:                    ResourceContext context) {
157:                Hashtable defs = new Hashtable(3);
158:                defs.put(id, name);
159:                defs.put(co, context);
160:                AuthUser user = (AuthUser) res;
161:                user.initialize(defs);
162:                return user;
163:            }
164:
165:            public AuthUser() {
166:            }
167:
168:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.