/** {@inheritDoc} */
  protected BaseAttribute<String> doResolve(ShibbolethResolutionContext resolutionContext) {
    BasicAttribute<String> attribute = new BasicAttribute<String>();
    attribute.setId(getId());

    String authnMethod =
        resolutionContext.getAttributeRequestContext().getPrincipalAuthenticationMethod();
    if (!DatatypeHelper.isEmpty(authnMethod)) {
      attribute.getValues().add(authnMethod);
    }

    return attribute;
  }
  /**
   * Builds a name ID. The provided value is the textual content of the NameIdentifier. If a {@link
   * #nameIdQualifier} is not null it is used as the NameIdentifier's name qualifier, otherwise the
   * attribute issuer's entity id is used.
   *
   * @param nameIdValue value of the NameIdentifier
   * @param resolutionContext current resolution context
   * @return the constructed NameIdentifier
   */
  protected NameIdentifier buildNameId(
      String nameIdValue, ShibbolethResolutionContext resolutionContext) {
    NameIdentifier nameId = nameIdBuilder.buildObject();
    nameId.setNameIdentifier(nameIdValue);

    if (nameIdFormat != null) {
      nameId.setFormat(nameIdFormat);
    }

    if (nameIdQualifier != null) {
      nameId.setNameQualifier(nameIdQualifier);
    } else {
      nameId.setNameQualifier(resolutionContext.getAttributeRequestContext().getLocalEntityId());
    }

    return nameId;
  }