jaas/src/main/java/com/yubico/jaas/YubikeyLoginModule.java
public void initialize(Subject newSubject, CallbackHandler newCallbackHandler,
			Map<String, ?> sharedState, Map<String, ?> options) {

		log.debug("Initializing YubikeyLoginModule");
		this.subject = newSubject;
		this.callbackHandler = newCallbackHandler;

		/* Yubico verification client */
		Integer clientId = Integer.parseInt(options.get(OPTION_YUBICO_CLIENT_ID).toString());
        String clientKey = options.get(OPTION_YUBICO_CLIENT_KEY).toString();
		this.yc = YubicoClient.getClient(clientId, clientKey);
		
		/* Realm of principals added after authentication */
		if (options.containsKey(OPTION_YUBICO_ID_REALM)) {
			this.idRealm = options.get(OPTION_YUBICO_ID_REALM).toString();
		}

		/* Should this JAAS module be ignored when no OTPs are supplied? */
		if (options.containsKey(OPTION_YUBICO_SOFT_FAIL_NO_OTPS)) {
			if ("true".equals(options.get(OPTION_YUBICO_SOFT_FAIL_NO_OTPS).toString())) {
				this.soft_fail_on_no_otps = true;
			}
		}
		
		/* Should this JAAS module uses j_otp form to pick up otp */
		if (options.containsKey(OPTION_YUBICO_JACC)) {
			if ("true".equals(options.get(OPTION_YUBICO_JACC).toString())) {
				this.jacc = true;
			}
		}

		/* User-provided URLs to the Yubico validation service, separated by "|". */
		if (options.containsKey(OPTION_YUBICO_WSAPI_URLS)) {
			String in = options.get(OPTION_YUBICO_WSAPI_URLS).toString();
			String l[] = in.split("\\|");
			this.yc.setWsapiUrls(l);
		}
		
		if (options.containsKey(OPTION_YUBICO_SYNC_POLICY)) {
			this.yc.setSync(Integer.parseInt(options.get(OPTION_YUBICO_SYNC_POLICY).toString()));
		}

		/* Instantiate the specified usermap implementation. */
                String usermap_class_name = null;
                if (options.containsKey(OPTION_YUBICO_USERMAP_CLASS)) {
                    usermap_class_name = options.get(OPTION_YUBICO_USERMAP_CLASS).toString();
                } else {
                    usermap_class_name = "com.yubico.jaas.impl.YubikeyToUserMapImpl"; // Default implementation
                }
                try {
                    log.debug("Trying to instantiate {}",usermap_class_name);
                    this.ykmap = (YubikeyToUserMap) Class.forName(usermap_class_name).newInstance();
                    this.ykmap.setOptions(options);
                } catch (ClassNotFoundException ex) {
                    log.error("Could not create usermap from class " + usermap_class_name, ex);
                } catch (InstantiationException ex) {
                    log.error("Could not create usermap from class " + usermap_class_name, ex);
                } catch (IllegalAccessException ex) {
                    log.error("Could not create usermap from class " + usermap_class_name, ex);
                }
	}
public void initialize(Subject newSubject, CallbackHandler newCallbackHandler,
			Map<String, ?> sharedState, Map<String, ?> options) {

		log.debug("Initializing YubikeyLoginModule");
		this.subject = newSubject;
		this.callbackHandler = newCallbackHandler;

		/* Yubico verification client */
		Integer clientId = Integer.parseInt(options.get(OPTION_YUBICO_CLIENT_ID).toString());
        String clientKey = options.get(OPTION_YUBICO_CLIENT_KEY).toString();
		this.yc = YubicoClient.getClient(clientId, clientKey);
		
		/* Realm of principals added after authentication */
		if (options.containsKey(OPTION_YUBICO_ID_REALM)) {
			this.idRealm = options.get(OPTION_YUBICO_ID_REALM).toString();
		}

		/* Should this JAAS module be ignored when no OTPs are supplied? */
		if (options.containsKey(OPTION_YUBICO_SOFT_FAIL_NO_OTPS)) {
			if ("true".equals(options.get(OPTION_YUBICO_SOFT_FAIL_NO_OTPS).toString())) {
				this.soft_fail_on_no_otps = true;
			}
		}
		
		/* Should this JAAS module uses j_otp form to pick up otp */
		if (options.containsKey(OPTION_YUBICO_JACC)) {
			if ("true".equals(options.get(OPTION_YUBICO_JACC).toString())) {
				this.jacc = true;
			}
		}

		/* User-provided URLs to the Yubico validation service, separated by "|". */
		if (options.containsKey(OPTION_YUBICO_WSAPI_URLS)) {
			String in = options.get(OPTION_YUBICO_WSAPI_URLS).toString();
			String l[] = in.split("\\|");
			this.yc.setWsapiUrls(l);
		}
		
		if (options.containsKey(OPTION_YUBICO_SYNC_POLICY)) {
			this.yc.setSync(Integer.parseInt(options.get(OPTION_YUBICO_SYNC_POLICY).toString()));
		}

		/* Instantiate the specified usermap implementation. */
                String usermap_class_name = null;
                if (options.containsKey(OPTION_YUBICO_USERMAP_CLASS)) {
                    usermap_class_name = options.get(OPTION_YUBICO_USERMAP_CLASS).toString();
                } else {
                    usermap_class_name = "com.yubico.jaas.impl.YubikeyToUserMapImpl"; // Default implementation
                }
                try {
                    log.debug("Trying to instantiate {}",usermap_class_name);
                    this.ykmap = (YubikeyToUserMap) Class.forName(usermap_class_name).newInstance();
                    this.ykmap.setOptions(options);
                } catch (ClassNotFoundException ex) {
                    log.error("Could not create usermap from class " + usermap_class_name, ex);
                } catch (InstantiationException ex) {
                    log.error("Could not create usermap from class " + usermap_class_name, ex);
                } catch (IllegalAccessException ex) {
                    log.error("Could not create usermap from class " + usermap_class_name, ex);
                }
	}
public void initialize ( Subject newSubject , CallbackHandler newCallbackHandler , Map < String , ? > sharedState , Map < String , ? > options ) { log . debug ( "Initializing YubikeyLoginModule" ) ; this . subject = newSubject ; this . callbackHandler = newCallbackHandler ; /* Yubico verification client */ Integer clientId = Integer . parseInt ( options . get ( OPTION_YUBICO_CLIENT_ID ) . toString ( ) ) ; String clientKey = options . get ( OPTION_YUBICO_CLIENT_KEY ) . toString ( ) ; this . yc = YubicoClient . getClient ( clientId , clientKey ) ; /* Realm of principals added after authentication */ if ( options . containsKey ( OPTION_YUBICO_ID_REALM ) ) { this . idRealm = options . get ( OPTION_YUBICO_ID_REALM ) . toString ( ) ; } /* Should this JAAS module be ignored when no OTPs are supplied? */ if ( options . containsKey ( OPTION_YUBICO_SOFT_FAIL_NO_OTPS ) ) { if ( "true" . equals ( options . get ( OPTION_YUBICO_SOFT_FAIL_NO_OTPS ) . toString ( ) ) ) { this . soft_fail_on_no_otps = true ; } } /* Should this JAAS module uses j_otp form to pick up otp */ if ( options . containsKey ( OPTION_YUBICO_JACC ) ) { if ( "true" . equals ( options . get ( OPTION_YUBICO_JACC ) . toString ( ) ) ) { this . jacc = true ; } } /* User-provided URLs to the Yubico validation service, separated by "|". */ if ( options . containsKey ( OPTION_YUBICO_WSAPI_URLS ) ) { String in = options . get ( OPTION_YUBICO_WSAPI_URLS ) . toString ( ) ; String l [ ] = in . split ( "\\|" ) ; this . yc . setWsapiUrls ( l ) ; } if ( options . containsKey ( OPTION_YUBICO_SYNC_POLICY ) ) { this . yc . setSync ( Integer . parseInt ( options . get ( OPTION_YUBICO_SYNC_POLICY ) . toString ( ) ) ) ; } /* Instantiate the specified usermap implementation. */ String usermap_class_name = null ; if ( options . containsKey ( OPTION_YUBICO_USERMAP_CLASS ) ) { usermap_class_name = options . get ( OPTION_YUBICO_USERMAP_CLASS ) . toString ( ) ; } else { usermap_class_name = "com.yubico.jaas.impl.YubikeyToUserMapImpl" ; // Default implementation } try { log . debug ( "Trying to instantiate {}" , usermap_class_name ) ; this . ykmap = ( YubikeyToUserMap ) Class . forName ( usermap_class_name ) . newInstance ( ) ; this . ykmap . setOptions ( options ) ; } catch ( ClassNotFoundException ex ) { log . error ( "Could not create usermap from class " + usermap_class_name , ex ) ; } catch ( InstantiationException ex ) { log . error ( "Could not create usermap from class " + usermap_class_name , ex ) ; } catch ( IllegalAccessException ex ) { log . error ( "Could not create usermap from class " + usermap_class_name , ex ) ; } }
/* (non-Javadoc)
@see javax.security.auth.spi.LoginModule#initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map)
/ * ( non - Javadoc )