There are a couple of methods via the Partner API that can be used to end active Sessions.
- logout()
"Ends the session of the logged-in user."
- invalidateSessions()
"Ends one or more sessions specified by a sessionId."
Using these with your current Salesforce Session Id will
kick out both users logged in via a web browser and those active via the API.
You can grab the session Id from an active web session with anonymous apex in the developer console:
String sessionID = UserInfo.getSessionId();
System.debug(sessionID);
I tried the following test:
- Login via the web interface
- Get the Session Id as above
- Use the Session Id to connect via the Partner API
- Call logout via the Partner API
- Attempting to reconnect with the prior Session Id via the Partner API results in a INVALID_SESSION_ID (as expected)
- Clicking on the home tab in the web interface redirects to the login page.
So, if you are sharing the same session id you definitely logout all users who are using it. You can use this to simulate a Session timeout by invalidating a session
However, if you establish a session directly via the Partner API using stored credentials you get a different session Id to a user who logged in via the web interface.
Eclipse will be using a different Session Id to users who logged in via the web interface. Also, I suspect that if Eclipse encounters an invalid session response it will just re-establish a new session with the stored credentials and carry on transparently to the user.