title: Authenticate user for secure spring service with CAS RESTful API ticket
body: <p>I have successfuly setup CAS server. I want to authenticate user for secure service (in spring application), so used RESTful API to get the tickets for user. I am able to get tickets by two step call to cas/v1/tickets and cas/v1/tickets/{TGT} for secure service, but when I tried to call that service using the generated ticket like         </p>
  
  <p>localhost:8080/secure1?ticket?ST-ttyyy..." it returns a response content of cas login page.</p>
  
  <p>I think, I am missing some point in my configuration either </p>
  
  <p>"services.xml" of my spring application or in cas configuration.</p>
  
  <p>Spring app settings.xml</p>
  
  <pre><code>&lt;bean id="pgtStorage"     class="org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl"/&gt;
  
      &lt;bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties"&gt;
          &lt;property name="service" value="http://localhost:8080/EFormRestServer/business/user/10000007" /&gt;
          &lt;property name="sendRenew" value="false" /&gt;
          &lt;property name="artifactParameter" value="ticket"/&gt;
      &lt;/bean&gt;
   &lt;security:http create-session="stateless" use-expressions="true" entry-point-ref="casEntryPoint"&gt;        
              &lt;security:anonymous enabled="true" /&gt;
              &lt;security:custom-filter position="CAS_FILTER" ref="casFilter" /&gt;
          &lt;/security:http&gt; 
  
          &lt;bean id="casFilter"
          class="org.springframework.security.cas.web.CasAuthenticationFilter"&gt;
          &lt;property name="authenticationManager" ref="authenticationManager" /&gt;
          &lt;property name="proxyGrantingTicketStorage" ref="pgtStorage"/&gt;
      &lt;property name="proxyReceptorUrl" value="/business/test"/&gt;
      &lt;property name="serviceProperties" ref="serviceProperties"/&gt;
      &lt;property name="authenticationDetailsSource"&gt;
        &lt;bean class=
          "org.springframework.security.cas.web.authentication.ServiceAuthenticationDetailsSource"/&gt;
      &lt;/property&gt;
      &lt;/bean&gt;
  &lt;bean id="casEntryPoint"
          class="org.springframework.security.cas.web.CasAuthenticationEntryPoint"&gt;
          &lt;property name="loginUrl"
              value="http://localhost:8080/cas/login" /&gt;
              &lt;property name="serviceProperties" ref="serviceProperties" /&gt;
      &lt;/bean&gt;
   &lt;!-- To delegate authorization to method calls rather than to urls --&gt;
   &lt;!-- (Thus, we don't need to set any url-interceptor in this conf) --&gt;
   &lt;security:global-method-security pre-post-annotations="enabled" /&gt;
      &lt;bean id="restAuthenticationEntryPoint" class="com.eform.rest.service.RESTAuthenticationEntryPoint" /&gt;
      &lt;bean id="myFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter"&gt;
          &lt;property name="authenticationManager" ref="authenticationManager" /&gt;
      &lt;/bean&gt; 
  
  
      &lt;bean id="casAuthenticationProvider"
          class="org.springframework.security.cas.authentication.CasAuthenticationProvider"&gt;
          &lt;property name="userDetailsService" ref="userService" /&gt;
          &lt;property name="serviceProperties" ref="serviceProperties" /&gt;
          &lt;property name="ticketValidator"&gt;
        &lt;bean class="org.jasig.cas.client.validation.Cas20ProxyTicketValidator"&gt;
          &lt;constructor-arg value="https://localhost:8443/cas"/&gt;
          &lt;property name="proxyCallbackUrl"
              value="localhost:8080/EFormRestServer/business"/&gt;
          &lt;property name="proxyGrantingTicketStorage" ref="pgtStorage"/&gt;
        &lt;/bean&gt;
      &lt;/property&gt;
      &lt;property name="statelessTicketCache"&gt;
        &lt;bean class="org.springframework.security.cas.authentication.EhCacheBasedTicketCache"&gt;
          &lt;property name="cache"&gt;
            &lt;bean class="net.sf.ehcache.Cache"
                init-method="initialise" destroy-method="dispose"&gt;
              &lt;constructor-arg value="casTickets"/&gt;
              &lt;constructor-arg value="50"/&gt;
              &lt;constructor-arg value="true"/&gt;
              &lt;constructor-arg value="false"/&gt;
              &lt;constructor-arg value="3600"/&gt;
              &lt;constructor-arg value="900"/&gt;
            &lt;/bean&gt;
          &lt;/property&gt;
        &lt;/bean&gt;
      &lt;/property&gt;
          &lt;property name="key" value="an_id_for_this_auth_provider_only" /&gt;
      &lt;/bean&gt;
      &lt;bean name="http403ForbiddenEntryPoint"
          class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint" /&gt;
      &lt;security:authentication-manager alias="authenticationManager"&gt;
          &lt;security:authentication-provider
              ref="casAuthenticationProvider" /&gt;
      &lt;/security:authentication-manager&gt;
      &lt;security:jdbc-user-service id="userService"
          data-source-ref="dataSource"
          users-by-username-query="select user_name, password, true from user where user_name = ?"
          authorities-by-username-query="select u.user_name, r.role from user u,user_role r where u.role_id=r.role and user_name = ?" /&gt;
  </code></pre>
  
  <p>Please help me to resolve this problem.</p>
  
  <p>Thanks</p>