- // "There is already an authenticated subject: " + subject);
-
- String key = systemAuthenticationKey != null ? systemAuthenticationKey
- : System.getProperty(
- InternalAuthentication.SYSTEM_KEY_PROPERTY,
- InternalAuthentication.SYSTEM_KEY_DEFAULT);
- if (key == null)
- throw new ArgeoException("No system key defined");
- if (authenticationManager != null) {
- Authentication auth = authenticationManager
- .authenticate(new InternalAuthentication(key));
- securityContext.setAuthentication(auth);
- } else {
- try {
- // TODO test this
- if (bundleContext == null)
- throw new ArgeoException("bundleContext must be set");
- BundleContextCallbackHandler callbackHandler = new BundleContextCallbackHandler(
- bundleContext);
- LoginContext loginContext = new LoginContext(loginContextName,
- callbackHandler);
- loginContext.login();
- } catch (LoginException e) {
- throw new BadCredentialsException("Cannot authenticate");
- }
- }
- authenticatedBySelf.set(true);
+ // "System execution on an already authenticated thread: "
+ // + currentAuth + ", THREAD="
+ // + Thread.currentThread().getId());
+ // return;
+ // }
+ //
+ // String key = systemAuthenticationKey != null ?
+ // systemAuthenticationKey
+ // : System.getProperty(
+ // SystemAuthentication.SYSTEM_KEY_PROPERTY,
+ // InternalAuthentication.SYSTEM_KEY_DEFAULT);
+ // if (key == null)
+ // throw new ArgeoException("No system key defined");
+ // if (authenticationManager == null)
+ // throw new ArgeoException("Authentication manager cannot be null.");
+ // Authentication auth = authenticationManager
+ // .authenticate(new InternalAuthentication(key));
+ // securityContext.setAuthentication(auth);
+ //
+ // authenticatedBySelf.set(true);