目录
本文章应该会后面试验一个鉴权功能就会发布一系列测试过程(GeoServer有很多鉴权方式)
进入geoserver官网的下载页面 因为jdk8是免费的极限,所以下载java8所能支持的最新版本

下载Windows Installer安装包以及Web Archive在linux部署的war包

下载Key authentication用于扩展鉴权

去tomcat网下载能支持java8的最新版本-tomcat9
Apache Tomcat® - Apache Tomcat 9 Software Downloads





然后关闭按钮后,再点保存,否则无效

- package com.example.controller;
-
-
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
-
- @RestController
- public class Login {
-
- public int a=1;
-
- @RequestMapping(value = "/checkAuthkey",method = RequestMethod.GET)
- public String checkAuthkey(@RequestParam String authkey) {
- System.out.println(authkey+"///"+a);
- a++;
- if("888888".equals(authkey)){
- return "";
- }
- String user = "admin";
- return user;
- }
- }

分别从两个不同电脑发起访问地图服务器
其中 authkey一定要填写,用于访问geoserver,geoserver转发给java工程

java工程做了设置,authkey等于888888 鉴权失败

java工程做了设置,authkey不等于888888 鉴权成功

(1)两台电脑IP:192.168.10.202,192.168.10.213,两台电脑访问的鉴权结果互不干涉,202访问geoserver服务器,当authkey=888888,鉴权失败,不停的点击请求,都会走一下java工程,判断鉴权,但是,当authkey不等于888888的时候鉴权成功,不停的点击请求,再也不会走一下java工程,除非十分钟后,才会再走一下java工程!同理213访问geoserver服务器也是该结果!
(2)authkey这个参数可以任意位置,而不是必须紧靠?后面第一个参数位置!我看很多人提出这个问题,估计版本的问题,我这个版本解决了这个问题!
