Tag: web应用程序

如何在给定LdapContext的ldap whith java中检查用户密码?

我有一个Web应用程序,用户必须登录。密码存储在LDAP服务器中。 有关LDAP服务器的所有信息都作为外部jndi资源存储在应用程序服务器(glassfish)中。 所以我的应用程序对LDAP服务器一无所知,只得到像这样的LdapContext: @Resource(name = “ldap/users”) private LdapContext ctx; 使用此上下文,可以轻松更改或读取为用户存储的信息,但如何检查其密码? 通常我会做一个新连接来检查用户密码。 喜欢这个: Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, “com.sun.jndi.ldap.LdapCtxFactory”); env.put(Context.PROVIDER_URL, “ldap://localhost:389/o=JNDITutorial”); env.put(Context.SECURITY_AUTHENTICATION, “simple”); env.put(Context.SECURITY_PRINCIPAL, “cn=S. User, ou=NewHires, o=JNDITutorial”); env.put(Context.SECURITY_CREDENTIALS, “mysecret”); DirContext ctx = new InitialDirContext(env); 但由于我不知道这个参数我不能这样做。 那么如何使用我的LdapContext检查用户的密码是否正确? 密码以加密方式存储(ssha),所以我不能只比较属性。 谢谢拉斐尔

尝试使用ESAPI但是获取错误

我正在尝试使用ESAPI.jar为我的Web应用程序提供安全性。基本上我刚开始使用ESAPI.jar。 但问题是我无法使用ESAPI运行一个简单的程序。 小代码片段是: String clean = ESAPI.encoder().canonicalize(“someString”); Randomizer r=ESAPI.randomizer(); System.out.println(r); System.out.println(clean); 我收到此错误: Attempting to load ESAPI.properties via file I/O. Attempting to load ESAPI.properties as resource file via file I/O. Not found in ‘org.owasp.esapi.resources’ directory or file not readable: D:\Eclipse-Workspace\Test\ESAPI.properties Not found in SystemResource Directory/resourceDirectory: .esapi\ESAPI.properties Not found in ‘user.home’ (C:\Documents and Settings\user.user) directory: C:\Documents and […]

如何创建包含Tomcat和MySQL的Java webapp安装程序(.exe)?“

如何使用结合了tomcat,mysql和war文件的Java创建一个安装程序并出来一个最终的exe?