可以在Java中使用链接发送基本身份验证 [英] Possible to Send Basic Auth in Link in Java

查看:135
本文介绍了可以在Java中使用链接发送基本身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在链接中发送基本身份验证凭据?我尝试过 http:// username:password@anapi.com ,但它无法正常工作(在chrome上mac,它一直告诉我提供APIKey,在这种情况下是密码)。如果可能,我需要能够让用户单击链接并提供这些凭据。

Is it possible to send basic auth credentials in a link? I have tried http://username:password@anapi.com but it's not working (in chrome on a mac, it keeps telling me to provide APIKey, which is password in this case). I need to be able to have a user click on a link and provide these credentials, if possible.

链接有时是大文件(< 1 gig)。所以,而不是我,下载有问题的文件我想构建一个指向它的链接,并让用户下载它。

The link is to sometimes huge files (< 1 gig). So instead of me, downloading the file in question I would like to just construct a link that points to it, and have the user download it.

这是Java,因为我正在创建一个Java Portlet,但我可以像html元素一样构建链接:

It's in Java because I'm making a Java Portlet, but I can construct the link just like an html element:

<a href="https://username:password@google.com">Click here!</a>

任何建议都会有所帮助,
谢谢!

Any advice would help, Thanks!

推荐答案

我记得一篇特定的Microsoft支持文章,其中明确删除了浏览器支持,将密码包含在这样的URL中;其他浏览器也可能会这样做。

I remember a specific Microsoft support article in which they explicitly dropped browser support for including passwords in URLs like this; it's probable that other browsers did too.

编辑:这里是文章。

这篇关于可以在Java中使用链接发送基本身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆