从 Shibboleth IDP 3 MFA 流中的先前 authn 获取用户属性



我正在尝试为 shibboleth idp 3 构建一个双因素身份验证流程。它是使用 MFA 流设置的,其中包含初始 ldap 身份验证,然后是我的 2FA 流,该流基于外部 authn 流。

如何从我的 servlet 中的前一个 ldap 流中获取用户数据?似乎request.getAttribute(ExternalAuthentication.PRINCIPAL_NAME_KEY)等还没有设置。文档说LDAP属性作为身份验证过程的一部分返回,并在LDAPResponseContext中公开。如何访问 servlet 中的上下文?

我还尝试使用属性解析器从 AD 用户配置文件中释放特定值,但我无法在我的 servlet 中找到这些值。有什么想法吗?

我想通了,也许其他人觉得它有帮助:

密码流使用主体名称填充 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);
}
//...
}

最新更新