排解 SAML 宣告政策部署錯誤

您正在查看 Apigee Edge 說明文件。
查看 Apigee X 說明文件
資訊

SourceNotConfigured

錯誤訊息

透過 Edge UI 或 Edge Management API 部署 API Proxy 的作業會失敗,並顯示以下錯誤訊息:

Error Deploying Revision revision_number to environment
ValidateSAMLAssertion[policy_name]: Source is not correctly configured.

錯誤訊息範例

Error Deploying Revision 2 to test
ValidateSAMLAssertion[Validate-SAML-Assertion-1]: Source is not correctly configured.

錯誤螢幕截圖示例

原因

如果驗證 SAML 宣告政策的下列一或多個元素未定義或空白,則 API Proxy 部署作業會失敗並顯示這個錯誤:<Source><XPath><Namespaces><Namespace>

舉例來說,如果您缺少 <XPath> 元素或將 <Source> 元素或其實體留空,API Proxy 的部署作業就會失敗。

診斷

  1. 從錯誤訊息中找出失敗的「驗證 SAML 斷言政策名稱」。舉例來說,在下列錯誤訊息中,驗證 SAML 宣告政策名稱為 Validate-SAML-Assertion-1

    ValidateSAMLAssertion[Validate-SAML-Assertion-1]: Source is not correctly configured.
    
  2. 檢查失敗的「驗證 SAML 宣告」政策 XML。檢查政策的下列一或多個元素是否遺失或空白:<Source><XPath><Namespaces><Namespace>。如果有,可能是導致錯誤的原因。

    例如,下列政策的 <Source> 元素下方有一個空白的 <Namespaces> 元素:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <ValidateSAMLAssertion name="SAML" ignoreContentType="false">
      <Source name="request">
        <Namespaces></Namespaces>
       </Source>
       <Description/>
     <TrustStore>ref://TrustStoreName</Truststore>
     <RemoveAssertion>false</RemoveAssertion>
    </ValidateSAMLAssertion>
    
  3. 在上述範例中,<Namespaces> 元素是空的,因此您會收到錯誤訊息:

    ValidateSAMLAssertion[Validate-SAML-Assertion-1]: Source is not correctly configured.
    

解析度

確認使用 <Namespaces> 元素及其子項元素 <Namespace> 正確設定 <Source> 元素的值。您也必須確保已定義 <XPath> 元素,且不得空白。

如要修正上述「驗證 SAML 宣告」政策的範例,您可以新增 <Namespace> 元素和 <XPath>

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ValidateSAMLAssertion name="SAML" ignoreContentType="false">
  <Source name="request">
    <Namespaces>
      <Namespace prefix='soap'>http://schemas.xmlsoap.org/soap/envelope/</Namespace>
      <Namespace prefix='wsse'>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</Namespace>
      <Namespace prefix='saml'>urn:oasis:names:tc:SAML:2.0:assertion</Namespace>
    </Namespaces>
    <XPath>/soap:Envelope/soap:Header/wsse:Security/saml:Assertion</XPath>
  </Source>
   <Description/>
<TrustStore>ref://TrustStoreName</Truststore>
<RemoveAssertion>false</RemoveAssertion>
</ValidateSAMLAssertion>

TrustStoreNotConfigured

錯誤訊息

透過 Edge UI 或 Edge Management API 部署 API Proxy 的作業會失敗,並顯示以下錯誤訊息:

Error Deploying Revision revision_number to environment
ValidateSAMLAssertion[[Ljava.lang.Object;@object]: Trust store is not correctly configured.

錯誤訊息範例

Error Deploying Revision 2 to test
ValidateSAMLAssertion[[Ljava.lang.Object;@39537262]: Trust store is not correctly configured.

錯誤螢幕截圖示例

原因

如果驗證 SAMLAssertion 政策中的 <TrustStore> 元素為空白或未指定,則 API Proxy 的部署作業會失敗。必須提供有效的 Trust Store。

診斷

  1. 檢查在失敗的特定 API Proxy 中,檢查所有「驗證 SAML 斷言」政策。如有任何驗證 SAML 宣告政策的 <TrustStore> 元素為空白或未指定,就會造成錯誤。

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <ValidateSAMLAssertion name="SAML" ignoreContentType="false">
     <Source name="request">
        <Namespaces>
          <Namespace prefix='soap'>http://schemas.xmlsoap.org/soap/envelope/</Namespace>
          <Namespace prefix='wsse'>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</Namespace>
          <Namespace prefix='saml'>urn:oasis:names:tc:SAML:2.0:assertion</Namespace>
        </Namespaces>
        <XPath>/soap:Envelope/soap:Header/wsse:Security/saml:Assertion</XPath>
      </Source>
        <Description/>
        <TrustStore/>
      <RemoveAssertion>false</RemoveAssertion>
    </ValidateSAMLAssertion>
    

解析度

確保在驗證 SAML 宣告政策中一律指定 <TrustStore> 元素,且不得空白。<TrustStore> 名稱應與您嘗試部署 Proxy 的所有環境中的有效 TrustStore 名稱相符。

如要修正上述範例,可以使用有效值指定 <TrustStore> 元素。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ValidateSAMLAssertion name="SAML" ignoreContentType="false">
  <Source name="request">
    <Namespaces>
      <Namespace prefix='soap'>http://schemas.xmlsoap.org/soap/envelope/</Namespace>
      <Namespace prefix='wsse'>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</Namespace>
      <Namespace prefix='saml'>urn:oasis:names:tc:SAML:2.0:assertion</Namespace>
    </Namespaces>
    <XPath>/soap:Envelope/soap:Header/wsse:Security/saml:Assertion</XPath>
  </Source>
  <TrustStore>TrustStoreName</TrustStore>
  <RemoveAssertion>false</RemoveAssertion>
</ValidateSAMLAssertion>

如要進一步瞭解如何使用 Truststore,請參閱 Truststores 和 KeyStore

NullKeyStore

錯誤訊息

透過 Edge UI 或 Edge Management API 部署 API Proxy 的作業會失敗,並顯示以下錯誤訊息:

Error Deploying Revision revision_number to environment
Assertion KeyStore name cannot be null.

錯誤訊息範例

Error Deploying Revision 4 to test
Assertion KeyStore name cannot be null.

錯誤螢幕截圖示例

原因

如果子元素 <Name> 為空白,或是在 GenerateSAMLAssertion 政策的 <Keystore> 元素中未指定,則 API Proxy 的部署作業會失敗。必須提供有效的 KeyStore 名稱。

診斷

  1. 檢查發生錯誤的特定 API Proxy 中「Generate SAML 斷言」政策。如有任何「Generate SAML 斷言」政策,但子元素 <Name> 為空白,或未在 <Keystore> 元素中指定,這就是發生錯誤的原因。

    以下 Generate SAML 斷言政策的 <Keystore> 元素中含有空白的子項元素 <Name>

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <GenerateSAMLAssertion name="SAML" ignoreContentType="false">`
      <CanonicalizationAlgorithm />
      <Issuer ref="reference">Issuer name</Issuer>
      <KeyStore>
        <Name></Name>
        <Alias ref="reference">alias</Alias>
      </KeyStore>
      <OutputVariable>
        <FlowVariable>assertion.content</FlowVariable>
        <Message name="request">
          <Namespaces>
            <Namespace prefix="test">http://www.example.com/test</Namespace>
          </Namespaces>
          <XPath>/envelope/header</XPath>
        </Message>
      </OutputVariable>
      <SignatureAlgorithm />
      <Subject ref="reference">Subject name</Subject>
      <Template ignoreUnresolvedVariables="false">
        <!-- A lot of XML goes here, in CDATA, with {} around
             each variable -->
      </Template>
    </GenerateSAMLAssertion>
    

解析度

請務必在 Generate SAML 宣告政策的 <Keystore> 元素中一律指定子項元素 <Name>,且不得空白。

如要修正上述範例,您可以正確指定 <Name> 元素,並確保為 <Alias> 元素指定有效值。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<GenerateSAMLAssertion name="SAML" ignoreContentType="false">
  <CanonicalizationAlgorithm />
  <Issuer ref="reference">Issuer name</Issuer>
  <KeyStore>
    <Name ref="reference">keystorename</Name>
    <Alias ref="reference">alias</Alias>
  </KeyStore>
  <OutputVariable>
    <FlowVariable>assertion.content</FlowVariable>
    <Message name="request">
      <Namespaces>
        <Namespace prefix="test">http://www.example.com/test</Namespace>
      </Namespaces>
      <XPath>/envelope/header</XPath>
    </Message>
  </OutputVariable>
  <SignatureAlgorithm />
  <Subject ref="reference">Subject name</Subject>
  <Template ignoreUnresolvedVariables="false">
    <!-- A lot of XML goes here, in CDATA, with {} around
         each variable -->
  </Template>
</GenerateSAMLAssertion>

請參閱 SAMLAssertion 政策參考文章中的程式碼範例的範例。

NullKeyStoreAlias

錯誤訊息

透過 Edge UI 或 Edge Management API 部署 API Proxy 的作業會失敗,並顯示以下錯誤訊息:

Error Deploying Revision revision_number to environment
Assertion KeyStore alias cannot be null.

錯誤訊息範例

Error Deploying Revision 4 to test
Assertion KeyStore alias cannot be null.

錯誤螢幕截圖示例

原因

如果在 Generate SAML 斷言政策的 <Keystore> 元素中未指定空白元素 <Alias>,或未指定子元素,API Proxy 的部署作業就會失敗。必須提供有效的 KeyStore 別名。

診斷

  1. 檢查發生錯誤的特定 API Proxy 中「Generate SAML 斷言」政策。如有任何「Generate SAML 斷言」政策,但子元素 <Alias> 為空白,或未在 <Keystore> 元素中指定,這就是發生錯誤的原因。

    以下 Generate SAML 斷言政策的 <Keystore> 元素中含有空白的子項元素 <Alias>

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <GenerateSAMLAssertion name="SAML" ignoreContentType="false">`
      <CanonicalizationAlgorithm />
      <Issuer ref="reference">Issuer name</Issuer>
      <KeyStore>
        <Name ref="reference">keystorename</Name>
        <Alias></Alias>
      </KeyStore>
      <OutputVariable>
        <FlowVariable>assertion.content</FlowVariable>
        <Message name="request">
          <Namespaces>
            <Namespace prefix="test">http://www.example.com/test</Namespace>
          </Namespaces>
          <XPath>/envelope/header</XPath>
        </Message>
      </OutputVariable>
      <SignatureAlgorithm />
      <Subject ref="reference">Subject name</Subject>
      <Template ignoreUnresolvedVariables="false">
        <!-- A lot of XML goes here, in CDATA, with {} around
             each variable -->
      </Template>
    </GenerateSAMLAssertion>
    

解析度

請確保在 Generate SAML 宣告政策的 <Keystore> 元素中一律指定子項元素 <Name>,且不得空白。

如要修正上述範例,您可以正確指定 <Alias> 元素,並確保為 <Name> 元素指定有效值。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<GenerateSAMLAssertion name="SAML" ignoreContentType="false">
  <CanonicalizationAlgorithm />
  <Issuer ref="reference">Issuer name</Issuer>
  <KeyStore>
    <Name ref="reference">keystorename</Name>
    <Alias ref="reference">alias</Alias>
  </KeyStore>
  <OutputVariable>
    <FlowVariable>assertion.content</FlowVariable>
    <Message name="request">
      <Namespaces>
        <Namespace prefix="test">http://www.example.com/test</Namespace>
      </Namespaces>
      <XPath>/envelope/header</XPath>
    </Message>
  </OutputVariable>
  <SignatureAlgorithm />
  <Subject ref="reference">Subject name</Subject>
  <Template ignoreUnresolvedVariables="false">
    <!-- A lot of XML goes here, in CDATA, with {} around
         each variable -->
  </Template>
</GenerateSAMLAssertion>

請參閱 SAMLAssertion 政策參考文章中的程式碼範例的範例。

NullIssuer

錯誤訊息

透過 Edge UI 或 Edge Management API 部署 API Proxy 的作業會失敗,並顯示以下錯誤訊息:

Error Deploying Revision revision_number to environment
Assertion Issuer cannot be null.

錯誤訊息範例

Error Deploying Revision 4 to test
Assertion Issuer cannot be null.

錯誤螢幕截圖示例

原因

如果 <Issuer> 元素為空白,或是未在產生 SAML 宣告政策中指定空白,則 API Proxy 的部署會失敗。必須提供有效的 <Issuer> 值。

診斷

  1. 檢查發生錯誤的特定 API Proxy 中「Generate SAML 斷言」政策。如有任何「Generate SAML 宣告」政策的 <Issuer> 元素為空白或未指定,就會導致發生錯誤。

    下列 Generate SAML 宣告政策含有空白的 <Issuer> 元素:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <GenerateSAMLAssertion name="SAML" ignoreContentType="false">`
      <CanonicalizationAlgorithm />
      <Issuer></Issuer>
      <KeyStore>
        <Name ref="reference">keystorename</Name>
        <Alias ref="reference">alias</Alias>
      </KeyStore>
      <OutputVariable>
        <FlowVariable>assertion.content</FlowVariable>
        <Message name="request">
          <Namespaces>
            <Namespace prefix="test">http://www.example.com/test</Namespace>
          </Namespaces>
          <XPath>/envelope/header</XPath>
        </Message>
      </OutputVariable>
      <SignatureAlgorithm />
      <Subject ref="reference">Subject name</Subject>
      <Template ignoreUnresolvedVariables="false">
        <!-- A lot of XML goes here, in CDATA, with {} around
             each variable -->
      </Template>
    </GenerateSAMLAssertion>
    

解析度

確保在 Generate SAML 斷言政策中一律指定 <Issuer> 元素且非空白。

如要修正上述範例,請正確指定 <Issuer> 元素:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<GenerateSAMLAssertion name="SAML" ignoreContentType="false">
  <CanonicalizationAlgorithm />
  <Issuer ref="reference">Issuer name</Issuer>
  <KeyStore>
    <Name ref="reference">keystorename</Name>
    <Alias ref="reference">alias</Alias>
  </KeyStore>
  <OutputVariable>
    <FlowVariable>assertion.content</FlowVariable>
    <Message name="request">
      <Namespaces>
        <Namespace prefix="test">http://www.example.com/test</Namespace>
      </Namespaces>
      <XPath>/envelope/header</XPath>
    </Message>
  </OutputVariable>
  <SignatureAlgorithm />
  <Subject ref="reference">Subject name</Subject>
  <Template ignoreUnresolvedVariables="false">
    <!-- A lot of XML goes here, in CDATA, with {} around
         each variable -->
  </Template>
</GenerateSAMLAssertion>

請參閱 SAMLAssertion 政策參考文章中的程式碼範例的範例。