code: protected NameID finalizeNameId(final NameID nameid,
                                      final RequestAbstractType authnRequest,
                                      final Object assertion,
                                      final List<String> supportedNameFormats,
                                      final SamlRegisteredService service,
                                      final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) {
  
          if (StringUtils.isNotBlank(service.getNameIdQualifier())) {
              nameid.setNameQualifier(service.getNameIdQualifier());
          } else {
              val issuer = SamlIdPUtils.getIssuerFromSamlObject(authnRequest);
              nameid.setNameQualifier(issuer);
          }
  
          if (StringUtils.isNotBlank(service.getServiceProviderNameIdQualifier())) {
              nameid.setSPNameQualifier(service.getServiceProviderNameIdQualifier());
          } else {
              nameid.setSPNameQualifier(adaptor.getEntityId());
          }
          return nameid;
      }
docs: Finalize name id name id.
  
  @param nameid               the nameid
  @param authnRequest         the authn request
  @param assertion            the assertion
  @param supportedNameFormats the supported name formats
  @param service              the service
  @param adaptor              the adaptor
  @return the name id