Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEC-2664: ActiveDirectoryLdapAuthenticationProvider should wrap communication exceptions in InternalAuthenticationServiceException #2884

Closed
spring-projects-issues opened this issue Jun 23, 2014 · 6 comments
Assignees
Labels
in: ldap An issue in spring-security-ldap status: backported An issue that has been backported to maintenance branches status: duplicate A duplicate of another issue type: bug A general bug type: jira An issue that was migrated from JIRA

Comments

@spring-projects-issues
Copy link

Pradeep Agrawal (Migrated from SEC-2664) said:

Jun 23, 2014 2:53:43 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [default] in context with path [/myapp] threw exception
org.springframework.ldap.CommunicationException: myazuread.cloudapp.net:389; nested exception is javax.naming.CommunicationException: myazuread.cloudapp.net:389 [Root exception is java.net.UnknownHostException: myazuread.cloudapp.net]
at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:100)
at org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider.bindAsUser(ActiveDirectoryLdapAuthenticationProvider.java:170)
at org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider.doAuthentication(ActiveDirectoryLdapAuthenticationProvider.java:111)
at org.springframework.security.ldap.authentication.AbstractLdapAuthenticationProvider.authenticate(AbstractLdapAuthenticationProvider.java:61)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
at org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:94)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:194)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: javax.naming.CommunicationException: myazuread.cloudapp.net:389 [Root exception is java.net.UnknownHostException: myazuread.cloudapp.net]
at com.sun.jndi.ldap.Connection.(Connection.java:226)
at com.sun.jndi.ldap.LdapClient.(LdapClient.java:136)
at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1608)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2698)
at com.sun.jndi.ldap.LdapCtx.(LdapCtx.java:316)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:193)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:211)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:154)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:84)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
at javax.naming.InitialContext.init(InitialContext.java:242)
at javax.naming.ldap.InitialLdapContext.(InitialLdapContext.java:153)
at org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider$ContextFactory.createContext(ActiveDirectoryLdapAuthenticationProvider.java:311)
at org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider.bindAsUser(ActiveDirectoryLdapAuthenticationProvider.java:164)
... 29 more
Caused by: java.net.UnknownHostException: myazuread.cloudapp.net
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.(Socket.java:425)
at java.net.Socket.(Socket.java:208)
at com.sun.jndi.ldap.Connection.createSocket(Connection.java:368)
at com.sun.jndi.ldap.Connection.(Connection.java:203)
... 43 more

@spring-projects-issues
Copy link
Author

Pradeep Agrawal said:

if ActiveDirectoryLdapAuthenticationProvider fails then another provider (i.e authentication-provider/jdbc) should work which usage localhost database connection for username/password authentication.

@spring-projects-issues
Copy link
Author

Rob Winch said:

If an AuthenticationProvider fails in a way that is unrelated to user interactions (i.e. the LDAP server is down), then it should not continue to try other AuthenticationProvider instances. However, it should be wrapped in an InternalAuthenticationServiceException. See SEC-1919

@spring-projects-issues spring-projects-issues added in: ldap An issue in spring-security-ldap Open type: bug A general bug type: jira An issue that was migrated from JIRA labels Feb 5, 2016
@spring-projects-issues spring-projects-issues added this to the 4.0 Backlog milestone Feb 5, 2016
@rwinch rwinch modified the milestone: 4.0 Backlog Aug 15, 2016
@mlschechter
Copy link

Could you please let us know if there are any plans to address this? The above milestone was closed.

Thanks!

@rwinch
Copy link
Member

rwinch commented Sep 21, 2018

@mlschechter we haven't had time to address it. Would you be interested in providing a PR?

@mlschechter
Copy link

Our dependency on this logic has changed more than I thought, and this is not currently an issue for my team. Unfortunately, that reduces my flexibility in this area, so I'm unlikely to have bandwidth in the near future.

@rwinch rwinch removed the Open label May 3, 2019
@jzheaux jzheaux self-assigned this Nov 14, 2019
@jzheaux jzheaux added the status: ideal-for-contribution An issue that we actively are looking for someone to help us with label Nov 14, 2019
@jzheaux jzheaux removed their assignment Apr 14, 2020
@dadikovi
Copy link
Contributor

Hi! I would like to investigate this issue and send a proposal PR about it. Can I take it?

dadikovi added a commit to dadikovi/spring-security that referenced this issue Apr 19, 2020
…ication exceptions in InternalAuthenticationServiceException spring-projectsgh-2884
dadikovi added a commit to dadikovi/spring-security that referenced this issue Apr 23, 2020
…ication exceptions in InternalAuthenticationServiceException

CommunicationException are now wrapped in InternalAuthenticationServiceException

Closes spring-projectsgh-2884
dadikovi added a commit to dadikovi/spring-security that referenced this issue Apr 23, 2020
…ication exceptions in InternalAuthenticationServiceException

CommunicationException are now wrapped in InternalAuthenticationServiceException

Closes spring-projectsgh-2884
@rwinch rwinch closed this as completed in f7b33da Apr 24, 2020
@rwinch rwinch added this to the 5.4.0.M1 milestone Apr 24, 2020
@rwinch rwinch added status: duplicate A duplicate of another issue and removed status: ideal-for-contribution An issue that we actively are looking for someone to help us with labels Apr 24, 2020
rwinch pushed a commit that referenced this issue Apr 24, 2020
@spring-projects-issues spring-projects-issues added the status: backported An issue that has been backported to maintenance branches label Apr 24, 2020
@rwinch rwinch removed this from the 5.4.0.M1 milestone Apr 24, 2020
rwinch pushed a commit that referenced this issue Apr 24, 2020
rwinch pushed a commit that referenced this issue Apr 24, 2020
rwinch pushed a commit that referenced this issue Apr 24, 2020
jzheaux added a commit that referenced this issue Jun 25, 2020
- The test intentionally points to a non-existent LDAP server; on
some machines, this will hang indefinitely without a specified
timeout.

Issue gh-2884
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: ldap An issue in spring-security-ldap status: backported An issue that has been backported to maintenance branches status: duplicate A duplicate of another issue type: bug A general bug type: jira An issue that was migrated from JIRA
Projects
None yet
Development

No branches or pull requests

6 participants