我正在尝试查找导致基本登录对话框在访问受保护端点时提示的原因。我们支持 SSL 并使用 Taffy REST 框架。
我指的http基本登录是这样的https://www.httpwatch.com/httpgallery/authentication/#showExample10 (点击“显示图像”按钮)
我们的 onTaffyRequest 代码
function onTaffyRequest(verb, cfc, requestArguments, mimeExt, headers, methodMetadata, matchedURI){
//get username and password
structAuth = structnew();
structAuth = getBasicAuthCredentials();
structAuth.authenticated = false;
local.status = "forbidden";
/*<!--- Get request from ColdFusion page contenxt. --->*/
objRequest = GetPageContext().GetRequest();
/*<!--- Get requested URL from request object. --->*/
requestArguments.strUrl = objRequest.GetRequestUrl().Append(
"?" & objRequest.GetQueryString()
).ToString();
/* CATCH NO BASIC auth*/
//if username is blank return false
if (structAuth.username is ""){
return representationOf( local.status ).withStatus(401);
}
//check invalid password
if(structAuth.password is ""){
return representationOf( local.status ).withStatus(401);
}
return true;
}
是否objRequest = GetPageContext().GetRequest(); 出现登录提示?