AnsweredAssumed Answered

authenticationComponent.setSystemUserAsCurrentUser()

Question asked by turgayz on Mar 28, 2006
Latest reply on Mar 28, 2006 by turgayz
Hi,
I was trying to create a node, but not from the web app - from within a scheduled job. So there is no "current user" where I am trying to create the node.

I had the trouble of authentication, and used the following first:

AuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
authenticationService.authenticate("admin", "admin".toCharArray());
But obviously this is not a good idea as the admin password should have been changed.
I noticed that (in BaseAlfrescoSpringTest class for example), the following is used:

AuthenticationComponent authenticationComponent = (AuthenticationComponent) this.applicationContext
                .getBean("authenticationComponent");
authenticationComponent.setSystemUserAsCurrentUser();
And I decided to use this in my class. But is a good idea to use this other than within a TestCase?

Outcomes