JAVA集成CAS客户端总结
一、依赖dependency groupIdorg.jasig.cas.client/groupId artifactIdcas-client-support-springboot/artifactId version3.6.4/version /dependency二、yml配置cas: server-url-prefix: https://xxx.xxx:8443/cas 改成cas服务端地址 server-login-url: https://xxx.xxx:8443/cas/login 改成cas服务端地址 client-host-url: http://127.0.0.1:18082 改成你们自己的地址cas登录后显示地址 validation-type: CAS3 authentication-url-patterns: - /auth/* 改成你们自己的用于拦截接口三、获取用户idGetMapping(value /hello) ResponseBody public String hello(HttpSession session){ Assertion assertion (Assertion) session.getAttribute(CONST_CAS_ASSERTION); AttributePrincipal principal assertion.getPrincipal(); String userId principal.getName(); System.out.println(userId: userId); return hello world userId; }四、springboot启动类 增加 EnableCasClient
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2457522.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!