cancel
Showing results for 
Search instead for 
Did you mean: 

Access Alfresco Repo from Java Backed Share Webscript

redtreetom
Champ in-the-making
Champ in-the-making
Version :Enterprise - v4.1.1 (.3 61) (Trial)

So i have created a java backed webscript.

<bean id="webscript.control-panel.sign-control.get" class="be.redtree.webscript.View" parent="webscript"></bean>
<webscript>
   <shortname>Admin Console Manage Signatures</shortname>
   <description>Administration Console - Manage Signatures</description>
   <url>/extras/components/console/manage-signatures</url>
   <family>admin-console</family>
</webscript>

public class View extends DeclarativeWebScript {

   private static final Logger sLog = Logger.getLogger(View.class);

   @Override
   protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {

Map<String, Object> model = new HashMap<String, Object>();
      model.put("demo", "Happy coding! Smiley Very Happy");
      return model;
}

This works fine and it post as desired, However i am now trying to access the alfresco repository.
Please note that i cannot use CMIS since i have to change users.

So im left with the rest api or the remote services.
Rest requires the alf ticket and the remote services require username/password.

What is the best way to do this ?

              
 String ticket = req.getParameter("ticket");
      sLog.error("ticket 0 : "+ticket);
      
      ticket = AuthenticationUtils.getTicket();
      sLog.error("ticket 1 : "+ticket);
      
      ticket = req.getParameter("alfticket");
      sLog.error("ticket 2 : "+ticket);

                AuthenticationDetails authenticationDetails = AuthenticationUtils.getAuthenticationDetails();

will always return null.

Lost of posts say to use javascript, but this not an option for me.

Any advice ?
1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
Web scripts can run on the Share tier as well as the Repository tier. It looks like your web script is running on the Share tier. Is your web script being invoked within the context of the Share web application? If so, you do not need to worry about authentication–when your Share tier web script invokes a web script on the Repository tier, the framework will handle the authentication for you.

Jeff