Search in sources :

Example 1 with UserRegistrationConfig

use of org.forgerock.selfservice.stages.registration.UserRegistrationConfig in project OpenAM by OpenRock.

the class UserRegistrationConfigProvider method getServiceConfig.

@Override
public ProcessInstanceConfig getServiceConfig(UserRegistrationConsoleConfig config, Context context, String realm) {
    List<StageConfig> stages = new ArrayList<>();
    if (config.isCaptchaEnabled()) {
        stages.add(new CaptchaStageConfig().setRecaptchaSiteKey(config.getCaptchaSiteKey()).setRecaptchaSecretKey(config.getCaptchaSecretKey()).setRecaptchaUri(config.getCaptchaVerificationUrl()));
    }
    if (config.isEmailEnabled()) {
        String serverUrl = config.getEmailVerificationUrl() + "&realm=" + realm;
        stages.add(new VerifyEmailAccountConfig().setEmailServiceUrl("/email").setIdentityEmailField(config.getEmailAttributeName()).setSubjectTranslations(config.getSubjectTranslations()).setMessageTranslations(config.getMessageTranslations()).setMimeType("text/html").setVerificationLinkToken("%link%").setVerificationLink(serverUrl));
    }
    stages.add(new UserDetailsConfig().setIdentityEmailField(config.getEmailAttributeName()));
    if (config.isKbaEnabled()) {
        stages.add(new SecurityAnswerDefinitionConfig(new KbaConfig()).setQuestions(config.getSecurityQuestions()).setNumberOfAnswersUserMustSet(config.getMinimumAnswersToDefine()).setKbaPropertyName("kbaInfo"));
    }
    stages.add(new UserRegistrationConfig().setIdentityServiceUrl("/users"));
    String secret = SystemProperties.get(Constants.ENC_PWD_PROPERTY);
    JwtTokenHandlerConfig jwtTokenConfig = new JwtTokenHandlerConfig().setSharedKey(secret).setKeyPairAlgorithm("RSA").setKeyPairSize(1024).setJweAlgorithm(JweAlgorithm.RSAES_PKCS1_V1_5).setEncryptionMethod(EncryptionMethod.A128CBC_HS256).setJwsAlgorithm(JwsAlgorithm.HS256).setTokenLifeTimeInSeconds(config.getTokenExpiry());
    return new ProcessInstanceConfig().setStageConfigs(stages).setSnapshotTokenConfig(jwtTokenConfig).setStorageType(StorageType.STATELESS);
}
Also used : SecurityAnswerDefinitionConfig(org.forgerock.selfservice.stages.kba.SecurityAnswerDefinitionConfig) CaptchaStageConfig(org.forgerock.selfservice.stages.captcha.CaptchaStageConfig) VerifyEmailAccountConfig(org.forgerock.selfservice.stages.email.VerifyEmailAccountConfig) UserRegistrationConfig(org.forgerock.selfservice.stages.registration.UserRegistrationConfig) UserDetailsConfig(org.forgerock.selfservice.stages.user.UserDetailsConfig) JwtTokenHandlerConfig(org.forgerock.selfservice.stages.tokenhandlers.JwtTokenHandlerConfig) ArrayList(java.util.ArrayList) KbaConfig(org.forgerock.selfservice.stages.kba.KbaConfig) CaptchaStageConfig(org.forgerock.selfservice.stages.captcha.CaptchaStageConfig) StageConfig(org.forgerock.selfservice.core.config.StageConfig) ProcessInstanceConfig(org.forgerock.selfservice.core.config.ProcessInstanceConfig)

Aggregations

ArrayList (java.util.ArrayList)1 ProcessInstanceConfig (org.forgerock.selfservice.core.config.ProcessInstanceConfig)1 StageConfig (org.forgerock.selfservice.core.config.StageConfig)1 CaptchaStageConfig (org.forgerock.selfservice.stages.captcha.CaptchaStageConfig)1 VerifyEmailAccountConfig (org.forgerock.selfservice.stages.email.VerifyEmailAccountConfig)1 KbaConfig (org.forgerock.selfservice.stages.kba.KbaConfig)1 SecurityAnswerDefinitionConfig (org.forgerock.selfservice.stages.kba.SecurityAnswerDefinitionConfig)1 UserRegistrationConfig (org.forgerock.selfservice.stages.registration.UserRegistrationConfig)1 JwtTokenHandlerConfig (org.forgerock.selfservice.stages.tokenhandlers.JwtTokenHandlerConfig)1 UserDetailsConfig (org.forgerock.selfservice.stages.user.UserDetailsConfig)1