我想编写一个自定义联合身份验证器。原因是我想从多个数据源检索声明,并将它们作为SAML响应中的属性包含在我的应用程序中。 我看着一个自定义的要求处理:WSO2 Identity Server - 自定义SAMLSSOAuthenticator
http://pushpalankajaya.blogspot.ie/2014/07/adding-custom-claims-to-saml-response.html
遗憾的是,登录直接到外部IDP时,定制的要求处理,不得被调用。
要创建自定义SAMLSSOAuthenticator,我创建了一个自定义类:
public class CustomSAMLSSOAuthenticator extends SAMLSSOAuthenticator implements FederatedApplicationAuthenticator {
@Override
protected void processAuthenticationResponse(final HttpServletRequest request, final HttpServletResponse response,
final AuthenticationContext context) throws AuthenticationFailedException {
}
@Override
public String getName() {
return "CustomSAMLSSOAuthenticator";
}
@Override
public String getFriendlyName() {
return "custom-samlsso";
}
}
然后我注册的OSGi类作为一个AbstractApplicationAuthenticator。我可以在工作日志看到这个注册:
DEBUG {org.wso2.carbon.identity.application.authentication.framework.internal.FrameworkServiceComponent} - Added application authenticator : CustomSAMLSSOAuthenticator
然后我让IS_HOME /库/ conf目录/安全/应用authentication.xml变为$:
<AuthenticatorNameMapping name="CustomSAMLSSOAuthenticator" alias="firecrest-samlsso" />
...
<AuthenticatorConfig name="CustomSAMLSSOAuthenticator" enabled="true">
和我删除参考SAMLSSOAuthenticator从文件。
从Mgmt控制台,当为我的服务提供者添加高级认证配置并选择联合认证器时,我期待看到选项custom-samlsso,但我只获得samlsso,并且在登录到外部IDP时,使用SAMLSSOAuthenticator而不是CustomSAMLSSOAuthenticator处理。
我也注意到在IdPManagementUIUtil类,有SAMLSSOAuthenticator的一些硬编码这可能表明什么,我试图做的是不支持的:
private static void buildSAMLAuthenticationConfiguration(IdentityProvider fedIdp,
Map<String, String> paramMap) throws IdentityApplicationManagementException {
FederatedAuthenticatorConfig saml2SSOAuthnConfig = new FederatedAuthenticatorConfig();
saml2SSOAuthnConfig.setName("SAMLSSOAuthenticator");
saml2SSOAuthnConfig.setDisplayName("samlsso");
...
}
任何想法我做错了吗?