use of com.sun.identity.authentication.modules.hotp.HOTPService in project OpenAM by OpenRock.
the class DevicePrintModule method init.
/**
* {@inheritDoc}
*/
@Override
public void init(Subject subject, Map sharedState, Map options) {
userName = (String) sharedState.get(getUserKey());
if (StringUtils.isEmpty(userName)) {
ResourceBundle bundle = amCache.getResBundle(AUTH_MODULE_NAME, getLoginLocale());
DEBUG.warning(bundle.getString("authModuleNotSetUpWithUsername"));
}
AMIdentityRepository amIdentityRepository = getAMIdentityRepository(getRequestOrg());
AMIdentity amIdentity = getIdentity();
HOTPService hotpService = moduleInitialiser.getHOTPService(getLoginLocale(), amCache, userName, amIdentityRepository, options);
devicePrintAuthenticationService = moduleInitialiser.getDevicePrintAuthenticationService(amIdentity, getHttpServletRequest(), hotpService, options);
}
use of com.sun.identity.authentication.modules.hotp.HOTPService in project OpenAM by OpenRock.
the class DevicePrintModuleInitialiser method getHOTPService.
/**
* Constructs an instance of the HOTPService.
*
* @param locale The user's locale.
* @param amCache An instance of the AMResourceBundleCache.
* @param userName The user's name.
* @param amIdentityRepo An instance of the AMIdentityRepository.
* @param options The authentication modules settings.
* @return The HOTPService instance.
*/
public HOTPService getHOTPService(Locale locale, AMResourceBundleCache amCache, String userName, AMIdentityRepository amIdentityRepo, Map<String, String> options) {
String gatewaySMSImplClass = CollectionHelper.getMapAttr(options, GATEWAY_SMS_IMPL_CLASS);
String codeValidityDuration = CollectionHelper.getMapAttr(options, CODE_VALIDITY_DURATION);
String codeLength = CollectionHelper.getMapAttr(options, CODE_LENGTH);
String codeDelivery = CollectionHelper.getMapAttr(options, CODE_DELIVERY);
String telephoneAttribute = CollectionHelper.getMapAttr(options, ATTRIBUTE_PHONE);
String carrierAttribute = CollectionHelper.getMapAttr(options, ATTRIBUTE_CARRIER);
String emailAttribute = CollectionHelper.getMapAttr(options, ATTRIBUTE_EMAIL);
if (DEBUG.messageEnabled()) {
DEBUG.message("HOTP.init() : " + "telephone attribute=" + telephoneAttribute);
DEBUG.message("HOTP.init() : " + "carrier attribute=" + carrierAttribute);
DEBUG.message("HOTP.init() : " + "email attribute=" + emailAttribute);
}
ResourceBundle bundle = amCache.getResBundle(AUTH_MODULE_NAME, locale);
if (DEBUG.messageEnabled()) {
DEBUG.message("HOTP.init() : " + "HOTP resouce bundle locale=" + locale);
}
HOTPParams hotpParams = new HOTPParams(gatewaySMSImplClass, Long.parseLong(codeValidityDuration), telephoneAttribute, carrierAttribute, emailAttribute, codeDelivery, options, Integer.parseInt(codeLength), bundle.getString("messageSubject"), bundle.getString("messageContent"), FROM_ADDRESS);
return new HOTPService(amIdentityRepo, userName, hotpParams);
}
Aggregations