CAS configured for REST API redirects v1/tickets t

2019-04-16 03:17发布

I have followed the instructions for enabling REST API in my CAS server, which is built using a Maven overlay and then deployed to a Tomcat 7 server as cas.war. Pretty standard setup.

As per the instructions, I added

  <dependency>
      <groupId>org.jasig.cas</groupId>
      <artifactId>cas-server-integration-restlet</artifactId>
      <version>${cas.version}</version>
      <type>jar</type>
  </dependency>

to pom.xml. My cas.version is 4.1.4.

Then in web.xml, I added:

<servlet>
    <servlet-name>restlet</servlet-name>
    <servlet-class>com.noelios.restlet.ext.spring.RestletFrameworkServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>restlet</servlet-name>
    <url-pattern>/v1/*</url-pattern>
</servlet-mapping>

However, when I go to my.server.com/cas/v1/tickets, I get redirected to my.server.com/cas/login.

I did turn log4j debugging on and this is the trace I get after I make that request that gets redirected:

2016-11-09 14:42:34,515 DEBUG [org.jasig.cas.web.flow.InitialFlowSetupAction] - <Warning cookie path is set to
 null and path /cas>
2016-11-09 14:42:34,515 DEBUG [org.jasig.cas.web.flow.InitialFlowSetupAction] - <TGC cookie path is set to nul
l and path /cas>
2016-11-09 14:42:34,516 DEBUG [org.jasig.cas.web.support.CasArgumentExtractor] - <Extractor did not generate s
ervice.>
2016-11-09 14:42:34,516 DEBUG [org.jasig.cas.web.flow.GenerateLoginTicketAction] - <Generated login ticket LT-3-Hg0KXyQ4HEeF5rLiddc0PqeKSqCQ0v-xyz>
2016-11-09 14:42:34,525 DEBUG [org.jasig.cas.web.view.CasReloadableMessageBundle] - <No properties file found
for [classpath:custom_messages_en] - neither plain properties nor XML>
2016-11-09 14:42:34,526 DEBUG [org.jasig.cas.web.view.CasReloadableMessageBundle] - <No properties file found
for [classpath:custom_messages] - neither plain properties nor XML>
2016-11-09 14:42:34,527 DEBUG [org.jasig.cas.web.view.CasReloadableMessageBundle] - <No properties file found
for [classpath:messages_en] - neither plain properties nor XML>
2016-11-09 14:42:34,528 DEBUG [org.jasig.cas.web.view.CasReloadableMessageBundle] - <Re-caching properties for
 filename [classpath:messages] - file hasn't been modified>

In addition, I can't find com.noelios.restlet.ext.spring.RestletFrameworkServlet anywhere in the classpath. It is not in cas-server-integration-restlet-4.1.4.jar or any of its sub-dependencies. In my IDE, the only class so named is in a package org.restlet.ext.spring. Could the absence of that path be causing the redirect?

[INFO] \- org.jasig.cas:cas-server-integration-restlet:jar:4.1.4:compile
[INFO]    +- org.restlet.jee:org.restlet:jar:2.1.0:compile
[INFO]    +- org.restlet.jee:org.restlet.ext.spring:jar:2.1.0:runtime
[INFO]    |  +- cglib:cglib-nodep:jar:2.2:runtime
[INFO]    |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO]    +- org.restlet.jee:org.restlet.ext.servlet:jar:2.1.0:runtime
[INFO]    +- org.restlet.jee:org.restlet.ext.slf4j:jar:2.1.0:runtime
[INFO]    \- org.springframework:spring-beans:jar:4.1.8.RELEASE:compile

Or could there be somewhere in my overlay that causes it, rendering the REST API unusable? My ultimate objective is to be able to use CAS to provide authentication programmatically and outside its login HTML page.

标签: rest cas
0条回答
登录 后发表回答