integration-impl/src/main/java/se/idsec/signservice/integration/dss/DssUtils.java
public static CertRequestProperties toCertRequestProperties(final SigningCertificateRequirements certReqs,
      final List<String> authnContextClassRefs) throws SignServiceProtocolException {

    CertRequestProperties crp = (new se.swedenconnect.schemas.csig.dssext_1_1.ObjectFactory()).createCertRequestProperties();
    crp.setCertType(certReqs.getCertificateType().getType());
    crp.getAuthnContextClassRefs().addAll(authnContextClassRefs);

    if (certReqs.getAttributeMappings() != null) {
      RequestedCertAttributes certAttributes = new RequestedCertAttributes();
      for (CertificateAttributeMapping mapping : certReqs.getAttributeMappings()) {
        MappedAttributeType certAttr = new MappedAttributeType();
        certAttr.setCertAttributeRef(mapping.getDestination().getName());
        certAttr.setCertNameType(mapping.getDestination().getType());
        if (StringUtils.isNotBlank(mapping.getDestination().getFriendlyName())) {
          certAttr.setFriendlyName(mapping.getDestination().getFriendlyName());
        }
        if (StringUtils.isNotBlank(mapping.getDestination().getDefaultValue())) {
          certAttr.setDefaultValue(mapping.getDestination().getDefaultValue());
        }
        certAttr.setRequired(mapping.getDestination().getRequired() != null
            ? mapping.getDestination().getRequired().booleanValue()
            : false);

        if (mapping.getSources() != null) {
          int order = 0;
          for (SignerIdentityAttribute sia : mapping.getSources()) {
            PreferredSAMLAttributeNameType samlAttribute = new PreferredSAMLAttributeNameType();
            if (mapping.getSources().size() > 1) {
              samlAttribute.setOrder(order++);
            }
            samlAttribute.setValue(sia.getName());
            certAttr.getSamlAttributeNames().add(samlAttribute);
          }
        }
        certAttributes.getRequestedCertAttributes().add(certAttr);
      }
      crp.setRequestedCertAttributes(certAttributes);
    }

    return crp;
  }
/**
   * Converts a {@link SigningCertificateRequirements} object into a {@code CertRequestProperties} element.
   * 
   * @param certReqs
   *          signing certificate requirements
   * @param authnContextClassRefs
   *          the level of assurance(s)
   * @return a CertRequestProperties elements
   * @throws SignServiceProtocolException
   *           for protocol errors
   */
Converts a  SigningCertificateRequirements object into a  CertRequestProperties element.

@param certReqs
signing certificate requirements
@param authnContextClassRefs
the level of assurance(s)
@return a CertRequestProperties elements
@throws SignServiceProtocolException
for protocol errors
Converts a SigningCertificateRequirements object into a CertRequestProperties element . @param certReqs signing certificate requirements @param authnContextClassRefs the level of assurance ( s ) @return a CertRequestProperties elements @throws SignServiceProtocolException for protocol errors
public static CertRequestProperties toCertRequestProperties(final SigningCertificateRequirements certReqs,
      final List<String> authnContextClassRefs) throws SignServiceProtocolException {
    CertRequestProperties crp = (new se.swedenconnect.schemas.csig.dssext_1_1.ObjectFactory()).createCertRequestProperties();
    crp.setCertType(certReqs.getCertificateType().getType());
    crp.getAuthnContextClassRefs().addAll(authnContextClassRefs);
    if (certReqs.getAttributeMappings() != null) {
      RequestedCertAttributes certAttributes = new RequestedCertAttributes();
      for (CertificateAttributeMapping mapping : certReqs.getAttributeMappings()) {
        MappedAttributeType certAttr = new MappedAttributeType();
        certAttr.setCertAttributeRef(mapping.getDestination().getName());
        certAttr.setCertNameType(mapping.getDestination().getType());
        if (StringUtils.isNotBlank(mapping.getDestination().getFriendlyName())) {
          certAttr.setFriendlyName(mapping.getDestination().getFriendlyName());
        }
        if (StringUtils.isNotBlank(mapping.getDestination().getDefaultValue())) {
          certAttr.setDefaultValue(mapping.getDestination().getDefaultValue());
        }
        certAttr.setRequired(mapping.getDestination().getRequired() != null
            ? mapping.getDestination().getRequired().booleanValue()
            : false);
        if (mapping.getSources() != null) {
          int order = 0;
          for (SignerIdentityAttribute sia : mapping.getSources()) {
            PreferredSAMLAttributeNameType samlAttribute = new PreferredSAMLAttributeNameType();
            if (mapping.getSources().size() > 1) {
              samlAttribute.setOrder(order++);
            }
            samlAttribute.setValue(sia.getName());
            certAttr.getSamlAttributeNames().add(samlAttribute);
          }
        }
        certAttributes.getRequestedCertAttributes().add(certAttr);
      }
      crp.setRequestedCertAttributes(certAttributes);
    }
    return crp;
  }
public static CertRequestProperties toCertRequestProperties ( final SigningCertificateRequirements certReqs , final List < String > authnContextClassRefs ) throws SignServiceProtocolException { CertRequestProperties crp = ( new se . swedenconnect . schemas . csig . dssext_1_1 . ObjectFactory ( ) ) . createCertRequestProperties ( ) ; crp . setCertType ( certReqs . getCertificateType ( ) . getType ( ) ) ; crp . getAuthnContextClassRefs ( ) . addAll ( authnContextClassRefs ) ; if ( certReqs . getAttributeMappings ( ) != null ) { RequestedCertAttributes certAttributes = new RequestedCertAttributes ( ) ; for ( CertificateAttributeMapping mapping : certReqs . getAttributeMappings ( ) ) { MappedAttributeType certAttr = new MappedAttributeType ( ) ; certAttr . setCertAttributeRef ( mapping . getDestination ( ) . getName ( ) ) ; certAttr . setCertNameType ( mapping . getDestination ( ) . getType ( ) ) ; if ( StringUtils . isNotBlank ( mapping . getDestination ( ) . getFriendlyName ( ) ) ) { certAttr . setFriendlyName ( mapping . getDestination ( ) . getFriendlyName ( ) ) ; } if ( StringUtils . isNotBlank ( mapping . getDestination ( ) . getDefaultValue ( ) ) ) { certAttr . setDefaultValue ( mapping . getDestination ( ) . getDefaultValue ( ) ) ; } certAttr . setRequired ( mapping . getDestination ( ) . getRequired ( ) != null ? mapping . getDestination ( ) . getRequired ( ) . booleanValue ( ) : false ) ; if ( mapping . getSources ( ) != null ) { int order = 0 ; for ( SignerIdentityAttribute sia : mapping . getSources ( ) ) { PreferredSAMLAttributeNameType samlAttribute = new PreferredSAMLAttributeNameType ( ) ; if ( mapping . getSources ( ) . size ( ) > 1 ) { samlAttribute . setOrder ( order ++ ) ; } samlAttribute . setValue ( sia . getName ( ) ) ; certAttr . getSamlAttributeNames ( ) . add ( samlAttribute ) ; } } certAttributes . getRequestedCertAttributes ( ) . add ( certAttr ) ; } crp . setRequestedCertAttributes ( certAttributes ) ; } return crp ; }
Converts a {@link SigningCertificateRequirements} object into a {@code CertRequestProperties} element.
Converts a { @link SigningCertificateRequirements } object into a { @code CertRequestProperties } element .