将 LoginContext 作为凭据传递给 JCR(java 内容存储库)中的存储库登录

Posted

技术标签:

【中文标题】将 LoginContext 作为凭据传递给 JCR(java 内容存储库)中的存储库登录【英文标题】:Passing LoginContext as Credentials for Repository Login in JCR (java content Repository) 【发布时间】:2016-10-31 19:32:19 【问题描述】:

我一直在将 logincontext 对象作为凭据传递,以获取像这样的存储库登录会话

Repository repo = new Jcr(new Oak()).createRepository();
    final LoginContext lc= JaasAuthenticationTest.getlogincontext(); 
    Credentials credentials = new Credentials() 
        public LoginContext getLoginContext()  return lc; 
        ;
Session session = repo.login(credentials);

和 JaasAuthenticationTest 看起来像

    lc = new LoginContext("nikhil", new TestCallbackHandler(name, password));
    return lc;

但显示错误:

javax.jcr.LoginException: Login Failure: all modules ignored
at org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl.login(RepositoryImpl.java:262)
at org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl.login(RepositoryImpl.java:220)

【问题讨论】:

【参考方案1】:

你试过了吗:

session = repository.login(new SimpleCredentials("username", "password".toCharArray()));

【讨论】:

以上是关于将 LoginContext 作为凭据传递给 JCR(java 内容存储库)中的存储库登录的主要内容,如果未能解决你的问题,请参考以下文章

如何将用户凭据传递给 Web 服务?

将 NTLM 凭据传递给远程 Web 服务

如何将自定义凭据传递给 Spring Boot ldap

Worklight 将登录凭据传递给 iframed 服务器端内容

使用 JDBC 将自己制作的 Windows 凭据传递给 SQL Server

为啥 IIS 中的 Windows/集成身份验证不将用户凭据传递给 s-s-rS 和 SQL?