为REST API配置的CAS将v1 / ticket重定向到登录HTML

时间:2016-11-09 19:41:05

标签: rest cas

我已经跟踪the instructions在我的CAS服务器中启用REST API,该服务器使用Maven覆盖构建,然后以cas.war的形式部署到Tomcat 7服务器。非常标准的设置。

根据说明,我添加了

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

pom.xml。我的cas.version是4.1.4。

然后在web.xml中,我添加了:

<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>

但是,当我转到 my.server.com/cas/v1/tickets 时,我会被重定向到 my.server.com/cas/login 。< / p>

我确实打开了log4j调试,这是我获取重定向请求后得到的跟踪:

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>

另外,我在类路径中的任何地方都找不到com.noelios.restlet.ext.spring.RestletFrameworkServlet。它不在cas-server-integration-restlet-4.1.4.jar或其任何子依赖项中。在我的IDE中,唯一这样命名的类是在包org.restlet.ext.spring中。缺少那条路可能导致重定向吗?

[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

或者我的叠加层中是否存在导致它的某个地方,导致REST API无法使用?我的最终目标是能够使用CAS以编程方式在其登录HTML页面之外提供身份验证。

0 个答案:

没有答案