פתרון בעיות שקשורות לפריסת מדיניות של אימות בסיסי

הדף הזה רלוונטי ל-Apigee ול-Apigee Hybrid.

לעיון במסמכי התיעוד של Apigee Edge

UserNameRequired

הודעת השגיאה

פריסת ה-proxy ל-API דרך ממשק המשתמש או ה-API של Apigee נכשלת ומוצגת הודעת השגיאה הבאה:

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: Username element must be present for operation operation.

דוגמה להודעת שגיאה

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: Username element must be present for Encode operation.

צילום מסך לדוגמה

מטרה

פריסת ה-API Proxy נכשלת אם רכיב <User> לא מוגדר במדיניות BasicAuthentication. רכיב <User> הוא חובה גם לפעולות Encode וגם לפעולות Decode.

אבחון

  1. בודקים את כל כללי המדיניות של BasicAuthentication שמשמשים ב-proxy ל-API. אם יש מדיניות שבה לא מצוין רכיב <User>, זו הסיבה לשגיאה. הרכיב <User> הוא חובה במדיניות BasicAuthentication לפעולות Encode או Decode.

    מדיניות BasicAuthentication לדוגמה שמוצגת בהמשך משמשת לפעולת Encode, אבל לא מוגדר בה רכיב <User>:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <BasicAuthentication name="ApplyBasicAuthHeader">
      <DisplayName>ApplyBasicAuthHeader</DisplayName>
      <Operation>Encode</Operation>
      <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
      <Password ref="BasicAuth.credentials.password"/>
      <AssignTo createNew="false">request.header.Authorization</AssignTo>
    </BasicAuthentication>
    

    הפריסה נכשלת עם השגיאה הבאה:

    BasicAuthenticationPolicy: Username element must be present for Encode operation.
    

רזולוציה

מוודאים שהרכיב <User> מוגדר במדיניות BasicAuthentication עבור פעולת קידוד או פענוח.

כדי לתקן את הדוגמה שמוצגת למעלה, צריך לכלול את הרכיב <User> במדיניות כמו בדוגמה הבאה:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
    <DisplayName>ApplyBasicAuthHeader</DisplayName>
    <Operation>Encode</Operation>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <User ref="BasicAuth.credentials.username"/>
    <Password ref="BasicAuth.credentials.password"/>
    <AssignTo createNew="false">request.header.Authorization</AssignTo>
</BasicAuthentication>

PasswordRequired

הודעת השגיאה

פריסת ה-proxy ל-API דרך ממשק המשתמש או ה-API של Apigee נכשלת ומוצגת הודעת השגיאה הבאה:

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: Password element must be present for operation operation.

דוגמה להודעת שגיאה

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: Password element must be present for Encode operation.

צילום מסך לדוגמה

מטרה

פריסת ה-API Proxy נכשלת אם רכיב <Password> לא מוגדר במדיניות BasicAuthentication. רכיב <Password> הוא חובה גם לפעולות Encode וגם לפעולות Decode.

אבחון

  1. בודקים את כל מדיניות BasicAuthentication שמשמשת ב-proxy ל-API. אם יש מדיניות שבה לא מוגדר הרכיב <Password>, זו הסיבה לשגיאה. הרכיב <Password> הוא חובה במדיניות BasicAuthentication לפעולות Encode או Decode.

    מדיניות BasicAuthentication לדוגמה שמוצגת בהמשך משמשת לפעולת Encode, אבל לא מוגדר בה רכיב <Password>:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <BasicAuthentication name="ApplyBasicAuthHeader">
      <DisplayName>ApplyBasicAuthHeader</DisplayName>
      <Operation>Encode</Operation>
      <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
      <User ref="BasicAuth.credentials.username"/>
      <AssignTo createNew="false">request.header.Authorization</AssignTo>
    </BasicAuthentication>
    

    הפריסה נכשלת עם השגיאה הבאה:

    BasicAuthenticationPolicy: Password element must be present for Encode operation.
    

רזולוציה

מוודאים שהרכיב <Password> מוגדר במדיניות BasicAuthentication עבור פעולת קידוד או פענוח.

כדי לתקן את הדוגמה שמוצגת למעלה, צריך לכלול את הרכיב <Password> במדיניות כמו בדוגמה הבאה:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
    <DisplayName>ApplyBasicAuthHeader</DisplayName>
    <Operation>Encode</Operation>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <User ref="BasicAuth.credentials.username"/>
    <Password ref="BasicAuth.credentials.password"/>
    <AssignTo createNew="false">request.header.Authorization</AssignTo>
</BasicAuthentication>

AssignToRequired

הודעת השגיאה

פריסת ה-proxy ל-API דרך ממשק המשתמש או ה-API של Apigee נכשלת ומוצגת הודעת השגיאה הבאה:

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: AssignTo element must be present for operation operation.

דוגמה להודעת שגיאה

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: AssignTo element must be present for Encode operation.

צילום מסך לדוגמה

מטרה

פריסת ה-API Proxy נכשלת אם רכיב <AssignTo> לא מוגדר במדיניות BasicAuthentication. רכיב <AssignTo> הוא חובה גם לפעולות Encode וגם לפעולות Decode.

אבחון

  1. בודקים את כל כללי המדיניות של BasicAuthentication שמשמשים ב-proxy ל-API. אם יש מדיניות שבה לא מוגדר הרכיב <AssignTo>, זו הסיבה לשגיאה. חובה להגדיר את הרכיב <AssignTo> במדיניות BasicAuthentication גם לפעולות Encode וגם לפעולות Decode.

    מדיניות BasicAuthentication לדוגמה שמוצגת בהמשך משמשת לפעולת Encode, אבל לא מוגדר בה רכיב <AssignTo>:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <BasicAuthentication name="ApplyBasicAuthHeader">
      <DisplayName>ApplyBasicAuthHeader</DisplayName>
      <Operation>Encode</Operation>
      <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
      <User ref="BasicAuth.credentials.username"/>
      <Password ref="BasicAuth.credentials.password"/>
    </BasicAuthentication>
    

    הפריסה נכשלת עם השגיאה הבאה:

    BasicAuthenticationPolicy: AssignTo element must be present for Encode operation.
    

רזולוציה

מוודאים שהרכיב <AssignTo> מוגדר במדיניות BasicAuthentication עבור פעולת קידוד או פענוח.

כדי לתקן את הדוגמה שמוצגת למעלה, צריך לכלול את הרכיב <AssignTo> במדיניות כמו בדוגמה הבאה:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
    <DisplayName>ApplyBasicAuthHeader</DisplayName>
    <Operation>Encode</Operation>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <User ref="BasicAuth.credentials.username"/>
    <Password ref="BasicAuth.credentials.password"/>
    <AssignTo createNew="false">request.header.Authorization</AssignTo>
</BasicAuthentication>

SourceRequired

הודעת השגיאה

פריסת ה-proxy ל-API דרך ממשק המשתמש או ה-API של Apigee נכשלת ומוצגת הודעת השגיאה הבאה:

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: Source element must be present for Decode operation.

דוגמה להודעת שגיאה

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: Source element must be present for Decode operation.

צילום מסך לדוגמה

מטרה

פריסת ה-API Proxy נכשלת אם רכיב <Source> לא מוגדר במדיניות BasicAuthentication שמשמשת לפענוח הפעולה. רכיב <Source> הוא חובה אם <Operation> מוגדר כ-Decode במדיניות BasicAuthentication.

אבחון

  1. בודקים את כל כללי המדיניות של BasicAuthentication שמשמשים ב-proxy ל-API. אם יש מדיניות שבה הרכיב <Source> לא מוגדר והרכיב <Operation> מוגדר כ-Decode, זו הסיבה לשגיאה. האלמנט <Source> הוא חובה אם המדיניות <Operation> מוגדרת כ-Decode במדיניות BasicAuthentication.

    מדיניות BasicAuthentication לדוגמה שמוצגת בהמשך משמשת לפעולה Decode, אבל לא מוגדר בה הרכיב <Source>:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <BasicAuthentication name="ApplyBasicAuthHeader">
      <DisplayName>ApplyBasicAuthHeader</DisplayName>
      <Operation>Decode</Operation>
      <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
      <User ref="BasicAuth.credentials.username"/>
      <Password ref="BasicAuth.credentials.password"/>
      <AssignTo createNew="false">request.header.Authorization</AssignTo>
    </BasicAuthentication>
    

    הפריסה נכשלת עם השגיאה הבאה:

    BasicAuthenticationPolicy: Source element must be present for Decode operation.
    

רזולוציה

חשוב לוודא שהרכיב <Source> מוגדר במדיניות BasicAuthentication כשמשתמשים בו לפעולה Decode.

כדי לתקן את הדוגמה שמוצגת למעלה, צריך לכלול את הרכיב <Source>במדיניות, כמו שמוצג למטה:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
    <DisplayName>ApplyBasicAuthHeader</DisplayName>
    <Operation>Decode</Operation>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <User ref="BasicAuth.credentials.username"/>
    <Password ref="BasicAuth.credentials.password"/>
    <AssignTo createNew="false">request.header.Authorization</AssignTo>
    <Source>request.header.Authorization</Source>
</BasicAuthentication>