【问题标题】:Testing user account alfresco CMIS if exist测试用户帐户 alfresco CMIS(如果存在)
【发布时间】:2016-08-01 08:55:53
【问题描述】:

我在一个JavaEE 项目中工作,我只想看看用户是否使用usernamepassword 登录在Alfresco 中有一个帐户,我使用getSession 方法但是它如果usernamepassword 错误(不存在),则不会返回。

private static Session getSession(String serverUrl, String username, String password) {
    SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
    Map<String, String> params = new HashMap<>();
    params.put(SessionParameter.USER, username);
    params.put(SessionParameter.PASSWORD, password);
    params.put(SessionParameter.ATOMPUB_URL, serverUrl);
    params.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
    List<Repository> repos = sessionFactory.getRepositories(params);
    if (repos.isEmpty()) {
        System.out.println(" repository doesn't exist ");
        throw new RuntimeException("Server has no repositories!");
    }
    return repos.get(0).createSession();
}                     

谢谢

【问题讨论】:

    标签: java jakarta-ee alfresco cmis


    【解决方案1】:

    经过多次研究,我发现Rest Api 对应于Alfresco

    GET /alfresco/service/api/people/{userName} 
    

    对于我的情况,我使用它并为我工作

    您可以在此链接https://wiki.alfresco.com/wiki/Repository_RESTful_API_Reference 中找到更多信息(如何添加人员,如何检查某人是否为私人网站的成员......)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-27
      • 1970-01-01
      • 1970-01-01
      • 2016-06-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多