/* (non-Javadoc) * @see javax.security.auth.spi.LoginModule#initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map) */ public void initialize( Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) { if (bundleContext == null) { throw new IllegalStateException( "ProxyLoginModule not initialized. Init must be called prior any invocation."); } Map<String, ?> newOptions = new HashMap<String, Object>(options); String module = (String) newOptions.remove(PROPERTY_MODULE); if (module == null) { throw new IllegalStateException( "Option " + PROPERTY_MODULE + " must be set to the name of the factory service"); } String bundleId = (String) newOptions.remove(PROPERTY_BUNDLE); if (bundleId == null) { throw new IllegalStateException( "Option " + PROPERTY_BUNDLE + " must be set to the name of the factory service"); } Bundle bundle = bundleContext.getBundle(Long.parseLong(bundleId)); if (bundle == null) { throw new IllegalStateException("No bundle found for id " + bundleId); } try { target = (LoginModule) bundle.loadClass(module).newInstance(); } catch (Exception e) { throw new IllegalStateException( "Can not load or create login module " + module + " for bundle " + bundleId, e); } target.initialize(subject, callbackHandler, sharedState, newOptions); }
/* (non-Javadoc) * @see javax.security.auth.spi.LoginModule#commit() */ public boolean commit() throws LoginException { return target.commit(); }
/* (non-Javadoc) * @see javax.security.auth.spi.LoginModule#login() */ public boolean login() throws LoginException { return target.login(); }
/* (non-Javadoc) * @see javax.security.auth.spi.LoginModule#abort() */ public boolean abort() throws LoginException { return target.abort(); }