extractAttributesFromSAMLResponse(response) {
    const attributeStatement = response.getAssertion().Assertion.AttributeStatement;
    if (attributeStatement == null || attributeStatement[0] == null) {
      return {};
    }

    const attributes = attributeStatement[0].Attribute;
    if (attributes == null) {
      return {};
    }

    const result = {};
    for (const attribute of attributes) {
      const name = attribute.$.Name;
      const attributeValues = attribute.AttributeValue.map(v => v._);
      if (result[name] == null) {
        result[name] = attributeValues;
      }
      else {
        result[name] = result[name].concat(attributeValues);
      }
    }

    return result;
  }
/**
   * Extract attributes from a SAML response
   *
   * The format of extracted attributes is the following.
   *
   * {
   *    "attribute_name1": ["value1", "value2", ...],
   *    "attribute_name2": ["value1", "value2", ...],
   *    ...
   * }
   */
Extract attributes from a SAML response
The format of extracted attributes is the following.


Extract attributes from a SAML response The format of extracted attributes is the following .
extractAttributesFromSAMLResponse(response) {
    const attributeStatement = response.getAssertion().Assertion.AttributeStatement;
    if (attributeStatement == null || attributeStatement[0] == null) {
      return {};
    }
    const attributes = attributeStatement[0].Attribute;
    if (attributes == null) {
      return {};
    }
    const result = {};
    for (const attribute of attributes) {
      const name = attribute.$.Name;
      const attributeValues = attribute.AttributeValue.map(v => v._);
      if (result[name] == null) {
        result[name] = attributeValues;
      }
      else {
        result[name] = result[name].concat(attributeValues);
      }
    }
    return result;
  }
extractAttributesFromSAMLResponse ( response ) { const attributeStatement = response . getAssertion ( ) . Assertion . AttributeStatement ; if ( attributeStatement == null || attributeStatement [ 0 ] == null ) { return { } ; } const attributes = attributeStatement [ 0 ] . Attribute ; if ( attributes == null ) { return { } ; } const result = { } ; for ( const attribute of attributes ) { const name = attribute . $ . Name ; const attributeValues = attribute . AttributeValue . map ( v => v . _ ) ; if ( result [ name ] == null ) { result [ name ] = attributeValues ; } else { result [ name ] = result [ name ] . concat ( attributeValues ) ; } } return result ; }
Extract attributes from a SAML response
 The format of extracted attributes is the following.
Extract attributes from a SAML response The format of extracted attributes is the following .