// Set the TokenType of the response. To make clients happy we'll return a token of the type they requested
tokenResponse.setTokenType(tokenRequest.getTokenType());
// Add a Lifetime element to indicate to clients the lifetime of the token we're sending
// In this case, we're giving the client the lifetime they asked for
Lifetime lifetime = tokenRequest.getLifetime();
tokenResponse.setLifetime(lifetime);
// Check if the request included a custom element named <TestElement>
// Note that a list of custom elements can be obtained by calling getCustomElements();
if (tokenRequest.getCustomElement("http://testElementNs.testElementNs", "TestElement") != null) {