繁体   English   中英

从Shibboleth IDP 3 MFA流中的先前身份验证中获取用户属性

[英]get user attributes from previous authn in Shibboleth IDP 3 MFA flow

我正在尝试为shibboleth idp 3构建一个两因素身份验证流。它是使用MFA流进行设置的,该流具有初始ldap身份验证,然后是基于外部authn流的2FA流。

如何从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);
            }
        //...
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM