code: private NameID buildNameId(final RequestAbstractType authnRequest,
                                 final Object assertion,
                                 final SamlRegisteredService service,
                                 final SamlRegisteredServiceServiceProviderMetadataFacade adaptor,
                                 final MessageContext messageContext) throws SamlException {
          val supportedNameFormats = getSupportedNameIdFormats(service, adaptor);
          val requiredNameFormat = getRequiredNameIdFormatIfAny(authnRequest);
          validateRequiredNameIdFormatIfAny(authnRequest, adaptor, supportedNameFormats, requiredNameFormat);
          val nameid = determineNameId(authnRequest, assertion, supportedNameFormats, service, adaptor);
          return finalizeNameId(nameid, authnRequest, assertion, supportedNameFormats, service, adaptor);
      }
docs: Build name id.
  If there are no explicitly defined NameIDFormats, include the default format.
  see: http://saml2int.org/profile/current/#section92
  
  @param authnRequest the authn request
  @param assertion    the assertion
  @param service      the service
  @param adaptor      the adaptor
  @return the name id
  @throws SamlException the saml exception