我正在尝试为shibboleth idp 3构建一个双因素身份验证流,它是用MFA流和初始ldap身份验证一起设置的,然后是基于外部authn流的我的2FA流。
如何从servlet中以前的ldap流中获取用户数据?似乎request.getAttribute(ExternalAuthentication.PRINCIPAL_NAME_KEY)等还没有设置好。文档表示,LDAP属性作为身份验证过程的一部分返回,并在LDAPResponseContext.中公开。如何访问servlet中的上下文?
我还试图使用属性解析器从AD用户配置文件中释放一个特定的值,但是我无法在servlet中找到这些值。有什么想法吗?
发布于 2019-09-11 10:40:54
我想出来了,也许其他人会觉得有用:
密码流使用主体名称填充c14n上下文,这对我来说就足够了。若要获取servlet中的主体名称,请执行以下操作:
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
try {
String authenticationKey = ExternalAuthentication.startExternalAuthentication(request);
// get userPrincipalName of previous authn
final ProfileRequestContext profileRequestContext = ExternalAuthentication.getProfileRequestContext(authenticationKey, request);
final SubjectCanonicalizationContext c14nContext = profileRequestContext.getSubcontext(SubjectCanonicalizationContext.class);
if (c14nContext != null && c14nContext.getPrincipalName() != null) {
usernameShib = c14nContext.getPrincipalName();
//Subject subjectShib = c14nContext.getSubject();
logger.info(usernameShib);
}
//...
}https://stackoverflow.com/questions/52281473
复制相似问题