AnsweredAssumed Answered

The method createAuthentication(String, char[]) is undefined

Question asked by robertmarkbram on Jun 2, 2010
Latest reply on Jun 25, 2010 by robertmarkbram
Hi All,

I am using Alfresco-Community-3.3 and am trying out the following example code from Jeff Potts Alfresco Developer Guide:

// client-extensions/src/java/com/someco/module/BootstrapAuthorityCreator.java
// create tuser1, tuser2, tuser3, tuser4
if(!authenticationService.authenticationExists("tuser1")) {
  authenticationService.createAuthentication("tuser1", "password".toCharArray());
  if (logger.isDebugEnabled()) logger.debug("Created tuser1 auth");
}

But I get this error:

The method createAuthentication(String, char[]) is undefined for the type AuthenticationService

And indeed when I look at the javadocs for org.alfresco.service.cmr.security.AuthenticationService there is no createAuthentication() method. It seems to have been moved into org.alfresco.service.cmr.security.MutableAuthenticationService. So, I changed authenticationService into a MutableAuthenticationService:

// private AuthenticationService authenticationService;
private MutableAuthenticationService authenticationService;

You also need to modify the signature of setAuthenticationService().

Rob
:)

Outcomes