I believe this is what you're looking for:
function getCurrentUser() {
path = '/snoop';
var attributes = WL.Server.getActiveUser().attributes;
var token = "LtpaToken=" + attributes.get('LtpaToken');
var input = {
method : 'get',
returnedContentType : 'html',
headers: {"Cookie": token},
path : path
};
return WL.Server.invokeHttp(input);
}
This code snipped is from 5.0.3, so I think the syntax may have changed for getting the token from the attributes object in newer versions.
You may need to change:
var token = "LtpaToken=" + attributes.get('LtpaToken');
to:
var token = "LtpaToken=" + attributes['LtpaToken'];
But this is the idea. The adapter is not sending the cookie upon subsequent requests, however the cookie is available to the adapter through the user's 'attributes' object. It's only a matter of getting the cookie and adding it to the header upon each adapter invocation.