There is a very interesting post over at the Salesforce.com blog with sample code for integrating Salesforce.com's session ID and server URL with composite applications. I never thought about this approach before but it may sure come in handy in the future.
Salesforce JWT Bearer Flow
Implement the JWT Bearer flow with a Salesforce Connected app...