try {
  response.setSessionAttribute('emailFromAssertion', notes['saml.attributes.http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress'])
  response.setResult('ok');
} catch(Exception ex) {
   LOG.error("Exception in saveEmailFromAssertionToSession groovy script: " + ex)
   response.setResult('error');
}