排解 SAML 宣告政策部署錯誤

您目前查看的是 ApigeeApigee Hybrid 說明文件。
查看 Apigee Edge 說明文件。

SourceNotConfigured

錯誤訊息

透過 Apigee 使用者介面Apigee 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 Proxy 的部署作業就會失敗並顯示這項錯誤:<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 使用者介面Apigee 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 Proxy 的部署作業就會失敗。必須提供有效的信任儲存區。

診斷

  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>
    

解析度

請確保 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 使用者介面或 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 代理伺服器部署作業就會失敗。必須提供有效的金鑰儲存庫名稱。

診斷

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

    下列 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>

請參閱 SAMLAssertion 政策中的範例。

NullKeyStoreAlias

錯誤訊息

透過 Apigee 使用者介面Apigee 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 代理伺服器部署作業就會失敗。必須提供有效的金鑰儲存庫別名。

診斷

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

    下列 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>
    

解析度

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

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

錯誤訊息

透過 Apigee 使用者介面Apigee 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 Proxy 部署作業就會失敗。必須提供有效的<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>
    

解析度

請確保 GenerateSAMLAssertion 政策中一律指定 <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 政策中的範例。