Tag: active directory

将Ldap用户与使用Java的组关联

我在找到如何将#Ldap用户与给定组关联时遇到问题。 这就是我尝试过的: Attributes attrs = new BasicAttributes(); BasicAttribute basicAttrs = new BasicAttribute(“objectclass”); basicAttrs.add(“top”); basicAttrs.add(“person”); BasicAttribute memberOf = new BasicAttribute(“memberOf”); memberOf.add(“Managers”); // Tried with distinguished name too memberOf.add(“Administrators”); // Tried with distinguished name too attrs.put(basicAttrs); attrs.put(“cn”, user.getLogin()); attrs.put(“name”, user.getLogin()); attrs.put(“login”, user.getLogin()); attrs.put(“mail”, user.getMail()); attrs.put(“displayName”, user.getDisplayName()); attrs.put(“memberOf”, memberOf); try { ctx.bind(“CN=” + user.getLogin() + “,” + baseDn, […]

Java SSO:针对Active Directory的Kerberos身份validation

我仍在尝试为SSO(在* nix上运行)找到基于Java的解决方案,我可以在JBoss上使用它来针对Active Directory /域控制器进行授权。 我最初尝试通过NTLM执行此操作,但放弃了因为它在Windows Server> = 2008上不受支持。 因此,我正在尝试使用Kerberos实现此function,但似乎无法找到正确/可行的解决方案。 请指出正确的方向,说明如何设置这样的配置,如何validationActive Directory和/或域控制器,以便: 找出该帐户是否有效 获取用户的组列表 任何帮助表示赞赏! UPDATE 我正在使用jcifs-ext-0.9.4和jcifs-krb5-1.3.12开发解决方案。 我按如下所述设置了web.xml: auth jcifs.http.AuthenticationFilter java.security.auth.login.config /WEB-INF/login.conf jcifs.spnego.servicePrincipal HTTP/testconn@mydomain.com jcifs.spnego.servicePassword supersecret sun.security.krb5.debug true java.security.krb5.realm mydomain.com java.security.krb5.kdc testdom01.mydomain.com jcifs.smb.client.domain TESTDOMAIN jcifs.http.enableNegotiate true jcifs.http.basicRealm mydomain.com jcifs.http.domainController testdom01.mydomain.com auth /* 如果尝试访问应用程序,这会导致以下堆栈跟踪: 2010-07-22 15:53:10,588 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/google].[default]] Servlet.service() for servlet default threw exception java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native […]

如何使用Spring Security对Active Directory服务器进行身份validation?

我正在编写一个需要用户登录的Spring Web应用程序。 我的公司有一个Active Directory服务器,我想为此目的使用它。 但是,我在使用Spring Security连接服务器时遇到了麻烦。 我正在使用Spring 2.5.5和Spring Security 2.0.3以及Java 1.6。 如果我将LDAP URL更改为错误的IP地址,它不会抛出exception或任何东西,所以我想知道它是否甚至尝试连接到服务器开始。 虽然Web应用程序启动得很好,但我在登录页面中输入的任何信息都会被拒绝。 我以前使用过InMemoryDaoImpl,它工作正常,所以我的应用程序的其余部分似乎配置正确。 这是我与安全相关的bean: CN={0},OU=SBSUsers,OU=Users,OU=MyBusiness,DC=Acme,DC=com

使用Spring Security 3.2,Spring Ldap 2.0和JavaConfig进行Active Directory身份validation

我正在编写一个要求用户登录的Web应用程序。 我的公司有一个Active Directory服务器,我想为此目的使用它。 但是,我在使用Springvalidation用户凭据时遇到问题。 我正在使用Spring Security 3.2.2,Spring Ldap 2.0.1和Java 1.7。 Web应用程序启动良好,针对InMemory-Authentication的身份validation也运行良好,因此我的应用程序的其余部分似乎配置正确。 这是我的配置: @Configuration @EnableWebSecurity public class LdapConfig extends WebSecurityConfigurerAdapter { @Bean public ActiveDirectoryLdapAuthenticationProvider activeDirectoryLdapAuthenticationProvider() { val provider = new ActiveDirectoryLdapAuthenticationProvider(“my.domain”, “ldap://LDAP_ID:389/OU=A_GROUP,DC=domain,DC=tld”); provider.setConvertSubErrorCodesToExceptions(true); provider.setUseAuthenticationRequestCredentials(true); provider.setUseAuthenticationRequestCredentials(true); return provider; } @Bean public LoggerListener loggerListener() { return new LoggerListener(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(activeDirectoryLdapAuthenticationProvider()); […]

检测使用Java登录计算机的用户

我想开发一个可以检测登录Window Domain的用户的Java应用程序。 这些凭据将用于登录Java应用程序。 我怎样才能做到这一点? 谢谢!

具有错误的Active Directory Ldap凭据的会话/ Redis序列化错误的Spring启动

您好我是Spring和Java的新手,我正在尝试实现本教程中描述的Gateway身份validation服务器https://spring.io/guides/tutorials/spring-security-and-angular-js/ 我让一切正常,然后尝试对我们公司的Ldap服务器实施身份validation。 如果我使用有效的用户名和密码,它可以工作。 当我使用无效凭据时,应用程序错误。 我没有工作,所以我没有确切的错误,但它返回一个ldap错误(com.sun.jndi.ldap.LdapCtx),Redis正在尝试序列化它。 我的配置中是否缺少某些内容。 根据我的阅读,我认为我应该寻找一种方法来包装/扩展类并实现Serializable,但我不确定使用Spring Boot执行此操作的方法最少。 任何帮助是极大的赞赏。 谢谢, Mike Kowalski PS我一直在动态语言和框架中工作到目前为止(Javascript / Node,Php / Laravel) 以下是我认为安全配置的相关部分: @Configuration @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .formLogin() .defaultSuccessUrl(“/”) .loginPage(“/login”) .permitAll() .and() .logout() .logoutSuccessUrl(“/logout”) .permitAll(); http .authorizeRequests() .antMatchers(“/login”).permitAll() .anyRequest().authenticated() .and() .csrf().csrfTokenRepository(csrfTokenRepository()) .and() .addFilterAfter(csrfHeaderFilter(), CsrfFilter.class); } @Override protected […]

使用Java查找简单的Active Directory信息

这是我的第一篇文章,所以请保持温柔。 我最近开始在工作中使用Powershell来更改AD组,查找AD信息等但是我缺乏我非常喜欢Java的GUI。 是否有一种简单的方法(或代码示例),我输入目标主机名,然后返回我要求的详细信息。 AD会员组,帐户信息等? 我的Java知识并不像我的Powershell那样伟大,因此尽可能多的帮助会真正得到理解。 谢谢

校验和失败:Kerberos / Spring / Active Directory(2008)

我们无法使用Kerberos / AD身份validation来使用Spring Web应用程序,我认为该问题与Kerberos票证和Active Directory域function级别的加密类型有关。 基本设置是: 雄猫7 Java 1.6(29) Windows Server 2008 R2 spring3.0 Spring Security Kerberos / Spnego扩展M2详见: http : //blog.springsource.com/2009/09/28/spring-security-kerberos/ 我有一个环境,其中Active Directory域function级别是Windows Server 2003,一切正常,如果客户端登录到域,则客户端按预期进行身份validation。 使用kerbtray检查此环境中的票证我可以看到它们都具有票证加密类型和密钥加密类型“RSADSI RC4-HMAC”。 我有一个function级别为Windows Server 2008的新域,这是身份validation不起作用的地方。 尝试validation票证时返回的应用程序错误是: Kerberos validation not successful… Caused by: GSSException: Failure unspecified at GSS-API level (Mechanism level: Checksum failed) at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Unknown Source) at sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source) at […]

检测使用Java Web应用程序登录计算机的用户

我想开发一个可以检测登录Window Domain的用户的Java应用程序。 这些凭据将用于登录在Tomcat上运行的Java应用程序。 我怎样才能做到这一点? 我想知道远程用户访问我的网络应用程序。 此用户登录到活动目录 谢谢!

Java LDAP – 确定给定组中的用户是否?

我们使用Java LDAP API通过LDAP将用户登录到Active Directory。 我们希望增强登录function,以进一步检查用户是否在给定的AD组中。 有谁知道如何做到这一点? 当前代码: import javax.naming.*; import javax.naming.ldap.*; LdapContext ctx = null; Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY,”com.sun.jndi.ldap.LdapCtxFactory”); env.put(Context.SECURITY_AUTHENTICATION,”simple”); env.put(Context.PROVIDER_URL, Config.get(“ldap-url”)); try { Control[] connCtls = new Control[] {new FastBindConnectionControl()}; ctx = new InitialLdapContext(env, connCtls); ctx.addToEnvironment(Context.SECURITY_PRINCIPAL, “DOMAIN\\” + username); ctx.addToEnvironment(Context.SECURITY_CREDENTIALS, password); ctx.reconnect(connCtls); /* TODO: Only return true if user is in group […]