Project: bamboo
Issue BAM-9680: Oauth Access Token and Plugin Manager option is broken when Bamboo integrate with LDAP with the cache attribute is set to false
Currently, if Bamboo integrated with LDAP using the atlassian-user.xml with the LDAP repository cache is set to false example shown below: {code} {code} With the cache is turn off, when user click on the *Oauth Access Token* and *Plugin Manage* option will throw the following exception and user will be direct to the login page: {code} 2011-09-02 18:04:56,842 ERROR [qtp33513127-17] [LDAPUserManagerReadOnly] Error retrieving user: 'zed2' from LDAP. com.atlassian.user.impl.RepositoryException: javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.jndi.ldap.LdapCtxFactory [Root exception is java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory not found from bundle [com.atlassian.oauth.atlassian-oauth-service-provider-plugin]] com.atlassian.user.impl.ldap.repository.DefaultLdapContextFactory.getLDAPContext(DefaultLdapContextFactory.java:91) com.atlassian.user.impl.ldap.search.DefaultLDAPUserAdaptor.search(DefaultLDAPUserAdaptor.java:70) com.atlassian.user.impl.ldap.search.DefaultLDAPUserAdaptor.search(DefaultLDAPUserAdaptor.java:54) com.atlassian.user.impl.ldap.LDAPUserManagerReadOnly.getUser(LDAPUserManagerReadOnly.java:70) com.atlassian.user.impl.delegation.DelegatingListUserManager.getUser(DelegatingListUserManager.java:71) sun.reflect.GeneratedMethodAccessor177.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) com.atlassian.crowd.integration.atlassianuser.DynamicDelegationAccessor$DelegatingInvocationHandler.invoke(DynamicDelegationAccessor.java:115) $Proxy16.getUser(Unknown Source) bucket.user.DefaultUserAccessor.getUser(DefaultUserAccessor.java:147) com.atlassian.bamboo.user.BambooUserManagerImpl.getUser(BambooUserManagerImpl.java:103) sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) $Proxy25.getUser(Unknown Source) com.atlassian.bamboo.user.authentication.BambooAuthenticator.getUser(BambooAuthenticator.java:48) com.atlassian.seraph.auth.DefaultAuthenticator.refreshPrincipalObtainedFromSession(DefaultAuthenticator.java:365) com.atlassian.seraph.auth.DefaultAuthenticator.getUserFromSession(DefaultAuthenticator.java:404) com.atlassian.seraph.auth.DefaultAuthenticator.getUser(DefaultAuthenticator.java:318) com.atlassian.seraph.auth.AbstractAuthenticator.getUser(AbstractAuthenticator.java:45) com.atlassian.seraph.auth.AbstractAuthenticator.getRemoteUser(AbstractAuthenticator.java:33) com.atlassian.sal.bamboo.user.BambooSalUserManager.getRemoteUsername(BambooSalUserManager.java:69) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58) org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56) org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) $Proxy239.getRemoteUsername(Unknown Source) com.atlassian.oauth.serviceprovider.internal.servlet.user.AccessTokensServlet.doGet(AccessTokensServlet.java:49) javax.servlet.http.HttpServlet.service(HttpServlet.java:707) javax.servlet.http.HttpServlet.service(HttpServlet.java:820) com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:42) javax.servlet.http.HttpServlet.service(HttpServlet.java:820) com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:52) javax.servlet.http.HttpServlet.service(HttpServlet.java:820) org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:534) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1351) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118) com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) com.atlassian.bamboo.filter.AccessLogFilter.doFilter(AccessLogFilter.java:66) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265) org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) com.atlassian.bamboo.filter.SeraphLoginFilter.doFilter(SeraphLoginFilter.java:74) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149) org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98) com.atlassian.bamboo.filter.BambooAcegiProxyFilter.doFilter(BambooAcegiProxyFilter.java:25) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) com.atlassian.bamboo.filter.LicenseFilter.doFilter(LicenseFilter.java:73) com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) com.atlassian.johnson.filters.AbstractJohnsonFilter.doFilter(AbstractJohnsonFilter.java:71) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:211) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:150) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:71) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:98) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170) com.atlassian.bamboo.persistence.BambooSessionInViewFilter.doFilterInternal(BambooSessionInViewFilter.java:31) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322) org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:473) org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:516) org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:921) org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:403) org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:184) org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:856) org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114) org.eclipse.jetty.server.Server.handle(Server.java:352) org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:596) org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1052) org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:590) org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212) org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426) org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510) org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34) org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40) org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450) java.lang.Thread.run(Unknown Source) Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.jndi.ldap.LdapCtxFactory [Root exception is java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory not found from bundle [com.atlassian.oauth.atlassian-oauth-service-provider-plugin]] javax.naming.spi.NamingManager.getInitialContext(Unknown Source) javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) javax.naming.InitialContext.init(Unknown Source) javax.naming.InitialContext.(Unknown Source) javax.naming.directory.InitialDirContext.(Unknown Source) com.atlassian.user.impl.ldap.repository.DefaultLdapContextFactory.getLDAPContext(DefaultLdapContextFactory.java:87)	... 137 more Caused by: java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory not found from bundle [com.atlassian.oauth.atlassian-oauth-service-provider-plugin] org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103) org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156) java.lang.ClassLoader.loadClass(Unknown Source) java.lang.Class.forName0(Native Method) java.lang.Class.forName(Unknown Source) com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)	... 143 more Caused by: java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772) org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73) org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690) java.lang.ClassLoader.loadClass(Unknown Source) org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:634) org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1594) org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:887) org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)	... 148 more {code} The current workaround is to set the LDAP repository cache="true" as shown below: {code} {code} The problem only happens with LDAP user only
Story points: 3