cancel
Showing results for 
Search instead for 
Did you mean: 

A valid SecureContext was not provided in the RequestContext

begunrom
Champ in-the-making
Champ in-the-making
I have created a custom nodelocator. I know the nodelocator class is working, as i already successfully used it in another module.
In my unit tests, i run a test with user admin.
At the line that starts with return, i get the following error.
<code>
@Override
   public NodeRef getNode(NodeRef arg0, Map<String, Serializable> arg1) {
      String name = cmcConfig.getProperty("cmcDataSpace");
//      NodeRef companyHome = nodeLocatorService1.getNode(CompanyHomeNodeLocator.NAME, null, null);
      NodeRef companyHome = companyHomeNodeLocator.getNode(null, null);

      logger.debug("FullyAuthenticatedUser = " + AuthenticationUtil.getFullyAuthenticatedUser());
      return nodeService.getChildByName(companyHome, ContentModel.ASSOC_CONTAINS, name);
   }
<\code>
<code>
2013-09-03 10:13:11,440  DEBUG [acegisecurity.intercept.AbstractSecurityInterceptor] [main] Authenticated: net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken@4628e929: Username: net.sf.acegisecurity.providers.dao.User@27e3a6bb: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_AUTHENTICATED; Password: [PROTECTED]; Authenticated: true; Details: net.sf.acegisecurity.providers.dao.User@27e3a6bb: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_AUTHENTICATED; Granted Authorities: ROLE_AUTHENTICATED
2013-09-03 10:13:11,456  DEBUG [acegisecurity.intercept.AbstractSecurityInterceptor] [main] Authorization successful
2013-09-03 10:13:11,456  DEBUG [acegisecurity.intercept.AbstractSecurityInterceptor] [main] RunAsManager did not change Authentication object
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 148.103 sec <<< FAILURE!
RepoStartupTest(be.cmc.sld.test.scheduledjobs.FindOutDatedNodesTest)  Time elapsed: 6.196 sec  <<< ERROR!
net.sf.acegisecurity.AuthenticationCredentialsNotFoundException: A valid SecureContext was not provided in the RequestContext
   at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.credentialsNotFound(AbstractSecurityInterceptor.java:481)
   at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:359)
   at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:159)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:69)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:433)
   at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:59)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at sun.proxy.$Proxy13.getChildByName(Unknown Source)
   at be.cmc.locators.CmcDataSpaceLocator.getNode(CmcDataSpaceLocator.java:43)
   at org.alfresco.repo.nodelocator.NodeLocatorServiceImpl.getNode(NodeLocatorServiceImpl.java:59)
   at be.cmc.testutil.CmcTestutil.getTestFolder(CmcTestutil.java:148)
   at be.cmc.sld.test.scheduledjobs.FindOutDatedNodesTest.RepoStartupTest(FindOutDatedNodesTest.java:59)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
   at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
   at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)


Results :

Tests in error:
  RepoStartupTest(be.cmc.sld.test.scheduledjobs.FindOutDatedNodesTest): A valid SecureContext was not provided in the RequestContext
<\code>


I have been browsing on the internet on this topic, but could not find anything that pointed me in the right direction.
I can debug it till i reach the proxy object.


Can anyone help?
Alfresco version : 4.2.c
1 REPLY 1

begunrom
Champ in-the-making
Champ in-the-making
Problem disappears if you remove the timeout from the test.

So
@Test   (timeout=500000) DOES NOT WORK

@Test WORKS.

Can anyone explain???? It must have something to do with the alfresco maven integration.