如何在Chrome扩展程序中删除代理授权缓存? [英] How to delete Proxy-Authorization Cache on Chrome extension?
问题描述
我正在为chrome构建代理客户端"扩展程序,并且出现以下情况:
I am building a "proxy client" extension for chrome and i have following scenario:
- 用户可以登录扩展名并从API获取令牌.令牌的有效期为2个小时.
- 登录后,用户可以从列表中选择代理服务器,并使用 chrome.proxy api.
- 我在代理服务器上使用Squid.当用户连接到代理服务器并登陆到 onAuthRequired 时,我将电子邮件和令牌作为authCredentials返回./li>
- Users can login to the extension and get a token from API. Tokens are valid for 2 hours.
- After login users can select a proxy server from a list and that proxy is set with chrome.proxy api.
- I am using Squid on proxy servers. When a user connects to a proxy server and lands on onAuthRequired i return email and token as authCredentials.
Chrome使用缓存中的那些凭据,直到令牌不再有效,并且代理服务器响应"407,需要代理身份验证".现在,我在这里面临的问题是,当我在同一浏览器上用另一个用户名登录并连接到同一代理服务器时,它仍然将旧用户凭据发送到服务器,因为它们仍然有效.我的问题是如何删除chromes代理身份验证缓存,以便它再次登陆onAuthRequired,并且我可以返回新用户凭据.
Chrome uses those credentials from cache until token is not valid anymore and proxy server responses "407, Proxy Authentication Required". Now the problem i am facing here is when i login with another username on same browser and connect to same proxy server it still sends old users credentials to the server because they are still valid. My question is how can delete chromes proxy auth cache so that it lands onAuthRequired again and i can return new users Credentials.
当用户通过代理服务器发出他的第一个请求以强制onAuthRequired但它不起作用时,我尝试将代理服务器的响应修改为"407,需要代理身份验证".Chrome仍然使用缓存,并且仍将旧用户的凭据返回到代理服务器.
I tried to modify the response from proxy server to "407, Proxy Authentication Required" when user makes his first request over the proxy server to force a onAuthRequired but its not working. Chrome still uses cache and still returns credentials from old user to the proxy server.
推荐答案
您是否尝试过在webRequest API中连接另一个事件处理程序,以便在Chrome进行身份验证之前操纵http标头?
Have you tried to hook up another event handler within the webRequest API in order to manipulate the http headers before Chrome takes on authentication?
例如onBeforeSendHeaders或onHeadersReceived
E.g. onBeforeSendHeaders or onHeadersReceived
这篇关于如何在Chrome扩展程序中删除代理授权缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!