401 Unauthorized 客户试图未经授权访问受密码保护的页面。应答中会包含一个WWW-Authenticate头,浏览器据此显示用户名字/密码对话框,然后在填写合适的Authorization头后再次发出请求。
response.setHeader("Cache-Control", "no-store");
response.setDateHeader("Expires", 0);
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setHeader("WWW-Authenticate","Basic realm=\"SNS Secure Area\"");
获取用户名密码为:
sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
String authorization = request.getHeader("authorization");
System.out.println("authorization:"+authorization);
String userName = null;
String password = null;
if (authorization != null && authorization.length()>0) {
if (authorization.startsWith("Basic")){
authorization = authorization.substring(authorization.indexOf(' ')+1);
byte[] bytes = decoder.decodeBuffer(authorization);
authorization = new String(bytes);
userName = authorization.substring(0,authorization.indexOf(':'));
password = authorization.substring(authorization.indexOf(':')+1);
System.out.println("userName:"+userName);
System.out.println("password:"+password);
}else if (authorization.startsWith("Digest")){
userName = authorization.substring(authorization.indexOf("username="));
userName = userName.substring("username=\"".length());
userName = userName.substring(0,userName.indexOf('"'));
password = authorization.substring(authorization.indexOf("response="));
password = password.substring("response=\"".length());
password = password.substring(0,password.indexOf('"'));
}
System.out.println("userName:"+userName+"\npassword:"+password);
}
05:19:08,515 INFO [STDOUT] ====================x-requested-with:XMLHttpRequest
05:19:11,421 INFO [STDOUT] ====================accept-language:zh-cn
05:19:13,078 INFO [STDOUT] ====================referer:http://localhost:8080/ams/lephone/2.5/appreview.do?lcaid=4104
05:19:14,218 INFO [STDOUT] ====================accept:*/*
05:19:18,203 INFO [STDOUT] ====================content-type:application/x-www-form-urlencoded
05:19:47,343 INFO [STDOUT] ====================accept-encoding:gzip, deflate
05:19:20,734 INFO [STDOUT] ====================user-agent:Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2)
05:19:48,656 INFO [STDOUT] ====================host:localhost:8080
05:19:22,750 INFO [STDOUT] ====================content-length:48
05:19:49,921 INFO [STDOUT] ====================connection:Keep-Alive
05:19:50,578 INFO [STDOUT] ====================cache-control:no-cache
05:19:25,421 INFO [STDOUT] ====================cookie:JSESSIONID=D744F0509E590D7F3EA343326882BDEA; clientid=null661a1d2a5e97432c80ebf82fb23da2bb; lpsust=""
05:19:26,343 INFO [STDOUT] ====================authorization:Basic b29vb29vb29vbzpkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRk
分享到:
相关推荐
401 Unauthorized 客户试图未经授权访问受密码保护的页面。应答中会包含一个WWW-Authenticate头,浏览器据此显示用户名字/密码对话框,然后在填写合适的Authorization头后再次发出请求。 403 Forbidden 资源不可用...
consul可以进入后台,威胁敏感信息,对网络设备进行操作
1、错误号401.1 2、错误号401.2 3、错误号:401.3
使用Angular、AngularDevise和AngularUI从401Unauthorized响
zookeeper未授权访问修复建议
我们在使用spring cloud时如果设置了oauth2授权模式,那么应用服务A再调用服务B时使用Feign请求会出现401授权认证的问题,那么解决办法就是在feign调用请求时获取到assessToken并设置到请求header中就可以解决这个...
未经授权的检查 扫描以下常见未授权访问 redis、mongodb、memcached、elasticsearch、zookeeper、ftp、CouchDB、docker、Hadoop 安装 pip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/...
信息安全的持续问题是组织内部人员的威胁,其中一个例子是未经授权的信息访问。 解决此问题的长期方法是最小特权原则,该原则要求系统用户获得完成任务所需的最小访问特权。 但是,此解决方案是不完整的。 尽管它...
Docker仓库上传镜像出现 unauthorized to access repository的解决方法
本篇文章主要介绍了详解关于springboot-actuator监控的401无权限访问,非常具有实用价值,有兴趣的可以了解一下
Rancher下Docker拉取镜像出现unauthorized to access repository问题.docx
reflex-aws-ec2实例启动了未经授权的ami 一种Reflex规则,用于检测何时使用未经授权的AMI启动实例。 要了解有关黄金AMI和管理授权AMI的更多信息,请参阅 。 入门 要开始使用Reflex,请查看。 用法 要使用此规则,...
本文主要给大家介绍了关于Redis未授权访问漏洞利用的相关内容,文中对该漏洞进行了详细,并给出了相对应的修复/安全建议,下面话不多说了,来一起看看详细的介绍吧。 一、漏洞介绍 Redis 默认情况下,会绑定在 0.0....
BSPHP_unauthorized_access_information_disclosure POC +虾虎鱼和POC
大家好,我已经在一台计算机上安装了Power-... 当我尝试使用以下URL http://192.168.1.235/powershell?serializationLevel=Full浏览power-shell时,它给出以下错误.HTTP错误401.0-访问被拒绝您无权查看此内容...
Realm表示Web服务器中受保护文档的安全域(比如公司财务信息域和公司员工信息域),用来指示需要哪个域的用户名和密码,用" "包括起来 2、剖析 Basic认证 ③输入正确的用户名和密码,认证成功后,浏览器会将凭据信息...
JMS规范培训教程以及JMS源代码,希望对大家有所帮助
JWT_Node.js: 安装依赖项: #npm安装 服务于localhost:3000 #npm start或nodemon
删除未经授权的 DNN 用户 目前,该项目的唯一目的是软删除计划任务中未经授权的用户。 在安装时,一个 .dll 被放置在 bin 文件夹中,并且一个计划项目被添加到 db Schedule 表中。 计划的初始值是每小时触发一次,...
主要介绍了微信公众号 提示:Unauthorized API function 问题解决方法的相关资料,这里提供了出现提示的解决方法,需要的朋友可以参考下