JBOSS AS7 + CAS doesn't redirect after login

时间:2015-06-26 10:25:08

标签: filter jboss cas

I have Jboss AS7 with CAS deployed and a test application that requires CAS login. If I go to localhost:8443/test it redirects me to CAS login page, but after I login it says Login Successful, but it doesn't redirect me back to my aplication. It's stuck at "Login Successful". This is my test application web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  version="2.5">

    <distributable/>

  <display-name>Java CAS Client Test Application</display-name>
<security-constraint>
    <web-resource-collection>
      <web-resource-name>Java CAS Client Test Application</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint>
  </security-constraint>

  <welcome-file-list>
    <welcome-file>hello.html</welcome-file>
  </welcome-file-list>

    <filter>
        <filter-name>CAS Single Sign Out Filter</filter-name>
        <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
  </filter>

  <filter>
        <filter-name>CAS Authentication Filter</filter-name>
        <filter-class>
              org.jasig.cas.client.authentication.Saml11AuthenticationFilter</filter-class>
        <init-param>
              <param-name>casServerLoginUrl</param-name>
              <param-value>https://127.0.0.1:8443/cas/login</param-value>
        </init-param>
        <init-param>
        <param-name>serverName</param-name>
        <param-value>https://127.0.0.1:8443</param-value>
    </init-param>
  </filter>

  <filter>
    <filter-name>CAS Redirect Filter</filter-name>
    <filter-class>
    org.jasig.cas.client.authentication.Saml11AuthenticationFilter
    </filter-class>
    <init-param>
      <param-name>redirect</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
              <param-name>serverName</param-name>
              <param-value>https://127.0.0.1:8443</param-value>
        </init-param>
        <init-param>
              <param-name>casServerLoginUrl</param-name>
              <param-value>https://127.0.0.1:8443/cas/login</param-value>
        </init-param>
  </filter>

  <filter>
        <filter-name>CAS Validation Filter</filter-name>
        <filter-class>org.jasig.cas.client.validation.Saml11TicketValidationFilter</filter-class>
        <init-param>
              <param-name>casServerUrlPrefix</param-name>
              <param-value>https://127.0.0.1:8443/cas</param-value>
        </init-param>
        <init-param>
              <param-name>serverName</param-name>
              <param-value>https://127.0.0.1:8443</param-value>
        </init-param>
        <init-param>
              <param-name>redirectAfterValidation</param-name>
              <param-value>true</param-value>
        </init-param>
        <init-param>
              <param-name>tolerance</param-name>
              <param-value>5000</param-value>
        </init-param>
  </filter>

  <filter>
        <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
        <filter-class>org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class>
  </filter>

  <filter>
        <filter-name>CAS Assertion Thread Local Filter</filter-name>
        <filter-class>org.jasig.cas.client.util.AssertionThreadLocalFilter</filter-class>
  </filter>

  <filter-mapping>
        <filter-name>CAS Single Sign Out Filter</filter-name>
        <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
        <filter-name>CAS Authentication Filter</filter-name>
        <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
        <filter-name>CAS Validation Filter</filter-name>
        <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
        <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
        <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>CAS Assertion Thread Local Filter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

Here is my HelloWorld app: https://github.com/valHALLuh/hello-world

Here is my CAS: https://github.com/valHALLuh/cas

2 个答案:

答案 0 :(得分:1)

变化 用于AuthenticationFilter的Saml11AuthenticationFilter 和 用于Cas10TicketValidationFilter的Saml11TicketValidationFilter

答案 1 :(得分:0)

我不知道这是不是问题,但是我有CAS 4.0.2,之后我改为CAS 3.6,它起作用了。现在它重定向了我。感谢您的回答@ user5086200

更新:我想我应该在web.xml的开头放一个欢迎文件。