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

כרגע מוצג התיעוד של Apigee Edge.
כניסה למסמכי התיעוד של Apigee X.
מידע

UserNameRequired

הודעת השגיאה

כשפורסים את ה-API של ה-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.

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

סיבה

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

אבחון

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

    מדיניות BasicAuthentication לדוגמה שמוצגת למטה משמשת לפעולת קידוד, אבל לא מוגדר בה הרכיב <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

הודעת השגיאה

כשפורסים את ה-API של ה-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.

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

סיבה

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

אבחון

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

    מדיניות 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"/>
      <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

הודעת השגיאה

כשפורסים את ה-API של ה-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.

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

סיבה

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

אבחון

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

    מדיניות 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"/>
    </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

הודעת השגיאה

כשפורסים את ה-API של ה-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 של ממשק ה-API תיכשל אם הרכיב <Source> לא מוגדר במדיניות BasicAuthentication שמשמשת לפעולת פענוח. הרכיב <Source> הוא חובה אם <Operation> מצוין כ-Decode במדיניות BasicAuthentication.

אבחון

  1. בודקים את כל כללי המדיניות BasicAuthentication שמשמשים ב-API של שרת ה-proxy. אם יש מדיניות שבה הרכיב <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>