public static AuthenticationStep build(OMElement authenticationStepOM) { AuthenticationStep authenticationStep = new AuthenticationStep(); OMElement member = (OMElement) iter.next(); if ("StepOrder".equals(member.getLocalName())) { authenticationStep.setStepOrder(Integer.parseInt(member.getText())); } else if ("SubjectStep".equals(member.getLocalName())) { if (member.getText() != null && member.getText().trim().length() > 0) { authenticationStep.setSubjectStep(Boolean.parseBoolean(member.getText())); authenticationStep.setAttributeStep(Boolean.parseBoolean(member.getText())); .toArray(new IdentityProvider[0]); authenticationStep .setFederatedIdentityProviders(federatedAuthenticatorConfigsArr); LocalAuthenticatorConfig[] localAuthenticatorConfigsArr = localAuthenticatorConfigsArrList .toArray(new LocalAuthenticatorConfig[0]); authenticationStep.setLocalAuthenticatorConfigs(localAuthenticatorConfigsArr);
private void validateLocalAuthenticatorConfig(List<String> validationMsg, Map<String, Property[]> allLocalAuthenticators, AtomicBoolean isAuthenticatorIncluded, AuthenticationStep authenticationStep) { for (LocalAuthenticatorConfig localAuth : authenticationStep.getLocalAuthenticatorConfigs()) { if (!allLocalAuthenticators.keySet().contains(localAuth.getName())) { validationMsg.add(String.format(AUTHENTICATOR_NOT_AVAILABLE, localAuth.getName())); } else if (!isAuthenticatorIncluded.get()) { Property[] properties = allLocalAuthenticators.get(localAuth.getName()); if (properties.length == 0) { isAuthenticatorIncluded.set(true); } else { for (Property property : properties) { if (!(IS_HANDLER.equals(property.getName()) && Boolean.valueOf(property.getValue()))) { isAuthenticatorIncluded.set(true); } } } } } }
public int compare(AuthenticationStep step1, AuthenticationStep step2) { return step1.getStepOrder() - step2.getStepOrder(); } };
private StepConfig createStepConfigurationObject(int stepOrder, AuthenticationStep authenticationStep) { StepConfig stepConfig = new StepConfig(); stepConfig.setOrder(stepOrder); stepConfig.setSubjectAttributeStep(authenticationStep.isAttributeStep()); stepConfig.setSubjectIdentifierStep(authenticationStep.isSubjectStep()); return stepConfig; }
|| authSteps[0].getLocalAuthenticatorConfigs() == null || authSteps[0].getLocalAuthenticatorConfigs().length != 1 || (authSteps[0].getFederatedIdentityProviders() != null && authSteps[0] .getFederatedIdentityProviders().length >= 1)) { String errorMessage = "Invalid local authentication configuration." + " For local authentication there can only be only one authentication step and only one local authenticator"; || authSteps[0].getFederatedIdentityProviders() == null || authSteps[0].getFederatedIdentityProviders().length != 1 || authSteps[0].getLocalAuthenticatorConfigs().length > 0) { String errorMessage = "Invalid federated authentication configuration." + " For federated authentication there can only be only one authentication step and only one federated authenticator"; IdentityProvider fedIdp = authSteps[0].getFederatedIdentityProviders()[0]; IdentityProvider[] federatedIdps = authStep.getFederatedIdentityProviders(); && (authStep.getLocalAuthenticatorConfigs() == null || authStep .getLocalAuthenticatorConfigs().length == 0)) { String errorMesssage = "Invalid authentication configuration." + "An authentication step should have at least one federated identity " storeStepPrepStmtz.setInt(2, authStep.getStepOrder()); storeStepPrepStmtz.setInt(3, applicationId); storeStepPrepStmtz.setString(4, authStep.isSubjectStep() ? "1" : "0"); storeStepPrepStmtz.setString(5, authStep.isAttributeStep() ? "1" : "0"); storeStepPrepStmtz.execute(); if (authStep.getLocalAuthenticatorConfigs() != null
if (authenticationStep == null || (authenticationStep.getFederatedIdentityProviders() == null && authenticationStep.getLocalAuthenticatorConfigs() == null)) { validationMsg.add("Some authentication steps do not have authenticators."); break; for (IdentityProvider idp : authenticationStep.getFederatedIdentityProviders()) { validateFederatedIdp(idp, isAuthenticatorIncluded, validationMsg, tenantDomain);
private void loadFederatedAuthenticators(AuthenticationStep authenticationStep, StepConfig stepConfig) { IdentityProvider[] federatedIDPs = authenticationStep.getFederatedIdentityProviders(); if (federatedIDPs != null) { // for each idp in the step for (IdentityProvider federatedIDP : federatedIDPs) { FederatedAuthenticatorConfig federatedAuthenticator = federatedIDP .getDefaultAuthenticatorConfig(); // for each authenticator in the idp String actualAuthenticatorName = federatedAuthenticator.getName(); // assign it to the step loadStepAuthenticator(stepConfig, federatedIDP, actualAuthenticatorName); } } }
|| authSteps[0].getLocalAuthenticatorConfigs() == null || authSteps[0].getLocalAuthenticatorConfigs().length != 1 || (authSteps[0].getFederatedIdentityProviders() != null && authSteps[0] .getFederatedIdentityProviders().length >= 1)) { String errorMessage = "Invalid local authentication configuration." + " For local authentication there can only be only one authentication step and only one local authenticator"; || authSteps[0].getFederatedIdentityProviders() == null || authSteps[0].getFederatedIdentityProviders().length != 1 || authSteps[0].getLocalAuthenticatorConfigs().length > 0) { String errorMessage = "Invalid federated authentication configuration." + " For federated authentication there can only be only one authentication step and only one federated authenticator"; IdentityProvider fedIdp = authSteps[0].getFederatedIdentityProviders()[0]; IdentityProvider[] federatedIdps = authStep.getFederatedIdentityProviders(); && (authStep.getLocalAuthenticatorConfigs() == null || authStep .getLocalAuthenticatorConfigs().length == 0)) { String errorMesssage = "Invalid authentication configuration." + "An authentication step should have at least one federated identity " storeStepPrepStmtz.setInt(2, authStep.getStepOrder()); storeStepPrepStmtz.setInt(3, applicationId); storeStepPrepStmtz.setString(4, authStep.isSubjectStep() ? "1" : "0"); storeStepPrepStmtz.setString(5, authStep.isAttributeStep() ? "1" : "0"); storeStepPrepStmtz.execute(); if (authStep.getLocalAuthenticatorConfigs() != null
protected StepConfig createStepConfigurationObject(int stepOrder, AuthenticationStep authenticationStep) { StepConfig stepConfig = new StepConfig(); stepConfig.setOrder(stepOrder); stepConfig.setSubjectAttributeStep(authenticationStep.isAttributeStep()); stepConfig.setSubjectIdentifierStep(authenticationStep.isSubjectStep()); return stepConfig; }
for (IdentityProvider idp : authenticationStep.getFederatedIdentityProviders()) { validateFederatedIdp(idp, isAuthenticatorIncluded, validationMsg, tenantDomain); for (LocalAuthenticatorConfig localAuth : authenticationStep.getLocalAuthenticatorConfigs()) { if (!allLocalAuthenticators.keySet().contains(localAuth.getName())) { validationMsg.add(String.format(AUTHENTICATOR_NOT_AVAILABLE, localAuth.getName()));
protected void loadFederatedAuthenticators(AuthenticationStep authenticationStep, StepConfig stepConfig, String tenantDomain) throws FrameworkException { IdentityProvider[] federatedIDPs = authenticationStep.getFederatedIdentityProviders(); if (federatedIDPs != null) { // for each idp in the step for (IdentityProvider federatedIDP : federatedIDPs) { FederatedAuthenticatorConfig federatedAuthenticator = federatedIDP.getDefaultAuthenticatorConfig(); //When loading the federated IDP configuration from default.xml file in service-providers, we need to // retrieve the federated IDP and load if (federatedAuthenticator == null) { try { federatedAuthenticator = IdentityProviderManager.getInstance() .getIdPByName(federatedIDP.getIdentityProviderName(), tenantDomain) .getDefaultAuthenticatorConfig(); } catch (IdentityProviderManagementException e) { throw new FrameworkException( "Failed to load the default authenticator for IDP : " + federatedIDP .getIdentityProviderName(), e); } } String actualAuthenticatorName = federatedAuthenticator.getName(); // assign it to the step loadStepAuthenticator(stepConfig, federatedIDP, actualAuthenticatorName); } } }
public static AuthenticationStep build(OMElement authenticationStepOM) { AuthenticationStep authenticationStep = new AuthenticationStep(); OMElement member = (OMElement) iter.next(); if ("StepOrder".equals(member.getLocalName())) { authenticationStep.setStepOrder(Integer.parseInt(member.getText())); } else if ("SubjectStep".equals(member.getLocalName())) { if (member.getText() != null && member.getText().trim().length() > 0) { authenticationStep.setSubjectStep(Boolean.parseBoolean(member.getText())); authenticationStep.setAttributeStep(Boolean.parseBoolean(member.getText())); .toArray(new IdentityProvider[0]); authenticationStep .setFederatedIdentityProviders(federatedAuthenticatorConfigsArr); LocalAuthenticatorConfig[] localAuthenticatorConfigsArr = localAuthenticatorConfigsArrList .toArray(new LocalAuthenticatorConfig[0]); authenticationStep.setLocalAuthenticatorConfigs(localAuthenticatorConfigsArr);
protected StepConfig createStepConfigurationObject(int stepOrder, AuthenticationStep authenticationStep) { StepConfig stepConfig = new StepConfig(); stepConfig.setOrder(stepOrder); stepConfig.setSubjectAttributeStep(authenticationStep.isAttributeStep()); stepConfig.setSubjectIdentifierStep(authenticationStep.isSubjectStep()); return stepConfig; }
public int compare(AuthenticationStep step1, AuthenticationStep step2) { return step1.getStepOrder() - step2.getStepOrder(); } };
protected void loadFederatedAuthenticators(AuthenticationStep authenticationStep, StepConfig stepConfig, String tenantDomain) throws FrameworkException { IdentityProvider[] federatedIDPs = authenticationStep.getFederatedIdentityProviders(); if (federatedIDPs != null) { // for each idp in the step for (IdentityProvider federatedIDP : federatedIDPs) { FederatedAuthenticatorConfig federatedAuthenticator = federatedIDP.getDefaultAuthenticatorConfig(); //When loading the federated IDP configuration from default.xml file in service-providers, we need to // retrieve the federated IDP and load if (federatedAuthenticator == null) { try { federatedAuthenticator = IdentityProviderManager.getInstance() .getIdPByName(federatedIDP.getIdentityProviderName(), tenantDomain) .getDefaultAuthenticatorConfig(); } catch (IdentityProviderManagementException e) { throw new FrameworkException( "Failed to load the default authenticator for IDP : " + federatedIDP .getIdentityProviderName(), e); } } String actualAuthenticatorName = federatedAuthenticator.getName(); // assign it to the step loadStepAuthenticator(stepConfig, federatedIDP, actualAuthenticatorName); } } }
protected void loadLocalAuthenticators(AuthenticationStep authenticationStep, StepConfig stepConfig) { LocalAuthenticatorConfig[] localAuthenticators = authenticationStep.getLocalAuthenticatorConfigs(); if (localAuthenticators != null) { IdentityProvider localIdp = new IdentityProvider(); localIdp.setIdentityProviderName(FrameworkConstants.LOCAL_IDP_NAME); // assign it to the step for (LocalAuthenticatorConfig localAuthenticator : localAuthenticators) { String actualAuthenticatorName = localAuthenticator.getName(); loadStepAuthenticator(stepConfig, localIdp, actualAuthenticatorName); } } }
authStep = authSteps.get(step); } else { authStep = new AuthenticationStep(); authStep.setStepOrder(stepInfoResultSet.getInt(1)); stepLocalAuth.put(step, new ArrayList<LocalAuthenticatorConfig>()); stepFedIdPAuthenticators.put(step, authStep.setSubjectStep("1".equals(stepInfoResultSet.getString(3))); authStep.setAttributeStep("1".equals(stepInfoResultSet.getString(4))); authStep.setLocalAuthenticatorConfigs( localAuthenticatorList.toArray(new LocalAuthenticatorConfig[localAuthenticatorList.size()])); fedIdpList[idpCount++] = idp; authStep.setFederatedIdentityProviders(fedIdpList);
stepOrder = authenticationStep.getStepOrder(); } catch (NumberFormatException e) { stepOrder++;
for (IdentityProvider idpProvider : authenticationStep.getFederatedIdentityProviders()) { if (StringUtils.equals(identityProvider.getIdentityProviderName(), idpProvider.getIdentityProviderName())) { throw new IdentityProviderManagementException( .equalsIgnoreCase(localAndOutboundAuthConfig.getAuthenticationType())) { IdentityProvider fedIdp = authSteps[0].getFederatedIdentityProviders()[0]; if (StringUtils.equals(fedIdp.getIdentityProviderName(), identityProvider .getIdentityProviderName())) { for (AuthenticationStep authStep : authSteps) { IdentityProvider[] federatedIdentityProviders = authStep.getFederatedIdentityProviders();
protected void loadLocalAuthenticators(AuthenticationStep authenticationStep, StepConfig stepConfig) { LocalAuthenticatorConfig[] localAuthenticators = authenticationStep.getLocalAuthenticatorConfigs(); if (localAuthenticators != null) { IdentityProvider localIdp = new IdentityProvider(); localIdp.setIdentityProviderName(FrameworkConstants.LOCAL_IDP_NAME); // assign it to the step for (LocalAuthenticatorConfig localAuthenticator : localAuthenticators) { String actualAuthenticatorName = localAuthenticator.getName(); loadStepAuthenticator(stepConfig, localIdp, actualAuthenticatorName); } } }