我想編寫一個自定義聯合身份驗證器。原因是我想從多個數據源檢索聲明,並將它們作爲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");
...
}
任何想法我做錯了嗎?