丹调生活 发表于 2018-12-5 12:52:56

tomcat http Basic 认证

  http://robblog.iteye.com/blog/554450
  Tomcat配置:
  1 在tomcat的webapps下新建一个目录authen,再建立子目录subdir,下面放一个index.jsp
  2 在authen目录下建立WEB-INF目录,下放web.xml文件,内容如下
  Xml代码

[*]  
[*]  
[*]  
[*]  My App
[*]  
[*]  /subdir/*
[*]  
[*]  
[*]  test
[*]  
[*]  
[*]
[*]  
[*]  BASIC
[*]  My Realm
[*]  
  3 在tomcat的tomcat-users.xml文件中添加一个用户名密码为test,test的用户,角色test。
  客户端访问:
  访问http://localhost:port/authen/subdir/index.jsp
  会弹出对话框提示认证,输入test test可以登录。


页: [1]
查看完整版本: tomcat http Basic 认证