cancel
Showing results for 
Search instead for 
Did you mean: 

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

robertmarkbram
Champ in-the-making
Champ in-the-making
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
Smiley Happy
2 REPLIES 2

rwilson1982
Champ in-the-making
Champ in-the-making
Thank you very much for posting this  Smiley Very Happy

I'm just getting in to developing for Alfresco and with Java (I have C# development background) and this was most helpful in getting me off the ground.

robertmarkbram
Champ in-the-making
Champ in-the-making
You're welcome. Smiley Happy

Rob
Smiley Happy