排解 SAML 宣告政策部署錯誤

您目前查看的是 Apigee Edge 說明文件。
前往 Apigee X 說明文件。
info

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. 從錯誤訊息中找出失敗的「Validate SAML Assertion」政策名稱。舉例來說,在下列錯誤中,Validate SAML Assertion 政策名稱為 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.
    

解析度

確認 <Source> 元素的值已透過 <Namespaces> 元素及其子項 <Namespace> 正確設定。此外,您也必須確保已定義 <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.

錯誤螢幕截圖範例

原因

如果 <TrustStore> 元素空白或未在 ValidateSAMLAssertion 政策中指定,API Proxy 的部署作業就會失敗。必須提供有效的信任儲存區。

診斷

  1. 檢查發生失敗的特定 API Proxy 中的所有 Validate SAML Assertion 政策。如果 Validate SAML Assertion 政策中的 <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>

如要進一步瞭解如何使用信任儲存庫,請參閱「信任儲存庫和金鑰儲存區」。

NullKeyStore

錯誤訊息

透過 Edge UI 或 Edge 管理 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 的部署作業就會失敗。必須提供有效的金鑰儲存庫名稱。

診斷

  1. 檢查發生失敗的特定 API Proxy 中的所有 Generate SAML Assertion 政策。如果子元素 <Name> 為空,或未在 <Keystore> 元素中指定,則 GenerateSAMLAssertion 政策中就會發生錯誤。

    下列「產生 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 Assertion」(產生 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.

錯誤螢幕截圖範例

原因

如果子項元素 <Alias> 為空,或未在產生 SAML 聲明政策的 <Keystore> 元素中指定,API Proxy 的部署作業就會失敗。必須提供有效的金鑰儲存庫別名。

診斷

  1. 檢查發生失敗的特定 API Proxy 中的所有 Generate SAML Assertion 政策。如果子元素 <Alias> 為空,或未在 <Keystore> 元素中指定,則 GenerateSAMLAssertion 政策中就會發生錯誤。

    下列「產生 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>
    

解析度

請確保在「產生 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.

錯誤螢幕截圖範例

原因

如果「產生 SAML 判斷」政策中的 <Issuer> 元素為空白或未指定,API Proxy 部署作業就會失敗。必須提供有效的<Issuer>值。

診斷

  1. 檢查發生失敗的特定 API Proxy 中的所有「產生 SAML 聲明」政策。如果「產生 SAML 聲明」政策中的 <Issuer> 元素空白或未指定,就會導致錯誤。

    下列「產生 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>
    

解析度

請確保在「產生 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 政策參考文章中的程式碼範例」。