Pemecahan masalah error deployment kebijakan BasicAuthentication

Anda sedang melihat dokumentasi Apigee Edge.
Buka dokumentasi Apigee X.
info

UserNameRequired

Pesan error

Deployment proxy API melalui UI Edge atau Edge management API gagal dengan pesan error ini:

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

Contoh pesan error

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

Contoh screenshot

Penyebab

Deployment Proxy API akan gagal jika elemen <User> tidak ditentukan dalam kebijakan BasicAuthentication. Elemen <User> bersifat wajib untuk operasi Encode dan Decode.

Diagnosis

  1. Periksa semua kebijakan BasicAuthentication yang digunakan dalam proxy API. Jika ada kebijakan saat elemen <User> tidak ditentukan, berarti itulah penyebab error. Elemen <User> bersifat wajib dalam kebijakan BasicAuthentication untuk operasi Encode atau Decode.

    Contoh kebijakan BasicAuthentication yang ditampilkan di bawah digunakan untuk operasi Encode, tetapi tidak memiliki elemen <User> yang ditentukan:

    <?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>
    

    Deployment gagal dengan error di bawah ini:

    BasicAuthenticationPolicy: Username element must be present for Encode operation.
    

Resolusi

Pastikan elemen <User> ditentukan dalam kebijakan BasicAuthentication untuk operasi Encode atau Decode.

Untuk memperbaiki contoh yang ditampilkan di atas, sertakan elemen <User> dalam kebijakan seperti yang ditunjukkan di bawah ini:

<?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

Pesan error

Deployment proxy API melalui UI Edge atau Edge management API gagal dengan pesan error ini:

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

Contoh pesan error

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

Contoh screenshot

Penyebab

Deployment Proxy API akan gagal jika elemen <Password> tidak ditentukan dalam kebijakan BasicAuthentication. Elemen <Password> bersifat wajib untuk operasi Encode dan Decode.

Diagnosis

  1. Periksa semua kebijakan BasicAuthentication yang digunakan dalam proxy API. Jika ada kebijakan saat elemen <Password> tidak ditentukan, berarti itulah penyebab error. Elemen <Password> bersifat wajib dalam kebijakan BasicAuthentication untuk operasi Encode atau Decode.

    Contoh kebijakan BasicAuthentication yang ditampilkan di bawah digunakan untuk operasi Encode, tetapi tidak memiliki elemen <Password> yang ditentukan:

    <?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>
    

    Deployment gagal dengan error di bawah ini:

    BasicAuthenticationPolicy: Password element must be present for Encode operation.
    

Resolusi

Pastikan elemen <Password> ditentukan dalam kebijakan BasicAuthentication untuk operasi Encode atau Decode.

Untuk memperbaiki contoh yang ditampilkan di atas, sertakan elemen <Password> dalam kebijakan seperti yang ditunjukkan di bawah ini:

<?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

Pesan error

Deployment proxy API melalui UI Edge atau Edge management API gagal dengan pesan error ini:

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

Contoh pesan error

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

Contoh screenshot

Penyebab

Deployment Proxy API akan gagal jika elemen <AssignTo> tidak ditentukan dalam kebijakan BasicAuthentication. Elemen <AssignTo> bersifat wajib untuk operasi Encode dan Decode.

Diagnosis

  1. Periksa semua kebijakan BasicAuthentication yang digunakan dalam proxy API. Jika ada kebijakan saat elemen <AssignTo> tidak ditentukan, berarti itulah penyebab error. Elemen <AssignTo> harus ditentukan dalam kebijakan BasicAuthentication untuk operasi Encode dan Decode.

    Contoh kebijakan BasicAuthentication yang ditampilkan di bawah digunakan untuk operasi Encode, tetapi tidak memiliki elemen <AssignTo> yang ditentukan:

    <?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>
    

    Deployment gagal dengan error di bawah ini:

    BasicAuthenticationPolicy: AssignTo element must be present for Encode operation.
    

Resolusi

Pastikan elemen <AssignTo> ditentukan dalam kebijakan BasicAuthentication untuk operasi Encode atau Decode.

Untuk memperbaiki contoh yang ditampilkan di atas, sertakan elemen <AssignTo> dalam kebijakan seperti yang ditunjukkan di bawah ini:

<?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

Pesan error

Deployment proxy API melalui UI Edge atau Edge management API gagal dengan pesan error ini:

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

Contoh pesan error

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

Contoh screenshot

Penyebab

Deployment Proxy API gagal jika elemen <Source> tidak ditentukan dalam kebijakan BasicAuthentication yang digunakan untuk operasi decoding. Elemen <Source> bersifat wajib jika <Operation> ditetapkan sebagai Decode dalam kebijakan BasicAuthentication.

Diagnosis

  1. Periksa semua kebijakan BasicAuthentication yang digunakan dalam proxy API. Jika ada kebijakan yang mengharuskan elemen <Source> tidak ditentukan dan elemen <Operation> ditentukan sebagai Decode, berarti itulah penyebab error. Elemen <Source> bersifat wajib jika <Operation> ditetapkan sebagai Decode dalam kebijakan BasicAuthentication.

    Contoh kebijakan BasicAuthentication yang ditampilkan di bawah digunakan untuk operasi Decode, tetapi tidak memiliki elemen <Source> yang ditentukan:

    <?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>
    

    Deployment gagal dengan error di bawah ini:

    BasicAuthenticationPolicy: Source element must be present for Decode operation.
    

Resolusi

Pastikan elemen <Source> ditentukan dalam kebijakan BasicAuthentication saat digunakan untuk operasi Decode.

Untuk memperbaiki contoh yang ditampilkan di atas, sertakan elemen <Source> dalam kebijakan seperti yang ditunjukkan di bawah ini:

<?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>