cancel
Showing results for 
Search instead for 
Did you mean: 

Getting TICKET

beginer
Champ in-the-making
Champ in-the-making
How can I get TICKET current user on the page http://127.0.0.1:8080/share/page/document-details for onward transmission to him webscript?
5 REPLIES 5

mitpatoliya
Star Collaborator
Star Collaborator
you can get the ticket with help of this webscript

http://localhost:8080/alfresco/service/api/login?u={username}&pw={password?}

and then you can use it for authentication. 😎

beginer
Champ in-the-making
Champ in-the-making
you can get the ticket with help of this webscript

http://localhost:8080/alfresco/service/api/login?u={username}&pw={password?}

and then you can use it for authentication. 😎

This query creates a new ticket, but most important that the user password is unknown. How to get the current ticket, for example in the file js?

mitpatoliya
Star Collaborator
Star Collaborator
well ticket will always be accessed  this way only because it is essential for authentication.
If this would be accessible anywhere without use name password it would be insecure.
So,I do not think that will be possible.

beginer
Champ in-the-making
Champ in-the-making
The user logs into the system and after button click on the page document-details in an applet runs a web script. How to get
parameter alf_ticket without re-entering the password?

beginer
Champ in-the-making
Champ in-the-making
SOLVED.  :idea:
protected Map<String, Object> executeImpl(WebScriptRequest request,
         WebScriptStatus status) {
       Map<String, Object> model = new HashMap<String, Object>(1);
       WebScriptServletRequest req = (WebScriptServletRequest) request;
       HttpServletRequest sReq = req.getHttpServletRequest();
       HttpSession session = sReq.getSession();
       String userId = (String)session.getAttribute(UserFactory.SESSION_ATTRIBUTE_KEY_USER_ID);
       String ticket = "";
       try {
            Connector connector = connectorService.getConnector(AlfrescoUserFactory.ALFRESCO_ENDPOINT_ID, userId, session);
            ticket = connector.getConnectorSession().getParameter(AlfrescoAuthenticator.CS_PARAM_ALF_TICKET);
        } catch (ConnectorServiceException e) {
            throw new RuntimeException(e);
        }
       model.put("ticket", ticket);
        return model;
   }