public Object invoke(Object targetObject) throws NoSuchMethodException,
			IllegalAccessException, InvocationTargetException {

		if (principal != null) {
			Authentication request = createAuthenticationRequest(principal, credentials);
			request.setAuthenticated(false);
			SecurityContextHolder.getContext().setAuthentication(request);

			if (logger.isDebugEnabled()) {
				logger.debug("Set SecurityContextHolder to contain: " + request);
			}
		}

		try {
			return super.invoke(targetObject);
		}
		finally {
			SecurityContextHolder.clearContext();

			if (logger.isDebugEnabled()) {
				logger.debug("Cleared SecurityContextHolder.");
			}
		}
	}