code: public Subject newSubject(final NameID nameId,
                                final NameID subjectConfNameId,
                                final String recipient,
                                final ZonedDateTime notOnOrAfter,
                                final String inResponseTo,
                                final ZonedDateTime notBefore) {
  
          LOGGER.debug("Building subject for NameID [{}] and recipient [{}], in response to [{}]", nameId, recipient, inResponseTo);
          val confirmation = newSamlObject(SubjectConfirmation.class);
          confirmation.setMethod(SubjectConfirmation.METHOD_BEARER);
          val data = newSamlObject(SubjectConfirmationData.class);
  
          if (StringUtils.isNotBlank(recipient)) {
              data.setRecipient(recipient);
          }
  
          if (notOnOrAfter != null) {
              data.setNotOnOrAfter(DateTimeUtils.dateTimeOf(notOnOrAfter));
          }
  
          if (StringUtils.isNotBlank(inResponseTo)) {
              data.setInResponseTo(inResponseTo);
  
              val ip = InetAddressUtils.getByName(inResponseTo);
              if (ip != null) {
                  data.setAddress(ip.getHostName());
              }
  
          }
  
          if (notBefore != null) {
              data.setNotBefore(DateTimeUtils.dateTimeOf(notBefore));
          }
  
          confirmation.setSubjectConfirmationData(data);
  
          val subject = newSamlObject(Subject.class);
          if (nameId != null) {
              subject.setNameID(nameId);
  
              if (subjectConfNameId != null) {
                  confirmation.setNameID(subjectConfNameId);
              }
              subject.setEncryptedID(null);
              confirmation.setEncryptedID(null);
          }
          subject.getSubjectConfirmations().add(confirmation);
  
          LOGGER.debug("Built subject [{}]", subject);
          return subject;
      }
docs: New subject element.
  
  @param nameId            the nameId
  @param subjectConfNameId the subject conf name id
  @param recipient         the recipient
  @param notOnOrAfter      the not on or after
  @param inResponseTo      the in response to
  @param notBefore         the not before
  @return the subject