- // if (authenticatedBySelf.get())
- // return;
- // SecurityContext securityContext = SecurityContextHolder.getContext();
- // Authentication currentAuth = securityContext.getAuthentication();
- // if (currentAuth != null) {
- // if (!(currentAuth instanceof SystemAuthentication))
- // throw new ArgeoException(
- // "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);