首頁  >  文章  >  Java  >  基於springboot怎麼搭建CAS Client客戶端

基於springboot怎麼搭建CAS Client客戶端

WBOY
WBOY轉載
2023-05-14 10:46:141387瀏覽

1.新建springboot專案並引入依賴

<dependency>  <groupId>org.jasig.cas.client</groupId>  <artifactId>cas-client-support-springboot</artifactId>  <version>3.6.2</version></dependency>

2.設定@EnableCasClient註解

package com.codetiler.demo;import org.jasig.cas.client.boot.configuration.EnableCasClient;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication@EnableCasClientpublic class Application {    public static void main(String[] args) {        SpringApplication.run(Application.class, args);    }}

3.設定application.properties檔案

server.port=8081#cas服务端配置cas.server-url-prefix=http://cas.codetiler.org:8443/cascas.server-login-url=http://cas.codetiler.org:8443/cas/login#cas客户端配置cas.client-host-url=http://demo.codetiler.org:8081cas.validation-type=CAS3

4.在瀏覽器中輸入認證服務端的地址http://cas.codetiler.org:8443/cas並登錄,再次在瀏覽器中輸入應用的地址http://demo.codetiler.org:8081瀏覽器直接請求到,不需要再次登入。

以上是基於springboot怎麼搭建CAS Client客戶端的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:yisu.com。如有侵權,請聯絡admin@php.cn刪除