Search in sources :

Example 1 with HOTPService

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);
}
Also used : AMIdentity(com.sun.identity.idm.AMIdentity) AMIdentityRepository(com.sun.identity.idm.AMIdentityRepository) HOTPService(com.sun.identity.authentication.modules.hotp.HOTPService) ResourceBundle(java.util.ResourceBundle)

Example 2 with HOTPService

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);
}
Also used : HOTPParams(com.sun.identity.authentication.modules.hotp.HOTPParams) HOTPService(com.sun.identity.authentication.modules.hotp.HOTPService) ResourceBundle(java.util.ResourceBundle)

Aggregations

HOTPService (com.sun.identity.authentication.modules.hotp.HOTPService)2 ResourceBundle (java.util.ResourceBundle)2 HOTPParams (com.sun.identity.authentication.modules.hotp.HOTPParams)1 AMIdentity (com.sun.identity.idm.AMIdentity)1 AMIdentityRepository (com.sun.identity.idm.AMIdentityRepository)1