AnsweredAssumed Answered

Alfresco SSO with Atlassian Crowd

Question asked by carbotex on Mar 16, 2010
Latest reply on May 25, 2010 by sjohnsto
Since I can not figure out how to use the external authentication chain to get Alfresco SSO with Atlassian Crowd, I created a filter based on the code found here . The filter detects a valid Crowd cookies, then gets the principal name, then logs the principal into Alfresco with the following code:


        UserTransaction tx = transactionService.getUserTransaction();
        NodeRef homeSpaceRef = null;
        User user;

        try {
            user = new User(userName, authService.getCurrentTicket(), personService.getPerson(crowdUser));
            homeSpaceRef = (NodeRef) nodeService.getProperty(personService.getPerson(crowdUser), ContentModel.PROP_HOMEFOLDER);
            if(homeSpaceRef == null) {
                    logger.warn("Home Folder is null for user '" + crowdUser + "', using company_home.");
                    homeSpaceRef = (NodeRef) nodeService.getRootNode(Repository.getStoreRef());
        } catch (Throwable ex) {

            try {
            } catch (Exception ex2) {
                    logger.error("Failed to rollback transaction", ex2);

            if (ex instanceof RuntimeException) {
                    throw (RuntimeException) ex;
            } else {
                    throw new RuntimeException("Failed to set authenticated user", ex);

        httpSess.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user);
   httpSess.setAttribute(LoginBean.LOGIN_EXTERNAL_AUTH, Boolean.TRUE);

        if(req.getRequestURI().endsWith(getLoginPage()) == true) {
            res.sendRedirect(req.getContextPath() + "/faces/jsp/browse/browse.jsp");
        else {
          fc.doFilter(req, res);

However, I can't use the same code to log into Alfresco Share. Below is the code to log user into Alfresco Share programmatically, but it requires password.

         UserFactory userFactory = FrameworkHelper.getUserFactory();
         boolean authenticated = userFactory.authenticate(req, userName, "mypassword123!");
         if (authenticated) {
             AuthenticationUtil.login(req, res, userName);

Is there a similar solution to Alfresco Explorer where I can log user into Alfresco Share ONLY with their username?