排解 SAML 宣告政策部署錯誤

您正在查看 ApigeeApigee Hybrid 說明文件。
查看 Apigee Edge 說明文件。

SourceNotConfigured

錯誤訊息

透過 Apigee UIApigee 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.

錯誤螢幕截圖範例

部署修訂版本 2 至測試時發生錯誤。

原因

如果 ValidateSAMLAssertion 政策的下列一或多個元素未定義或為空白,API 代理程式會因這項錯誤而無法部署:<Source><XPath><Namespaces><Namespace>

舉例來說,如果您遺漏 <XPath> 元素,或讓 <Source> 元素或其實體為空白,則 API Proxy 的部署作業會失敗。

診斷

  1. 從錯誤訊息中找出失敗的 ValidateSAMLAssertion 政策名稱。例如,在以下錯誤中,ValidateSAMLAssertion 政策名稱為 Validate-SAML-Assertion-1

    ValidateSAMLAssertion[Validate-SAML-Assertion-1]: Source is not correctly configured.
    
  2. 檢查失敗的 ValidateSAMLAssertion 政策 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> 元素已定義且非空白。

如要修正上述 ValidateSAMLAssertion 政策範例,您可以新增 <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

錯誤訊息

透過 Apigee UIApigee 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.

錯誤螢幕截圖範例

部署修訂版本 2 至測試時發生錯誤。

原因

如果 <TrustStore> 元素為空白,或是未在 ValidateSAMLAssertion 政策中指定,則 API 代理程式部署作業會失敗。必須提供有效的信任存放區。

診斷

  1. 請檢查發生失敗的特定 API Proxy 中,所有「驗證 SAML 斷言」政策。如果任何「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>
    

解決方法

請確認 SAMLAssertion 政策中,元素 <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

錯誤訊息

透過 Apigee UI 或 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.

錯誤螢幕截圖範例

部署修訂版本 4 至測試環境時發生錯誤。

原因

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

診斷

  1. 檢查發生失敗的特定 API Proxy 中,所有 GenerateSAMLAssertion 政策。如果有任何 GenerateSAMLAssertion 政策,其中子元素 <Name> 為空白,或未在 <Keystore> 元素中指定,則為錯誤原因。

    以下 GenerateSAMLAssertion 政策在 <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>
    

解決方法

請確認 <Name> 子元素一律會在 GenerateSAMLAssertion 政策的 <Keystore> 元素中指定,且不會為空白。

如要修正上述範例,您可以正確指定 <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>

請參考 SAML 斷言政策的示例。

NullKeyStoreAlias

錯誤訊息

透過 Apigee UIApigee 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.

錯誤螢幕截圖範例

部署修訂版本 4 至測試環境時發生錯誤。

原因

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

診斷

  1. 檢查發生失敗的特定 API Proxy 中,所有 GenerateSAMLAssertion 政策。如果有任何 GenerateSAMLAssertion 政策,其中子元素 <Alias> 為空白,或未在 <Keystore> 元素中指定,則為錯誤原因。

    以下 GenerateSAMLAssertion<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>
    

解決方法

請確認 GenerateSAMLAssertion 政策的 <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>

請參考 SAML 斷言政策的示例。

NullIssuer

錯誤訊息

透過 Apigee UIApigee 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.

錯誤螢幕截圖範例

部署修訂版本 4 至測試環境時發生錯誤。

原因

如果 <Issuer> 元素為空白,或是未在 GenerateSAMLAssertion 政策中指定,則 API 代理程式部署作業會失敗。必須提供有效的 <Issuer> 值。

診斷

  1. 請檢查發生失敗的特定 API Proxy 中,所有 GenerateSAMLAssertion 政策。如果任何 GenerateSAMLAssertion 政策中的 <Issuer> 元素為空白或未指定,就會導致錯誤。

    以下 GenerateSAMLAssertion 政策包含空白的 <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>
    

解決方法

請確認 <Issuer> 元素一律在 GenerateSAMLAssertion 政策中指定且非空白。

如要修正上述範例,請正確指定 <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>

請參考 SAML 斷言政策的示例。