jfinal-undertow集成cas登录,第三方jar中cas过滤器的相关类找不到,求助!

按照高级用法第12项。在启动config类里面的写了filter,但是启动时,出现第三方jar中cas过滤器的相关类找不到,paramvalue倒是加载进去了。

UndertowServer.create(ApplicationConfig.class).configWeb(

                builder -> {

//                     配置 Filter

                    builder.addFilter("CAS Single Sign Out Filter", "org.jasig.cas.client.session.SingleSignOutFilter");

                    builder.addFilterUrlMapping("CAS Single Sign Out Filter", "*.do");

                    builder.addFilterUrlMapping("CAS Single Sign Out Filter", "*.jsp");


                    builder.addFilter("CAS Authentication Filter", "org.jasig.cas.client.authentication.AuthenticationFilter");

                    builder.addFilterInitParam("CAS Authentication Filter", "casServerLoginUrl", "http://127.0.0.1:8180/cas/login");

                    builder.addFilterInitParam("CAS Authentication Filter", "serverName", "http://127.0.0.1:8480");

                    builder.addFilterUrlMapping("CAS Authentication Filter", "*.do");

                    builder.addFilterUrlMapping("CAS Authentication Filter", "*.jsp");


                    builder.addFilter("CAS Validation Filter", "org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter");

                    builder.addFilterInitParam("CAS Validation Filter", "casServerUrlPrefix", "http://127.0.0.1:8180/cas/");

                    builder.addFilterInitParam("CAS Validation Filter", "serverName", "http://127.0.0.1:8480");

                    builder.addFilterInitParam("CAS Validation Filter", "encoding", "UTF-8");

                    builder.addFilterUrlMapping("CAS Validation Filter", "*.do");

                    builder.addFilterUrlMapping("CAS Validation Filter", "*.jsp");


                    builder.addFilter("CAS HttpServletRequest Wrapper Filter", "org.jasig.cas.client.util.HttpServletRequestWrapperFilter");

                    builder.addFilterUrlMapping("CAS HttpServletRequest Wrapper Filter", "*.do");

                    builder.addFilterUrlMapping("CAS HttpServletRequest Wrapper Filter", "*.jsp");


                    builder.addFilter("CAS Assertion Thread Local Filter", "org.jasig.cas.client.util.AssertionThreadLocalFilter");

                    builder.addFilterUrlMapping("CAS Assertion Thread Local Filter", "*.do");

                    builder.addFilterUrlMapping("CAS Assertion Thread Local Filter", "*.jsp");


                    builder.addFilter("jfinal", "com.jfinal.core.JFinalFilter");

                    builder.addFilterInitParam("jfinal", "configClass", "com.ctvit.application.ApplicationConfig");

                    builder.addFilterUrlMapping("jfinal", "/*");

                    // 配置 Listener

                    builder.addListener("org.jasig.cas.client.session.SingleSignOutHttpSessionListener");

                }

        ).start();

image.png

评论区

JFinal

2019-05-15 16:26

filer name 都用的一些带空格的字符,可能有问题:
CAS Single Sign Out Filter

改成 CAS_Single_Sign_Out_Filter 这类带下划线的试试,注意这里的 filterName 在添加的时候与映射时的要完全一样,大小写都不能错,否则找不到

祖大帅

2019-05-15 17:22

@JFinal 加上下划线,依然是同样的错误。不使用jfinal-undertow用web.xml相同配置是可以生效的。把web.xml的内容依次在启动config类里面,过滤器没生效。

祖大帅

2019-05-15 17:22

@JFinal 打印的日志:
Starting JFinal 3.8 -> http://0.0.0.0:8480
Info: jfinal-undertow 1.6, undertow 2.0.19.Final, jvm 1.8.0_181
2019-05-15 17:20:04 [ main:0 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [artifactParameterName] not found. Using default value [ticket]
2019-05-15 17:20:04 [ main:3 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [logoutParameterName] not found. Using default value [logoutRequest]
2019-05-15 17:20:04 [ main:6 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:71) Property [serverName] loaded from FilterConfig.getInitParameter with value [http://127.0.0.1:8480]
2019-05-15 17:20:04 [ main:6 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [service] not found. Using default value [null]
2019-05-15 17:20:04 [ main:7 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [artifactParameterName] not found. Using default value [ticket]
2019-05-15 17:20:04 [ main:7 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [serviceParameterName] not found. Using default value [service]
2019-05-15 17:20:04 [ main:7 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [encodeServiceUrl] not found. Using default value [true]
2019-05-15 17:20:04 [ main:8 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:71) Property [casServerLoginUrl] loaded from FilterConfig.getInitParameter with value [http://192.168.168.202:8180/cas/login]
2019-05-15 17:20:04 [ main:8 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [renew] not found. Using default value [false]
2019-05-15 17:20:04 [ main:9 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [gateway] not found. Using default value [false]
2019-05-15 17:20:04 [ main:9 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [gatewayStorageClass] not found. Using default value [null]
2019-05-15 17:20:04 [ main:9 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [roleAttribute] not found. Using default value [null]
2019-05-15 17:20:04 [ main:10 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [ignoreCase] not found. Using default value [false]
2019-05-15 17:20:04 [ main:11 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:71) Property [serverName] loaded from FilterConfig.getInitParameter with value [http://127.0.0.1:8480]
2019-05-15 17:20:04 [ main:12 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [service] not found. Using default value [null]
2019-05-15 17:20:04 [ main:12 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [artifactParameterName] not found. Using default value [ticket]
2019-05-15 17:20:04 [ main:14 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [serviceParameterName] not found. Using default value [service]
2019-05-15 17:20:04 [ main:15 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [encodeServiceUrl] not found. Using default value [true]
2019-05-15 17:20:04 [ main:16 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [proxyReceptorUrl] not found. Using default value [null]
2019-05-15 17:20:04 [ main:16 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [proxyGrantingTicketStorageClass] not found. Using default value [null]
2019-05-15 17:20:04 [ main:17 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [millisBetweenCleanUps] not found. Using default value [60000]
2019-05-15 17:20:04 [ main:17 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [exceptionOnValidationFailure] not found. Using default value [true]
2019-05-15 17:20:04 [ main:17 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [redirectAfterValidation] not found. Using default value [true]
2019-05-15 17:20:04 [ main:18 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [useSession] not found. Using default value [true]
2019-05-15 17:20:04 [ main:18 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [acceptAnyProxy] not found. Using default value [null]
2019-05-15 17:20:04 [ main:18 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [allowedProxyChains] not found. Using default value [null]
2019-05-15 17:20:04 [ main:19 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:71) Property [casServerUrlPrefix] loaded from FilterConfig.getInitParameter with value [http://192.168.168.202:8180/cas/]
2019-05-15 17:20:04 [ main:21 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [proxyCallbackUrl] not found. Using default value [null]
2019-05-15 17:20:04 [ main:21 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:71) Property [encoding] loaded from FilterConfig.getInitParameter with value [UTF-8]
2019-05-15 17:20:04 [ main:22 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [renew] not found. Using default value [false]
2019-05-15 17:20:04 [ main:22 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:71) Property [encoding] loaded from FilterConfig.getInitParameter with value [UTF-8]
2019-05-15 17:20:04 [ main:22 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [hostnameVerifier] not found. Using default value [null]
2019-05-15 17:20:04 [ main:22 ] - [ INFO ] org.jasig.cas.client.util.AbstractConfigurationFilter.getPropertyFromInitParams(AbstractConfigurationFilter.java:105) Property [hostnameVerifierConfig] not found. Using default value [null]