排解 SAML 宣告政策部署錯誤

查看 Apigee Edge 說明文件。
前往 Apigee X說明文件
資訊

SourceNotConfigured

錯誤訊息

透過 Edge UI 或 Edge 管理機制部署 API Proxy API 失敗,並顯示下列錯誤訊息:

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 宣告」政策的下列元素 定義或空白:<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>。如果是, 可能是錯誤原因

    舉例來說,下列政策含有空白的 <Namespaces> 元素 在 <Source> 元素下:

    <?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 管理機制部署 API Proxy API 失敗,並顯示下列錯誤訊息:

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> 元素為空白或未在 AuthSAMLAssertion 政策,然後是 API 的部署方式 Proxy 故障。必須提供有效的 Trust Store。

診斷

  1. 檢查 發生失敗的 API Proxy。如果有任何驗證 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>
    

解析度

確認始終指定 <TrustStore> 元素,且 非空白。<TrustStore> 名稱應與有效的 TrustStore 名稱相符 與您想部署的 透過 Proxy 處理

如要修正上述範例,您可以指定 <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 部署 API Proxy management API 執行失敗,並顯示下列錯誤訊息:

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。如果有任何「產生」 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>
    

解析度

確認已指定子元素 <Name> 且 Generate SAML Assertion 的 <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

錯誤訊息

透過 Edge UI 或 Edge 管理機制部署 API Proxy API 失敗,並顯示下列錯誤訊息:

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> 為空白或未在 「Generate SAML 宣告」政策的 <Keystore> 元素,然後 API Proxy 部署作業失敗。必須提供有效的 KeyStore 別名。

診斷

  1. 檢查 發生失敗的 API Proxy。如果有任何「產生」 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>
    

解析度

確認已指定子元素 <Name> 且並非空白 。<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

錯誤訊息

透過 Edge UI 或 Edge 管理機制部署 API Proxy API 失敗,並顯示下列錯誤訊息:

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

錯誤訊息範例

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

錯誤螢幕截圖

原因

如果 <Issuer> 元素為空白或未在 Generate SAML 中指定 斷言政策,那麼 API Proxy 的部署作業就會失敗。有效的 <Issuer>為必填欄位。

診斷

  1. 檢查特定 API 中所有的 Generate SAML 宣告政策 發生失敗情形的 Proxy。如果有任何 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>
    

解析度

確認在以下位置中一律指定 <Issuer> 元素,且該元素不可為空白: 產生 SAML 宣告政策

如要修正上述範例,請正確指定 <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 政策參考文章中的範例。