Source Code Cross Referenced for NtlmLoginModule.java in  » Project-Management » XPlanner-0.7b7 » com » technoetic » xplanner » security » module » ntlm » 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 » Project Management » XPlanner 0.7b7 » com.technoetic.xplanner.security.module.ntlm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package com.technoetic.xplanner.security.module.ntlm;
02:
03:        import java.util.Map;
04:        import javax.security.auth.Subject;
05:        import javax.servlet.http.HttpServletRequest;
06:
07:        import jcifs.smb.SmbAuthException;
08:        import jcifs.smb.SmbException;
09:        import org.apache.log4j.Logger;
10:
11:        import com.technoetic.xplanner.security.AuthenticationException;
12:        import com.technoetic.xplanner.security.LoginModule;
13:        import com.technoetic.xplanner.security.module.LoginSupport;
14:        import com.technoetic.xplanner.security.module.LoginSupportImpl;
15:
16:        public class NtlmLoginModule implements  LoginModule {
17:            private String domainController;
18:            private String domain;
19:            private String name;
20:            private transient Logger log = Logger.getLogger(getClass());
21:            transient LoginSupport support = new LoginSupportImpl();
22:            transient NtlmLoginHelper helper = new NtlmLoginHelperImpl();
23:            public static final String DOMAIN_KEY = "domain";
24:            public static final String CONTROLLER_KEY = "controller";
25:
26:            public NtlmLoginModule(LoginSupport loginSupport,
27:                    NtlmLoginHelper helper) {
28:                this .support = loginSupport;
29:                this .helper = helper;
30:            }
31:
32:            public void setOptions(Map options) {
33:                domain = options.get(DOMAIN_KEY) != null ? (String) options
34:                        .get(DOMAIN_KEY) : "YANDEX";
35:                domainController = options.get(CONTROLLER_KEY) != null ? (String) options
36:                        .get(CONTROLLER_KEY)
37:                        : domain;
38:                log.debug("initialized");
39:            }
40:
41:            public Subject authenticate(String userId, String password)
42:                    throws AuthenticationException {
43:                log.debug(ATTEMPTING_TO_AUTHENTICATE + this .getName() + " ("
44:                        + userId + ")");
45:                try {
46:                    helper.authenticate(userId, password, domainController,
47:                            domain);
48:
49:                } catch (SmbAuthException sae) {
50:                    log.error("NT domain did not authenticate user " + userId);
51:                    throw new AuthenticationException(
52:                            MESSAGE_AUTHENTICATION_FAILED_KEY);
53:                } catch (SmbException se) {
54:                    log
55:                            .error("SmbException while authenticating "
56:                                    + userId, se);
57:                    throw new AuthenticationException(MESSAGE_SERVER_ERROR_KEY);
58:                } catch (java.net.UnknownHostException e) {
59:                    log.error("UnknownHostException while authenticating "
60:                            + userId, e);
61:                    throw new AuthenticationException(
62:                            MESSAGE_SERVER_NOT_FOUND_KEY);
63:                }
64:
65:                log.info("NT domain authenticated user " + userId);
66:
67:                Subject subject = support.createSubject();
68:                log.debug("looking for user: " + userId);
69:                support.populateSubjectPrincipalFromDatabase(subject, userId);
70:                log.debug(AUTHENTICATION_SUCCESFULL + this .getName());
71:                return subject;
72:            }
73:
74:            public boolean isCapableOfChangingPasswords() {
75:                return false;
76:            }
77:
78:            public void changePassword(String userId, String password)
79:                    throws AuthenticationException {
80:                throw new UnsupportedOperationException(
81:                        "change Password not implemented");
82:            }
83:
84:            public void logout(HttpServletRequest request)
85:                    throws AuthenticationException {
86:                request.getSession().invalidate();
87:            }
88:
89:            public String getName() {
90:                return name;
91:            }
92:
93:            public void setName(String name) {
94:                this.name = name;
95:            }
96:
97:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.