skywalking+cas集成实现单点登录

参考上一篇Sentinel集成CAS实现SSO

版本

skywalking8.1

添加cas核心包依赖

报错

Connected to the target VM, address: '127.0.0.1:51902', transport: 'socket'
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/F:/soft/maven/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.9.0/log4j-slf4j-impl-2.9.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/F:/soft/maven/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Exception in thread "main" java.lang.StackOverflowError
	at java.lang.reflect.InvocationTargetException.<init>(InvocationTargetException.java:72)
	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.logging.log4j.util.StackLocator.getCallerClass(StackLocator.java:112)

直接在依赖中exclusion掉

        <dependency>
            <groupId>org.jasig.cas.client</groupId>
            <artifactId>cas-client-core</artifactId>
            <version>3.6.1</version>
        </dependency>
        <dependency>
            <groupId>net.unicon.cas</groupId>
            <artifactId>cas-client-autoconfig-support</artifactId>
            <version>2.3.0-GA</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

配置application.yml文件

server:
  port: 8080

cas:
  #cas服务端的地址
  server-url-prefix: http://localhost:8443/cas
  #cas服务端的登录地址
  server-login-url: http://localhost:8443/cas/login
  #当前服务器的地址(客户端)
  client-host-url: http://localhost:8080/
  #Ticket校验器使用Cas30ProxyReceivingTicketValidationFilter
  validation-type: cas3
  use-session: true

编写CasConfig加载单点登录的过滤器

参考Sentinel集成CAS实现SSO

总结

skywalking+cas的集成不难,难在先要把skywalking源码编译成功,祝大家好运。

©️2020 CSDN 皮肤主题: 1024 设计师:上身试试 返回首页