if (ndSaml != null) {
String samlToken = ndSaml.getTextContent();
if (samlToken != null) {
IntegrationContextFactory icf = new IntegrationContextFactory();
if (icf.isIntegrationEnabled()) {
IntegrationContext ic = icf.newIntegrationContext();
if (ic != null) {
String samlUsername = ic.getUsernameFromSAMLToken(samlToken);
RequestContext rc = context.getRequestContext();
if ((rc != null) && (samlUsername != null)) {
User user = rc.getUser();
user.reset();
user.setCredentials(new UsernameCredential(samlUsername));