springboot整合cas

springboot整合cas,第1张

springboot整合cas

1、创建springboot项目后在pom中添加


  net.unicon.cas
  cas-client-autoconfig-support
  2.1.0-GA

2、 在application.yml中添加

cas:
  server-login-url: http://localhost:8080/cas/login
  server-url-prefix: http://localhost:8080/cas
  client-host-url: http://localhost:8081
  validation-type: cas3

3、在启动类添加注解@EnableCasClient

@SpringBootApplication
@EnableCasClient
public class DemoApplication {
	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class, args);
	}

}

4、在springboot中创建controller 添加如下方法

@GetMapping("/test")
public String test(){
    return "test....";
}

5、按以上步骤在创建一个springboot改动下端口和访问接口启动
6、启动cas服务、启动两个springboot,访问其中的localhost:8082/test就会跳转到cas认证页面,输入正确账号密码登陆后自动跳转到test,而另外一个springboot的接口不需要验证cas就可以直接访问

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4668706.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-06
下一篇2022-11-06

发表评论

登录后才能评论

评论列表(0条)

    保存