Source Code Cross Referenced for Admin.java in  » Authentication-Authorization » ejbca » org » ejbca » core » model » log » 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 » Authentication Authorization » ejbca » org.ejbca.core.model.log 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*************************************************************************
002:         *                                                                       *
003:         *  EJBCA: The OpenSource Certificate Authority                          *
004:         *                                                                       *
005:         *  This software is free software; you can redistribute it and/or       *
006:         *  modify it under the terms of the GNU Lesser General Public           *
007:         *  License as published by the Free Software Foundation; either         *
008:         *  version 2.1 of the License, or any later version.                    *
009:         *                                                                       *
010:         *  See terms of license at gnu.org.                                     *
011:         *                                                                       *
012:         *************************************************************************/package org.ejbca.core.model.log;
013:
014:        import java.io.Serializable;
015:        import java.security.cert.X509Certificate;
016:
017:        import org.ejbca.core.model.authorization.AdminEntity;
018:        import org.ejbca.core.model.authorization.AdminInformation;
019:        import org.ejbca.util.CertTools;
020:
021:        /**
022:         * This is a class containing information about the administrator or admin preforming the event.
023:         * Data contained in the class is preferbly
024:         *
025:         * @author TomSelleck
026:         * @version $Id: Admin.java,v 1.5 2007/06/25 14:45:32 herrvendil Exp $
027:         */
028:        public class Admin implements  Serializable {
029:
030:            /**
031:             * Determines if a de-serialized file is compatible with this class.
032:             *
033:             * Maintainers must change this value if and only if the new version
034:             * of this class is not compatible with old versions. See Sun docs
035:             * for <a href=http://java.sun.com/products/jdk/1.1/docs/guide
036:             * /serialization/spec/version.doc.html> details. </a>
037:             *
038:             */
039:            private static final long serialVersionUID = -9221031402622809524L;
040:
041:            // Public Constants
042:            // Indicates the type of administrator.
043:            /** An administrator authenticated with client certificate */
044:            public static final int TYPE_CLIENTCERT_USER = 0;
045:            /** A user of the public web pages */
046:            public static final int TYPE_PUBLIC_WEB_USER = 1;
047:            /** An internal RA function, such as cmd line or CMP */
048:            public static final int TYPE_RA_USER = 2;
049:            /** An internal CA admin function, such as cms line */
050:            public static final int TYPE_CACOMMANDLINE_USER = 3;
051:            /** Batch generation tool */
052:            public static final int TYPE_BATCHCOMMANDLINE_USER = 4;
053:            /** Internal user in EJBCA, such as automatic job */
054:            public static final int TYPE_INTERNALUSER = 5;
055:
056:            public static final int SPECIAL_ADMIN_BOUNDRARY = 100;
057:
058:            public static final String[] ADMINTYPETEXTS = { "CLIENTCERT",
059:                    "PUBLICWEBUSER", "RACMDLINE", "CACMDLINE", "BATCHCMDLINE",
060:                    "INTERNALUSER" };
061:
062:            private static final int[] ADMINTYPETOADMINENTITY = { 0,
063:                    AdminEntity.SPECIALADMIN_PUBLICWEBUSER,
064:                    AdminEntity.SPECIALADMIN_RAADMIN,
065:                    AdminEntity.SPECIALADMIN_CACOMMANDLINEADMIN,
066:                    AdminEntity.SPECIALADMIN_BATCHCOMMANDLINEADMIN,
067:                    AdminEntity.SPECIALADMIN_INTERNALUSER };
068:
069:            protected int type = -1;
070:            protected String data;
071:            protected X509Certificate certificate;
072:
073:            // Public Constructors
074:            public Admin(X509Certificate certificate) {
075:                this (TYPE_CLIENTCERT_USER, certificate.getSerialNumber()
076:                        .toString(16)
077:                        + ", " + CertTools.getIssuerDN(certificate));
078:                this .certificate = certificate;
079:            }
080:
081:            public Admin(int type, String ip) {
082:                this .type = type;
083:                this .data = ip;
084:            }
085:
086:            public Admin(int type) {
087:                this (type, null);
088:            }
089:
090:            // Public Methods
091:
092:            public int getAdminType() {
093:                return this .type;
094:            }
095:
096:            public String getAdminData() {
097:                return this .data;
098:            }
099:
100:            // Method that takes the internal data and returns a AdminInformation object required by the Authorization module.
101:            public AdminInformation getAdminInformation() {
102:                if (type == TYPE_CLIENTCERT_USER)
103:                    return new AdminInformation(certificate);
104:
105:                return new AdminInformation(ADMINTYPETOADMINENTITY[type]);
106:            }
107:
108:            /**
109:             * Method thar returns the caid of the CA, the admin belongs to.
110:             * Doesn't work properly for public web and special users so use with care.
111:             */
112:
113:            public int getCaId() {
114:                int returnval = LogConstants.INTERNALCAID;
115:                if (type == TYPE_CLIENTCERT_USER)
116:                    returnval = CertTools.getIssuerDN(certificate).hashCode();
117:                return returnval;
118:            }
119:
120:            public String toString() {
121:                if ((type > -1) && (type < ADMINTYPETEXTS.length - 1)) {
122:                    return ADMINTYPETEXTS[type];
123:                }
124:                return "UNKNOWN";
125:            }
126:
127:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.