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

אתם צופים במסמכי התיעוד של Apigee Edge.
כדאי לעיין במסמכי התיעוד של Apigee X.
מידע

UserNameRequired

הודעת שגיאה

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

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 דרך ממשק המשתמש של Edge או Edge management API נכשלת עם הודעת השגיאה הבאה:

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 דרך ממשק המשתמש של Edge או Edge management API נכשלת עם הודעת השגיאה הבאה:

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 דרך ממשק המשתמש של Edge או Edge management API נכשלת עם הודעת השגיאה הבאה:

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>