搜索
查看
编辑修改
首页
UNITY
NODEJS
PYTHON
AI
GIT
PHP
GO
CEF3
JAVA
HTML
CSS
搜索
在线问答5
这个屌丝很懒,什么也没留下!
关注作者
热门标签
jquery
HTML
CSS
PHP
ASP
PYTHON
GO
AI
C
C++
C#
PHOTOSHOP
UNITY
iOS
android
vue
xml
爬虫
SEO
LINUX
WINDOWS
JAVA
MFC
CEF3
CAD
NODEJS
GIT
Pyppeteer
article
热门文章
1
【已解决】Python解决TypeError: __init__() missing 1 required positional argument: ‘comment‘报错
2
在IDEA中使用Git 、远程仓库克隆工程到本地_idea git拉取远程代码到本地
3
tensorflow实现迁移学习
4
探索高效OCR服务:ocrserver
5
react-natvie-fetch-blob使用
6
mysql 权限级别_【转】MySQL权限级别
7
算法回忆录(2)
8
Function Call & ReACT,Agent应用落地的加速器--function calling和react有什么不同
9
数据结构-双端队列的链式存储与实现(C++)_c++ 双端队列存储方式
10
系统架构设计师-第18章-安全架构设计理论与实践-软考学习笔记_hru安全模型
当前位置:
article
> 正文
web.xml中
和四种认证类型_
作者:在线问答5 | 2024-08-10 00:28:30
赞
踩
<security-constraint> 的子元素 <http-method> 是可选的,如果没有 <http-method> 元素,这表示将禁止所有 HTTP 方法访问相应的资源。
子元素 <auth-constraint> 需要和 <login-config> 相配合使用,但可以被单独使用。如果没有 <auth-constraint> 子元素,这表明任何身份的用户都可以访问相应的资源。也就是说,如果 <security-constraint> 中没有 <auth-constraint> 子元素的话,配置实际上是不起中用的。如果加入了 <auth-constraint> 子元素,但是其内容为空,这表示所有身份的用户都被禁止访问相应的资源。
web.xml:
Xml代码
<
security-constraint
>
<
display-name
>
baseporject
</
display-name
>
<
web-resource-collection
>
<
web-resource-name
>
baseproject
</
web-resource-name
>
<
url-pattern
>
*.jsp
</
url-pattern
>
<
url-pattern
>
*.do
</
url-pattern
>
<
http-method
>
GET
</
http-method
>
<
http-method
>
PUT
</
http-method
>
<
http-method
>
HEAD
</
http-method
>
<
http-method
>
TRACE
</
http-method
>
<
http-method
>
POST
</
http-method
>
<
http-method
>
DELETE
</
http-method
>
<
http-method
>
OPTIONS
</
http-method
>
</
web-resource-collection
>
<
auth-constraint
>
<
description
>
baseproject
</
description
>
<
role-name
>
All Role
</
role-name
>
</
auth-constraint
>
<
user-data-constraint
>
<
transport-guarantee
>
NONE
</
transport-guarantee
>
</
user-data-constraint
>
</
security-constraint
>
<
login-config
>
<
security-constraint
>
<
display-name
>
baseporject
</
display-name
>
<
web-resource-collection
>
<
web-resource-name
>
baseproject
</
web-resource-name
>
<
url-pattern
>
*.jsp
</
url-pattern
>
<
url-pattern
>
*.do
</
url-pattern
>
<
http-method
>
GET
</
http-method
>
<
http-method
>
PUT
</
http-method
>
<
http-method
>
HEAD
</
http-method
>
<
http-method
>
TRACE
</
http-method
>
<
http-method
>
POST
</
http-method
>
<
http-method
>
DELETE
</
http-method
>
<
http-method
>
OPTIONS
</
http-method
>
</
web-resource-collection
>
<
auth-constraint
>
<
description
>
baseproject
</
description
>
<
role-name
>
All Role
</
role-name
>
</
auth-constraint
>
<
user-data-constraint
>
<
transport-guarantee
>
NONE
</
transport-guarantee
>
</
user-data-constraint
>
</
security-constraint
>
<
login-config
>
Xml代码
<!--四种验证方式,附在最后有说明-->
<
auth-method
>
FORM
</
auth-method
>
<
form-login-config
>
<
form-login-page
>
/login.html
</
form-login-page
>
<
form-error-page
>
/error.html
</
form-error-page
>
</
form-login-config
>
</
login-config
>
<
security-role
>
<
role-name
>
All Role
</
role-name
>
</
security-role
>
<!--四种验证方式,附在最后有说明-->
<
auth-method
>
FORM
</
auth-method
>
<
form-login-config
>
<
form-login-page
>
/login.html
</
form-login-page
>
<
form-error-page
>
/error.html
</
form-error-page
>
</
form-login-config
>
</
login-config
>
<
security-role
>
<
role-name
>
All Role
</
role-name
>
</
security-role
>
security-constriaint元素的用途是用来指示服务器使用何种验证方法了.此元素在web.xml中应该出现在login-config 的紧前面。它包含是个可能的子元素,分别是:web-resource-collection、auth-constraint、user-data- constraint和display-name。下面各小节对它们进行介绍。
1. web-resource-collection
此元素确定应该保护的资源,所有security-constraint元素都必须包含至少一个web- resource-collection项.此元素由一个给出任意标识名称的web-resource-name元素、一个确定应该保护URL 的url-pattern元素、一个指出此保护所适用的HTTP命令(GET、POST等,缺省为所有方法)的http-method元素和一个提供资料 的可选description元素组成。
重要的是应该注意到,url-pattern仅适用于直接访问这些资源的客户机。特别是,它不适合于通过MVC体系结构利用RequestDispatcher来访问的页面,或者不适合于利用类似jsp:forward的手段来访问的页面。
2. auth-constraint
元素却指出哪些用户应该具有受保护资源的访问权。此元素应该包含一个或多个标识具有访问权限的用户类别role-name元素,以及包含(可选)一个描述角色的description元素。
3. user-data-constraint
这个可选的元素指出在访问相关资源时使用任何传输层保护。它必须包含一个transport-guarantee子元素(合法值为NONE、 INTEGRAL或CONFIDENTIAL),并且可选地包含一个description元素。transport-guarantee为NONE值将 对所用的通讯协议不加限制。INTEGRAL值表示数据必须以一种防止截取它的人阅读它的方式传送。虽然原理上(并且在未来的HTTP版本中),在 INTEGRAL和CONFIDENTIAL之间可能会有差别,但在当前实践中,他们都只是简单地要求用SSL。
4 四种认证类型:
Xml代码
BASIC:HTTP规范,Base64
<
web-app
>
......
<
login-config
>
<
auth-method
>
BASIC
</
auth-method
>
</
login-config
>
......
</
web-app
>
DIGEST:HTTP规范,数据完整性强一些,但不是SSL
<
web-app
>
......
<
login-config
>
<
auth-method
>
DIGEST
</
auth-method
>
</
login-config
>
......
</
web-app
>
CLIENT-CERT:J2EE规范,数据完整性很强,公共钥匙(PKC)
<
web-app
>
......
<
login-config
>
<
auth-method
>
CLIENT-CERT
</
auth-method
>
</
login-config
>
......
</
web-app
>
FORM:J2EE规范,数据完整性非常弱,没有加密,允许有定制的登陆界面。
<web-app>
......
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
......
</web-app>
这里的 FORM 方式需要说明的是 登录页面的固定的元素:login.html
Html代码
<
form
name
=
"loginform"
method
=
"post"
action
=
"j_security_check"
>
<
INPUT
name
=
"j_username"
type
=
"text"
>
<
INPUT
name
=
"j_password"
TYPE
=
"password"
>
<
input
type
=
"submit"
value
=
"登 录"
>
</
form
>
form 的action 必须是j_security_check, method="post", 用户名 name="j_username" , 密码name="j_password" 这些都是固定的元素
声明:
本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:
https://www.wpsshop.cn/w/在线问答5/article/detail/955863
推荐阅读
article
手动编译安装
httpd
_a
resource
sh
or
tage
or
other
unrecover...
手动编译安装
httpd
目前最新的
httpd
包是 2.4.51,官网没有提供Linux下的安装包,因此只有手动编译安装...
赞
踩
article
android
知识点大全 面试_unknown tag <
str
in
g
>
in
in...
3G,全称为3rd Generation,中文含义就是指第三代数字通信。所谓3G,是指将无线通信与国际互联网等多媒体通信...
赞
踩
article
calico
的日志_
error
getting
resource
key
=globalfelixco...
calico
的日志_
error
getting
resource
key
=globalfelixconfig
error
...
赞
踩
article
如何完美解决
sun
.
security
.
validator
.ValidatorException: ...
在Java开发中,遇到错误时,可能会让许多开发者感到困惑。本文将详细介绍如何解决此问题,包括背景介绍、解决方案和代码示例...
赞
踩
article
Springboot
+
Websocket
+
Security
+
Vue
实现弹幕推送功能_springb...
【代码】
Springboot
+
Websocket
+
Security
+
Vue
实现弹幕推送功能。_
springboot
w...
赞
踩
article
【
OAuth
2
系列】集成
微信
小
程序
登录
到
Spring
Security
OAuth
2.0...
本文将详细介绍如何在
Spring
Security
OAuth
2.0 中扩展支持
微信
小
程序
登录
,通过自定义授权方式实...
赞
踩
article
SpringSecurity6
| 默认
登录
页_
spring
security
默认
登录
页面...
本文详细解析了
SpringSecurity6
中默认
登录
页面的实现过程,包括涉及的过滤器、
登录
页面渲染流程和异常处理。介绍...
赞
踩
article
Docker
安全
管理_
docker
安全
管理
security
-howto...
文章标题一、
Docker
和虚拟机的区别1、隔离与共享2、性能与损耗:二、
Docker
存在的
安全
问题1、
Docker
自身...
赞
踩
article
class
path
resource
[
application
-
dev
.
properties
] c...
问题分析:SpringBoot启动时未能为配置类找到相应的配置文件!问题原因:先看文件结构,文件树结构所致!|--res...
赞
踩
article
html
请求
资源不可用,
HTTP
状态404 -
请求
的资源(/
BookStore
/
index
.htm...
I'm working with my web application and it uses JBoss 7 AS a...
赞
踩
article
Loaded
plugins
: fastest
mirror
, refresh-packagekit,...
Loaded
plugins
: fastest
mirror
, refresh-packagekit, security ...
赞
踩
article
Springboot
+Websocket+
Security
+
Vue
实现弹幕推送功能_springb...
【代码】
Springboot
+Websocket+
Security
+
Vue
实现弹幕推送功能。_
springboot
n...
赞
踩
article
14-
SpringSecurity
:前后端分离项目中用户名与密码通过
RSA
加密传输
_
spring
s...
public class
RSA
Encrypt {/** *
RSA
公钥加密 * @param str 待加密字符串 *...
赞
踩
article
【
Spring
Security
】增加
RSA
密文传输登录_
spring
-
security
-
rsa
作用...
背景由于原来登录表单和oauth/token使用时,是走明文传输的。为了保证传输中不容易被窃取,采用
RSA
加密明文密码后...
赞
踩
article
【第3期】
Springboot
集成
SpringSecurity
+
RSA
+
ECS
免密
登录
_spring...
本文详细介绍了如何在
Springboot
项目中集成
RSA
非对称加密算法,包括生成公钥私钥文件、转换为JDK密钥对象、加密...
赞
踩
article
SpringBoot
SpringSecurity
JWT
+
Redis
+RSA授权登录登出
验证码
...
对于微服务来说,私钥放在认证服务上,其他服务只需要存公钥即可。因为其他服务只做校验,不加密
JWT
。私钥加密,公钥解密。公...
赞
踩
article
Spring
Security
对登录密码进行
加密
传输Java + Vue_
spring
secur...
理论:1、Spring
Security
默认的密码比对主要是依靠DaoAuthenticationProvider下的a...
赞
踩
article
Spring
Security
Oauth2
密码模式
登录
密码
RSA
加密_
oauth2
登录
加密...
思路很清晰,原先用BcryptPasswordEncoder,那么继续用这个,只不过在这之前加上
RSA
解密。用了java...
赞
踩
article
Spring
Security系列之
PasswordEncoder
_
spring
security
...
加密算法种类、反查表、彩虹表、加密算法配置类实例、
PasswordEncoder
、BCryptPasswordEncod...
赞
踩
article
Security
RSA非对称加密_
spring
-
security
-
rsa
...
Security
RSA非对称加密_
spring
-
security
-
rsa
spring
-
security
-
rsa
...
赞
踩
相关标签
linux
运维
服务器
android 知识点大全 面试
网络
zookeeper
学习
mybatis
spring boot
java-ee
java
maven
spring cloud
websocket
vue.js
微信小程序
spring
小程序
后端
SpringSecurity
SpringBoot
docker
configuration
yml properties
html请求资源不可用