Rozwiązywanie problemów z wdrażaniem zasad podstawowego uwierzytelniania

Wyświetlasz dokumentację Apigee Edge.
Otwórz dokumentację Apigee X.
info

UserNameRequired

Komunikat o błędzie

Wdrażanie serwera proxy interfejsu API za pomocą interfejsu Edge UI lub interfejsu Edge Management API kończy się niepowodzeniem i wyświetla ten komunikat o błędzie:

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

Przykładowy komunikat o błędzie

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

Przykładowy zrzut ekranu

Przyczyna

Wdrożenie serwera proxy interfejsu API nie powiedzie się, jeśli element <User> nie jest zdefiniowany w zasadzie BasicAuthentication. Element <User> jest wymagany w przypadku operacji kodowania i dekodowania.

Diagnostyka

  1. Sprawdź wszystkie zasady BasicAuthentication używane w proxy interfejsu API. Jeśli w którychkolwiek zasadach element <User> nie jest określony, to jest to przyczyną błędu. Element <User> jest wymagany w zasadach BasicAuthentication w przypadku operacji Encode i Decode.

    Przykładowa zasada BasicAuthentication pokazana poniżej jest używana w operacji Encode, ale nie ma zdefiniowanego elementu <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>
    

    Wdrożenie nie powiodło się z powodu tego błędu:

    BasicAuthenticationPolicy: Username element must be present for Encode operation.
    

Rozdzielczość

Sprawdź, czy element <User> jest zdefiniowany w zasadach BasicAuthentication dla operacji Encode lub Decode.

Aby poprawić przykład pokazany powyżej, umieść element <User> w zasadach, jak pokazano poniżej:

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

Komunikat o błędzie

Wdrażanie serwera proxy interfejsu API za pomocą interfejsu Edge UI lub interfejsu Edge Management API kończy się niepowodzeniem i wyświetla ten komunikat o błędzie:

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

Przykładowy komunikat o błędzie

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

Przykładowy zrzut ekranu

Przyczyna

Wdrożenie serwera proxy interfejsu API nie powiedzie się, jeśli element <Password> nie jest zdefiniowany w zasadzie BasicAuthentication. Element <Password> jest wymagany w przypadku operacji kodowania i dekodowania.

Diagnostyka

  1. Sprawdź wszystkie zasady BasicAuthentication używane w proxy interfejsu API. Jeśli w którejkolwiek zasadzie nie zdefiniowano elementu <Password>, to jest to przyczyną błędu. Element <Password> jest wymagany w zasadach BasicAuthentication w przypadku operacji Encode lub Decode.

    Przykładowa zasada BasicAuthentication pokazana poniżej jest używana w operacji Encode, ale nie ma zdefiniowanego elementu <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>
    

    Wdrożenie nie powiodło się z powodu tego błędu:

    BasicAuthenticationPolicy: Password element must be present for Encode operation.
    

Rozdzielczość

Sprawdź, czy element <Password> jest zdefiniowany w zasadach BasicAuthentication dla operacji Encode lub Decode.

Aby poprawić przykład pokazany powyżej, umieść element <Password> w zasadach, jak pokazano poniżej:

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

Komunikat o błędzie

Wdrażanie serwera proxy interfejsu API za pomocą interfejsu Edge UI lub interfejsu Edge Management API kończy się niepowodzeniem i wyświetla ten komunikat o błędzie:

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

Przykładowy komunikat o błędzie

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

Przykładowy zrzut ekranu

Przyczyna

Wdrożenie serwera proxy interfejsu API nie powiedzie się, jeśli element <AssignTo> nie jest zdefiniowany w zasadzie BasicAuthentication. Element <AssignTo> jest wymagany w przypadku operacji kodowania i dekodowania.

Diagnostyka

  1. Sprawdź wszystkie zasady BasicAuthentication używane w proxy interfejsu API. Jeśli w którejkolwiek zasadzie element <AssignTo> nie jest zdefiniowany, to jest to przyczyną błędu. Element <AssignTo> musi być zdefiniowany w zasadach BasicAuthentication zarówno w przypadku operacji Encode, jak i Decode.

    Przykładowa zasada BasicAuthentication pokazana poniżej jest używana w operacji Encode, ale nie ma zdefiniowanego elementu <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>
    

    Wdrożenie nie powiodło się z powodu tego błędu:

    BasicAuthenticationPolicy: AssignTo element must be present for Encode operation.
    

Rozdzielczość

Sprawdź, czy element <AssignTo> jest zdefiniowany w zasadach BasicAuthentication dla operacji Encode lub Decode.

Aby poprawić przykład pokazany powyżej, umieść element <AssignTo> w zasadach, jak pokazano poniżej:

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

Komunikat o błędzie

Wdrażanie serwera proxy interfejsu API za pomocą interfejsu Edge UI lub interfejsu Edge Management API kończy się niepowodzeniem i wyświetla ten komunikat o błędzie:

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

Przykładowy komunikat o błędzie

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

Przykładowy zrzut ekranu

Przyczyna

Wdrożenie serwera proxy interfejsu API nie powiedzie się, jeśli element <Source> nie jest zdefiniowany w zasadach BasicAuthentication używanych do operacji dekodowania. Element <Source> jest wymagany, jeśli w zasadach BasicAuthentication element <Operation> ma wartość Decode.

Diagnostyka

  1. Sprawdź wszystkie zasady BasicAuthentication używane w proxy interfejsu API. Jeśli w którychkolwiek zasadach element <Source> nie jest zdefiniowany, a element <Operation> jest zdefiniowany jako Decode, to jest to przyczyną błędu. Element <Source> jest wymagany, jeśli w zasadach BasicAuthentication element <Operation> ma wartość Decode.

    Przykładowa zasada BasicAuthentication pokazana poniżej jest używana w operacji Decode, ale nie ma zdefiniowanego elementu <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>
    

    Wdrożenie nie powiodło się z powodu tego błędu:

    BasicAuthenticationPolicy: Source element must be present for Decode operation.
    

Rozdzielczość

Sprawdź, czy element <Source> jest zdefiniowany w zasadach BasicAuthentication, gdy jest używany w operacji Decode.

Aby poprawić przykład pokazany powyżej, umieść element <Source> w zasadach, jak pokazano poniżej:

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