การแก้ปัญหาข้อผิดพลาดในการทำให้นโยบาย Basic Authentication ใช้งานได้

คุณกำลังดูเอกสารประกอบของ Apigee Edge
ไปที่เอกสารประกอบของ Apigee X
ข้อมูล

UserNameRequired

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ 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 ใช้งานได้จะไม่สำเร็จ หากไม่มีการกำหนดองค์ประกอบ <User> ในนโยบาย Basic Authentication องค์ประกอบ <User> จำเป็นสำหรับการดำเนินการเข้ารหัสและถอดรหัส

การวินิจฉัย

  1. ตรวจสอบนโยบาย Basic Authenticator ทั้งหมดที่ใช้ในพร็อกซี API หากมีนโยบายที่ไม่ได้ระบุองค์ประกอบ <User> นั่นเป็นสาเหตุของข้อผิดพลาด องค์ประกอบ <User> เป็นองค์ประกอบที่จำเป็นในนโยบาย Basic Authentication สำหรับการดำเนินการเข้ารหัสหรือถอดรหัส

    ตัวอย่างนโยบาย Basic Authentication ที่แสดงด้านล่างนี้ใช้ในการดำเนินการเข้ารหัส แต่ไม่ได้กำหนดองค์ประกอบ <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> ภายในนโยบาย Basic Authentication สำหรับการดำเนินการเข้ารหัสหรือถอดรหัส

หากต้องการแก้ไขตัวอย่างที่แสดงข้างต้น ให้ใส่องค์ประกอบ <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 ผ่าน Edge UI หรือ 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 ใช้งานได้จะไม่สำเร็จ หากไม่มีการกำหนดองค์ประกอบ <Password> ในนโยบาย Basic Authentication องค์ประกอบ <Password> จำเป็นสำหรับการดำเนินการเข้ารหัสและถอดรหัส

การวินิจฉัย

  1. ตรวจสอบนโยบาย Basic Authenticator ทั้งหมดที่ใช้ในพร็อกซี API หากมีนโยบายที่ไม่ได้กำหนดองค์ประกอบ <Password> ไว้ นั่นหมายถึงสาเหตุของข้อผิดพลาด ต้องระบุองค์ประกอบ <Password> ในนโยบายการตรวจสอบสิทธิ์ขั้นพื้นฐานสำหรับการดำเนินการเข้ารหัสหรือถอดรหัส

    ตัวอย่างนโยบาย Basic Authentication ที่แสดงด้านล่างนี้ใช้ในการดำเนินการเข้ารหัส แต่ไม่ได้กำหนดองค์ประกอบ <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> ภายในนโยบาย Basic Authentication สำหรับการดำเนินการเข้ารหัสหรือถอดรหัส

หากต้องการแก้ไขตัวอย่างที่แสดงข้างต้น ให้ใส่องค์ประกอบ <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 ผ่าน Edge UI หรือ 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 ใช้งานได้จะไม่สำเร็จ หากไม่มีการกำหนดองค์ประกอบ <AssignTo> ในนโยบาย Basic Authentication องค์ประกอบ <AssignTo> จำเป็นสำหรับการดำเนินการเข้ารหัสและถอดรหัส

การวินิจฉัย

  1. ตรวจสอบนโยบาย Basic Authenticator ทั้งหมดที่ใช้ในพร็อกซี API หากมีนโยบายที่ไม่ได้กำหนดองค์ประกอบ <AssignTo> ไว้ นั่นหมายถึงสาเหตุของข้อผิดพลาด คุณต้องระบุองค์ประกอบ <AssignTo> ในนโยบาย Basic Authentication สำหรับการดำเนินการทั้งการเข้ารหัสและถอดรหัส

    ตัวอย่างนโยบาย Basic Authentication ที่แสดงด้านล่างนี้ใช้ในการดำเนินการเข้ารหัส แต่ไม่ได้กำหนดองค์ประกอบ <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> ภายในนโยบาย Basic Authentication สำหรับการดำเนินการเข้ารหัสหรือถอดรหัส

หากต้องการแก้ไขตัวอย่างที่แสดงข้างต้น ให้ใส่องค์ประกอบ <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 ผ่าน Edge UI หรือ 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 ใช้งานได้จะไม่สำเร็จ หากไม่มีการกำหนดองค์ประกอบ <Source> ในนโยบาย Basic Authentication ที่ใช้สำหรับถอดรหัส ต้องระบุองค์ประกอบ <Source> หากระบุ <Operation> เป็น Decode ในนโยบายการตรวจสอบสิทธิ์ขั้นพื้นฐาน

การวินิจฉัย

  1. ตรวจสอบนโยบาย Basic Authenticator ทั้งหมดที่ใช้ในพร็อกซี API หากมีนโยบายที่ไม่ได้กำหนดองค์ประกอบ <Source> และองค์ประกอบ <Operation> กำหนดเป็น Decode ก็จะทำให้เกิดข้อผิดพลาด ต้องระบุองค์ประกอบ <Source> หากระบุ <Operation> เป็น Decode ในนโยบายการตรวจสอบสิทธิ์ขั้นพื้นฐาน

    ตัวอย่างนโยบายการตรวจสอบสิทธิ์ขั้นพื้นฐานที่แสดงด้านล่างใช้สำหรับการดำเนินการ 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> ในนโยบายการตรวจสอบสิทธิ์ขั้นพื้นฐานเมื่อใช้สำหรับการดำเนินการ 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>