Hi All,

I have got CAS up and running, it performs authentication as expected.  But I 
am pulling my hair out trying to fix one final issue.

I fire up URL of my webapp 'k-authentify' as follows: 
https://localhost:8443/k-authentify/controlservlet?cmd=test

Since controlservlet is protected resource, I am redirected to CAS as for login 
as expected.  But URL looks like this: 
https://localhost:8443/cas-server-webapp-3.3.5/login?service=https://localhost:8443/k-authentify

So, although I accessed protected resource (controlservelt) using URL:  
https://localhost:8443/k-authentify/controlservlet?cmd=test

The ?service parameter says only upto https://localhost:8443/k-authentify!

I thought it should use its Callback URL functionality to remember resource 
being asked for? 

I am attaching my context and web.xml files, I will appreciate helps/rebukes, I 
have been toiling for hours :(
-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user
<?xml version="1.0" encoding="UTF-8"?>

<!--
  - Sample namespace-based configuration
  -
  -->

<beans:beans xmlns="http://www.springframework.org/schema/security";
             xmlns:beans="http://www.springframework.org/schema/beans";
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
             xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd";>

    <!--
    <bean id="daoAuthenticationProvider"
          class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
        <property name="userDetailsService" ref="inMemoryDaoImpl"/>
        <property name="saltSource" ref="saltSource"/>
        <property name="passwordEncoder" ref="passwordEncoder"/>
    </bean>-->

    <http entry-point-ref="casEntryPoint">
        <intercept-url pattern="/index.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
        <intercept-url pattern="/**" access="ROLE_USER" />
        <custom-filter position="CAS_FILTER" ref="casProcessingFilter" />
        <!--<custom-filter position="FORM_LOGIN_FILTER" ref="myFilter"/>-->
    </http>

    <beans:bean id="casProcessingFilter"
                class="org.springframework.security.cas.web.CasAuthenticationFilter">
        <beans:property name="authenticationManager" ref="authenticationManager" />
    </beans:bean>

    <authentication-manager alias="authenticationManager">
        <authentication-provider ref="casAuthenticationProvider"/>
    </authentication-manager>

    <beans:bean id="casAuthenticationProvider"
                class="org.springframework.security.cas.authentication.CasAuthenticationProvider">
        <beans:property name="serviceProperties" ref="serviceProperties"/>
        <beans:property name="userDetailsService" ref="userService"/>
        <beans:property name="ticketValidator">
            <beans:bean class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator">
                <beans:constructor-arg index="0" value="https://localhost:8443/cas-server-webapp-3.3.5"/>
            </beans:bean>
        </beans:property>
        <beans:property name="key" value="an_id_for_this_auth_provider_only"/>
    </beans:bean>

    <user-service id="userService">
        <user name="joe" password="joe" authorities="ROLE_USER"/>
    </user-service>

    <beans:bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties">
        <beans:property name="service" value="https://localhost:8443/k-authentify"/>
        <beans:property  name="sendRenew" value="false"/>
    </beans:bean>

    <!--<beans:bean id="casFilter" class="org.springframework.security.cas.web.CasAuthenticationFilter">
        <beans:property name="authenticationManager" ref="authenticationManager"/>
    </beans:bean>-->
    <beans:bean id="casEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
        <beans:property name="loginUrl" value="https://localhost:8443/cas-server-webapp-3.3.5/login"/>
        <beans:property name="serviceProperties" ref="serviceProperties"/>
    </beans:bean>

</beans:beans>
<?xml version="1.0" encoding="UTF-8"?>
    <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">
    <display-name>K-Now Security Application</display-name>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/applicationContext-security.xml
        </param-value>
    </context-param>

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/classes/log4j.properties</param-value>
    </context-param>

    <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>tutorial.root</param-value>
    </context-param>

    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

    <filter-mapping>
      <filter-name>springSecurityFilterChain</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!--
      - Loads the root application context of this web app at startup.
      - The application context is then available via
      - WebApplicationContextUtils.getWebApplicationContext(servletContext).
    -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!--
      - Publishes events for session creation and destruction through the application
      - context. Optional unless concurrent session control is being used.
      -->
    <listener>
      <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
    </listener>

    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>

  <!--
    - Provides core MVC application controller. See contacts-servlet.xml.
    -->
    <servlet>
        <servlet-name>ControlServlet</servlet-name>
        <servlet-class>uk.co.know.ControlServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>ControlServlet</servlet-name>
        <url-pattern>/controlservlet</url-pattern>
    </servlet-mapping>

     <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

</web-app>

Reply via email to