<ph type="x-smartling-placeholder"></ph>
您正在查看 Apigee Edge 文档。
转到
Apigee X 文档。 信息
UserNameRequired
错误消息
通过 Edge 界面或 Edge Management API 部署 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.
示例屏幕截图

原因
如果未在 BasicAuthentication 政策中定义 <User> 元素,则 API 代理的部署会失败。<User> 元素对于编码和解码操作是必需的。
诊断
检查 API 代理中使用的所有 BasicAuthentication 政策。如果有任何政策未指定
<User>元素,那么这就是错误的原因。在 BasicAuthentication 政策中,<User>元素对于编码和解码操作是必需的。下面的 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.
解决方法
请确保在用于编码或解码操作的 BasicAuthentication 政策中定义 <User> 元素。
如需更正上述示例,请在政策中包含 <User> 元素,如下所示:
<?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"?
BasicAuthenticati>on na<me="Ap>plyBasicAuthHeader&q<uot;
Dis>playN<ameApplyB>asicAu<thHeader/D>ispla<yName
OperationEncode>/Oper<ation
IgnoreUnresolved>Varia<blesfalse/IgnoreUnresolvedVariables
Us>er re<f="BasicAuth.credentials.username"/
> P<assword ref="BasicAut>h.credentials.password"</
Ass>i<gnTo createNew=">;false"request.header.Authorization/AssignTo
/BasicAuthentication
PasswordRequired
错误消息
通过 Edge 界面或 Edge Management API 部署 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.
示例屏幕截图

原因
如果未在 BasicAuthentication 政策中定义 <Password> 元素,则 API 代理的部署会失败。<Password> 元素对于编码和解码操作是必需的。
诊断
检查 API 代理中使用的所有 BasicAuthentication 政策。如果存在任何未定义
<Password>元素的任何政策,就会导致此错误。在用于编码或解码操作的 BasicAuthentication 政策中,<Password>元素是必需的。下面的 BasicAuthentication 政策示例用于编码操作,但没有定义
<Password>元素:<?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"? BasicAuthenticati>on <name=">ApplyBasicAuthHeader<" Dis>pla<yNameAppl>yBasic<AuthHeader>/Di<splayName OperationEnco>de/Op<eration IgnoreUnresolved>Var<iablesfalse/IgnoreUnresolvedVariables Us>er <ref="BasicAuth.creden>tials.username"/ Assi<gnTo crea>t<eNew="false&quo>t;request.header.Authorization/AssignTo /BasicAuthentication部署失败并显示以下错误:
BasicAuthenticationPolicy: Password element must be present for Encode operation.
解决方法
请确保在用于编码或解码操作的 BasicAuthentication 政策中定义 <Password> 元素。
如需更正上述示例,请在政策中包含 <Password> 元素,如下所示:
<?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"?
BasicAuthenticati>on na<me="Ap>plyBasicAuthHeader&q<uot;
Dis>playN<ameApplyB>asicAu<thHeader/D>ispla<yName
OperationEncode>/Oper<ation
IgnoreUnresolved>Varia<blesfalse/IgnoreUnresolvedVariables
Us>er re<f="BasicAuth.credentials.username"/
> P<assword ref="BasicAut>h.credentials.password"</
Ass>i<gnTo createNew=">;false"request.header.Authorization/AssignTo
/BasicAuthentication
AssignToRequired
错误消息
通过 Edge 界面或 Edge Management API 部署 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.
示例屏幕截图

原因
如果未在 BasicAuthentication 政策中定义 <AssignTo> 元素,则 API 代理的部署会失败。<AssignTo> 元素对于编码和解码操作是必需的。
诊断
检查 API 代理中使用的所有 BasicAuthentication 政策。如果存在任何未定义
<AssignTo>元素的政策,就会导致此错误。对于编码和解码操作,必须在 BasicAuthentication 政策中定义<AssignTo>元素。下面的 BasicAuthentication 政策示例用于编码操作,但没有定义
<AssignTo>元素:<?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"? BasicAuthenticati>on <name=">ApplyBasicAuthHeader<" Dis>pla<yNameAppl>yBasic<AuthHeader>/Di<splayName OperationEnco>de/Op<eration IgnoreUnresolved>Var<iablesfalse/IgnoreUnresolvedVariables Us>er <ref="BasicAuth.credentials.username">/< Password ref=&quo>t;BasicAuth.credentials.password"/ /BasicAuthentication部署失败并显示以下错误:
BasicAuthenticationPolicy: AssignTo element must be present for Encode operation.
解决方法
请确保在用于编码或解码操作的 BasicAuthentication 政策中定义 <AssignTo> 元素。
如需更正上述示例,请在政策中包含 <AssignTo> 元素,如下所示:
<?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"?
BasicAuthenticati>on na<me="Ap>plyBasicAuthHeader&q<uot;
Dis>playN<ameApplyB>asicAu<thHeader/D>ispla<yName
OperationEncode>/Oper<ation
IgnoreUnresolved>Varia<blesfalse/IgnoreUnresolvedVariables
Us>er re<f="BasicAuth.credentials.username"/
> P<assword ref="BasicAut>h.credentials.password"</
Ass>i<gnTo createNew=">;false"request.header.Authorization/AssignTo
/BasicAuthentication
SourceRequired
错误消息
通过 Edge 界面或 Edge Management API 部署 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.
示例屏幕截图

原因
如果未在用于解码操作的 BasicAuthentication 政策中定义 <Source> 元素,则 API 代理的部署会失败。如果 BasicAuthentication 政策中的 <Operation> 指定为 Decode,则 <Source> 元素是必填的。
诊断
检查 API 代理中使用的所有 BasicAuthentication 政策。如果有任何政策的
<Source>元素未定义,且<Operation>元素定义为Decode,就会导致此错误。如果 BasicAuthentication 政策中的<Operation>指定为Decode,则<Source>元素是必填的。下面的 BasicAuthentication 政策示例用于
Decode操作,但没有定义<Source>元素:<?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"? BasicAuthenticati>on <name=">ApplyBasicAuthHeader<" Dis>pla<yNameAppl>yBasic<AuthHeader>/Di<splayName OperationDeco>de/Op<eration IgnoreUnresolved>Var<iablesfalse/IgnoreUnresolvedVariables Us>er <ref="BasicAuth.credentials.username">/ < Password ref="BasicA>uth.credentials.password&quo<t;/ Ass>i<gnTo createNew=">;false"request.header.Authorization/AssignTo /BasicAuthentication部署失败并显示以下错误:
BasicAuthenticationPolicy: Source element must be present for Decode operation.
解决方法
确保在用于 Decode 操作时,定义 BasicAuthentication 政策中 <Source> 元素。
如需更正上述示例,请在政策中包含 <Source> 元素,如下所示:
<?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"?
BasicAuthenticati>on na<me="Ap>plyBasicAuthHeader&q<uot;
Dis>playN<ameApplyB>asicAu<thHeader/D>ispla<yName
OperationDecode>/Oper<ation
IgnoreUnresolved>Varia<blesfalse/IgnoreUnresolvedVariables
Us>er re<f="BasicAuth.credentials.username"/
> P<assword ref="BasicAut>h.credentials.password"</
Ass>ignTo< creat>eNew="false"reques<t.heade>r<.Authorization/Assig>nTo
Sourcerequest.header.Authorization/Source
/BasicAuthentication