use of org.forgerock.selfservice.stages.email.VerifyEmailAccountConfig in project OpenAM by OpenRock.
the class ForgottenPasswordConfigProvider method getServiceConfig.
@Override
public ProcessInstanceConfig getServiceConfig(ForgottenPasswordConsoleConfig 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()));
}
stages.add(new UserQueryConfig().setValidQueryFields(config.getValidQueryAttributes()).setIdentityIdField("/username").setIdentityUsernameField("/username").setIdentityEmailField("/" + config.getEmailAttributeName() + "/0").setIdentityServiceUrl("/users"));
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));
}
if (config.isKbaEnabled()) {
stages.add(new SecurityAnswerVerificationConfig(new KbaConfig()).setQuestions(config.getSecurityQuestions()).setKbaPropertyName("kbaInfo").setNumberOfQuestionsUserMustAnswer(config.getMinimumAnswersToVerify()).setIdentityServiceUrl("/users"));
}
stages.add(new ResetStageConfig().setIdentityServiceUrl("/users").setIdentityPasswordField("userPassword"));
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);
}
use of org.forgerock.selfservice.stages.email.VerifyEmailAccountConfig 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);
}
Aggregations