Alfresco AuthenticationService.getCurrentUserName()总是返回admin?

时间:2014-06-25 20:17:41

标签: alfresco

我正在尝试使用

获取在露天用户的用户名
String name = serviceRegistry.getAuthenticationService().getCurrentUser();

但无论登录哪个用户,它都会返回管理员。

然后我试了

String name = AuthenticationUtil.getFullyAuthenticatedUser();

它还会为所有用户返回admin。

我用Google搜索没有任何成功。这是露天的错误还是我需要照顾别的东西才能得到合适的用户名?

或者还有其他方法可以获取当前登录的用户名吗?

1 个答案:

答案 0 :(得分:4)

String name = AuthenticationUtil.getFullyAuthenticatedUser();

是获取当前用户的userName的正确方法。

每个webscript都有一个描述符,您可以在其中配置执行webscript所需的身份验证:http://docs.alfresco.com/4.2/references/api-wsdl-authentication.html

通常,您将使用<authentication>user</authentication>

露天仓库中有两个不同的'runtimes'可用于执行webscript:

    使用HTTP基本身份验证的
  1. / alfresco / s / ...(长版本/露天/服务)
  2. / alfresco / wcs / ...(长版/ alfresco / wcservice)使用Alfresco的WebClient(Alfresco Explorer)身份验证。