将 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 内容存储库)中的存储库登录的主要内容,如果未能解决你的问题,请参考以下文章
Worklight 将登录凭据传递给 iframed 服务器端内容