integration-impl/src/main/java/se/idsec/signservice/integration/process/impl/DefaultSignerAssertionInfoProcessor.java
protected List<SignerIdentityAttributeValue> processAttributes(final SignerAssertionInfo signerAssertionInfo,
      final SignRequestWrapper signRequest) throws SignServiceIntegrationException {

    if (signerAssertionInfo.getAttributeStatement() == null
        || signerAssertionInfo.getAttributeStatement().getAttributesAndEncryptedAttributes().isEmpty()) {
      final String msg = String.format("No SignerAssertionInfo/AttributeStatement available in SignResponse [request-id='%s']",
        signRequest.getRequestID());
      log.error("{}: {}", CorrelationID.id(), msg);
      throw new SignServiceProtocolException(msg);
    }
    final List<SignerIdentityAttributeValue> attributes = DssUtils.fromAttributeStatement(signerAssertionInfo.getAttributeStatement());

    if (this.processingConfig.isStrictProcessing()) {
      final RequestedCertAttributes requestedAttributes =
          signRequest.getSignRequestExtension().getCertRequestProperties().getRequestedCertAttributes();
      for (MappedAttributeType mat : requestedAttributes.getRequestedCertAttributes()) {
        if (!mat.isRequired() || StringUtils.isNotBlank(mat.getDefaultValue())) {
          // For non required attributes or those having a default value there is no requirement to
          // get it from the IdP or AA.
          continue;
        }
        boolean attrDelivered = false;
        for (PreferredSAMLAttributeNameType attr : mat.getSamlAttributeNames()) {
          if (attributes.stream().filter(a -> a.getName().equals(attr.getValue())).findFirst().isPresent()) {
            log.trace("{}: Requested attribute '{}' was delivered by IdP/AA [request-id='{}']",
              CorrelationID.id(), attr.getValue(), signRequest.getRequestID());
            attrDelivered = true;
            break;
          }
        }
        if (!attrDelivered) {
          final String msg = String.format(
            "None of the requested attribute(s) %s were delivered in SignerAssertionInfo/AttributeStatement [request-id='%s']",
            mat.getSamlAttributeNames().stream().map(a -> a.getValue()).collect(Collectors.toList()), signRequest.getRequestID());
          log.error("{}: {}", CorrelationID.id(), msg);
          throw new SignResponseProcessingException(new ErrorCode.Code("invalid-response"), msg);
        }
      }
    }
    return attributes;
  }
/**
   * Extracts the attributes from the response and validates that we received all attributes that were requested (if
   * strict processing is enabled).
   * 
   * @param signerAssertionInfo
   *          the signer info (including the received attributes)
   * @param signRequest
   *          the request
   * @throws SignServiceIntegrationException
   *           for validation errors
   */
Extracts the attributes from the response and validates that we received all attributes that were requested (if
strict processing is enabled).

@param signerAssertionInfo
the signer info (including the received attributes)
@param signRequest
the request
@throws SignServiceIntegrationException
for validation errors
Extracts the attributes from the response and validates that we received all attributes that were requested ( if strict processing is enabled ) . @param signerAssertionInfo the signer info ( including the received attributes ) @param signRequest the request @throws SignServiceIntegrationException for validation errors
protected List<SignerIdentityAttributeValue> processAttributes(final SignerAssertionInfo signerAssertionInfo,
      final SignRequestWrapper signRequest) throws SignServiceIntegrationException {
    if (signerAssertionInfo.getAttributeStatement() == null
        || signerAssertionInfo.getAttributeStatement().getAttributesAndEncryptedAttributes().isEmpty()) {
      final String msg = String.format("No SignerAssertionInfo/AttributeStatement available in SignResponse [request-id='%s']",
        signRequest.getRequestID());
      log.error("{}: {}", CorrelationID.id(), msg);
      throw new SignServiceProtocolException(msg);
    }
    final List<SignerIdentityAttributeValue> attributes = DssUtils.fromAttributeStatement(signerAssertionInfo.getAttributeStatement());
    if (this.processingConfig.isStrictProcessing()) {
      final RequestedCertAttributes requestedAttributes =
          signRequest.getSignRequestExtension().getCertRequestProperties().getRequestedCertAttributes();
      for (MappedAttributeType mat : requestedAttributes.getRequestedCertAttributes()) {
        if (!mat.isRequired() || StringUtils.isNotBlank(mat.getDefaultValue())) {
          continue;
        }
        boolean attrDelivered = false;
        for (PreferredSAMLAttributeNameType attr : mat.getSamlAttributeNames()) {
          if (attributes.stream().filter(a -> a.getName().equals(attr.getValue())).findFirst().isPresent()) {
            log.trace("{}: Requested attribute '{}' was delivered by IdP/AA [request-id='{}']",
              CorrelationID.id(), attr.getValue(), signRequest.getRequestID());
            attrDelivered = true;
            break;
          }
        }
        if (!attrDelivered) {
          final String msg = String.format(
            "None of the requested attribute(s) %s were delivered in SignerAssertionInfo/AttributeStatement [request-id='%s']",
            mat.getSamlAttributeNames().stream().map(a -> a.getValue()).collect(Collectors.toList()), signRequest.getRequestID());
          log.error("{}: {}", CorrelationID.id(), msg);
          throw new SignResponseProcessingException(new ErrorCode.Code("invalid-response"), msg);
        }
      }
    }
    return attributes;
  }
protected List < SignerIdentityAttributeValue > processAttributes ( final SignerAssertionInfo signerAssertionInfo , final SignRequestWrapper signRequest ) throws SignServiceIntegrationException { if ( signerAssertionInfo . getAttributeStatement ( ) == null || signerAssertionInfo . getAttributeStatement ( ) . getAttributesAndEncryptedAttributes ( ) . isEmpty ( ) ) { final String msg = String . format ( "No SignerAssertionInfo/AttributeStatement available in SignResponse [request-id='%s']" , signRequest . getRequestID ( ) ) ; log . error ( "{}: {}" , CorrelationID . id ( ) , msg ) ; throw new SignServiceProtocolException ( msg ) ; } final List < SignerIdentityAttributeValue > attributes = DssUtils . fromAttributeStatement ( signerAssertionInfo . getAttributeStatement ( ) ) ; if ( this . processingConfig . isStrictProcessing ( ) ) { final RequestedCertAttributes requestedAttributes = signRequest . getSignRequestExtension ( ) . getCertRequestProperties ( ) . getRequestedCertAttributes ( ) ; for ( MappedAttributeType mat : requestedAttributes . getRequestedCertAttributes ( ) ) { if ( ! mat . isRequired ( ) || StringUtils . isNotBlank ( mat . getDefaultValue ( ) ) ) { continue ; } boolean attrDelivered = false ; for ( PreferredSAMLAttributeNameType attr : mat . getSamlAttributeNames ( ) ) { if ( attributes . stream ( ) . filter ( a -> a . getName ( ) . equals ( attr . getValue ( ) ) ) . findFirst ( ) . isPresent ( ) ) { log . trace ( "{}: Requested attribute '{}' was delivered by IdP/AA [request-id='{}']" , CorrelationID . id ( ) , attr . getValue ( ) , signRequest . getRequestID ( ) ) ; attrDelivered = true ; break ; } } if ( ! attrDelivered ) { final String msg = String . format ( "None of the requested attribute(s) %s were delivered in SignerAssertionInfo/AttributeStatement [request-id='%s']" , mat . getSamlAttributeNames ( ) . stream ( ) . map ( a -> a . getValue ( ) ) . collect ( Collectors . toList ( ) ) , signRequest . getRequestID ( ) ) ; log . error ( "{}: {}" , CorrelationID . id ( ) , msg ) ; throw new SignResponseProcessingException ( new ErrorCode . Code ( "invalid-response" ) , msg ) ; } } } return attributes ; }
Extracts the attributes from the response and validates that we received all attributes that were requested (if
 strict processing is enabled).
Extracts the attributes from the response and validates that we received all attributes that were requested ( if strict processing is enabled ) .
// For non required attributes or those having a default value there is no requirement to // get it from the IdP or AA.