cancel
Showing results for 
Search instead for 
Did you mean: 

AuthenticationUtils Assembly

ridgeway
Champ in-the-making
Champ in-the-making
Hi All,
This is my first attempt at programming a dashlet in Alfresco.

I want to grab the user name of the logged in user by calling AuthenticationUtil.setCurrentUser() in my jsp page

Do I need to import the AuthenticationUtil assembly by using <%@page import="…." before I can use this function? If I do, what is the name of the assembly?

Thanks in advance for any help.

Regards
10 REPLIES 10

mitpatoliya
Star Collaborator
Star Collaborator
Yes you need to import that
and API for accessing current user is not correct.
Please refer the following link.
http://dev.alfresco.com/resource/docs/java/web-service-client/org/alfresco/webservice/util/Authentic...

ridgeway
Champ in-the-making
Champ in-the-making
Thank you for your fast reply, Mits.

I've looked at the page that you suggested but it appears to be just a summary of the class. I can't see anywhere on the link where it says how to import this library into a jsp page. Perhaps I'm missing what you want to show me because of my inexperience. Am I looking in the right place?

Regards,

mrogers
Star Contributor
Star Contributor
<%@ page import="org.alfresco.repo.security.authentication.AuthenticationUtils" %>

ridgeway
Champ in-the-making
Champ in-the-making
Wonderful. Thank you. I'll give it a try.

Regards,

ridgeway
Champ in-the-making
Champ in-the-making
Hi,
Slight problem. I followed your direction and added <%@ page import="org.alfresco.repo.security.authentication.AuthenticationUtils" %> to the jsp page and got this error:

javax.faces.FacesException: Unable to compile class for JSP:
An error occurred at line: 7 in the generated java file
Only a type can be imported. org.alfresco.repo.security.authentication.AuthenticationUtils resolves to a package

Stacktrace:
caused by:
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 7 in the generated java file
Only a type can be imported. org.alfresco.repo.security.authentication.AuthenticationUtils resolves to a package

Did I do something wrong?

ridgeway
Champ in-the-making
Champ in-the-making
some additional information, I also tried:

<%@ page import="org.alfresco.webservice.util.AuthenticationUtils" %>

but that produced the same error.

Interestingly, if I search for an AuthenticationUtils file, I can't find it under the tomcat file structure.

Any ideas on what I'm missing or doing wrong?

Thanks in advance for any assistance.

Regards,

mitpatoliya
Star Collaborator
Star Collaborator
That class will be present in alfresco-web-service-client.jar.
Alfresco load that jar during startup so whenever we point that in any of JSP.
We should be able to find that class.
I am assuming you have java knowledge.
Your,jsp should be part of some wizard or dialog.

ridgeway
Champ in-the-making
Champ in-the-making
Thanks again for your reply, Mits.

However, at this point, I'm not doing anything with the Authenication library. I'm just trying to import it. Here's my code. The bolded line is what I'm adding and causes the error. If I omit this line everything works fine.
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
<%@ page import="org.alfresco.webservice.util.AuthenticationUtils" %>

<hSmiley TongueanelGrid columns="1" cellpadding="2" cellspacing="2" border="0" width="100%" style="background-colour:##ffffcc" rowClasses="alignTop" id="outer-panel">
  <hSmiley SurprisedutputText style="font-size: 14px; font-weight:bold; color:#004488" value="Topic" />

  <hSmiley TongueanelGrid columns="2" cellpadding="2" cellspacing="2" border="0" id="first-panel">
    <hSmiley TongueanelGroup id="first-text">
      <hSmiley SurprisedutputText value="first:" />
    </hSmiley TongueanelGroup>
    <hSmiley TongueanelGroup id="first-link">
      <a:actionLink href="http://www.xx/" target="new" style="font-weight:bold" value="8" />
    </hSmiley TongueanelGroup>
  </hSmiley TongueanelGrid>

</hSmiley TongueanelGrid>

Also, I've tried this as an alternative import:
<%@ page import="org.alfresco.repo.security.authentication.AuthenticationUtils" %>

ridgeway
Champ in-the-making
Champ in-the-making
Hi All,
It looks like this is a bug in Alfresco? If I had made a syntax error, I would have heard something, right?

This is disappointing for my client. They are just about to pay about $60K for Sharepoint licenses and they were excited about Alfresco being "10%" of that cost (as claimed on the Alfresco web site); however, my client won't move ahead unless I can demonstrate that this simple dashlet example works.

If I can make this work, they will continue with their Alfresco evaluation. Any final thoughts before they go back to their Sharepoint plans?

Thanks again for those that have provided help so far.