首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >启用CAS Apereo版本的REST服务-覆盖-模板-6.0

启用CAS Apereo版本的REST服务-覆盖-模板-6.0
EN

Stack Overflow用户
提问于 2019-12-30 09:26:53
回答 1查看 1.1K关注 0票数 0

我想为CAS Apereo版本cas-overlay-template-6.0启用REST服务( Ubuntu 16.04)

我已经完成了这一步:

步骤1:将REST编译添加到build.gradle文件

代码语言:javascript
复制
root@ubuntu16:~/cas-overlay-template-6.0# nano build.gradle
And add two line below under dependencies clock
compile "org.apereo.cas:cas-server-support-rest:6.0.0"
compile "org.apereo.cas:cas-server-support-rest-services:6.0.0"

步骤2:清洁构建

代码语言:javascript
复制
root@ubuntu16:~/cas-overlay-template-6.0# ./build.sh clean

第3步:再次构建源代码

代码语言:javascript
复制
root@ubuntu16:~/cas-overlay-template-6.0# ./build.sh run

但在第三步,我遇到了这样的错误。

代码语言:javascript
复制
CAS is configured to accept a static list of credentials for authentication. While this is generally    useful for demo purposes, it is STRONGLY recommended that you DISABLE this authentication method (by     setting 'cas.authn.accept.users' to a blank value) and switch to a mode that is more suitable for production.>
2019-12-30 01:17:55,465 WARN [org.apereo.cas.config.support.authentication.AcceptUsersAuthenticationEventExecutionPlanConfiguration] - <>
2019-12-30 01:17:55,806 INFO [org.apereo.cas.config.CasPersonDirectoryConfiguration] - <Found and added static attributes [[email]] to the list of candidate attribute repositories>
2019-12-30 01:17:59,004 WARN [org.apereo.cas.web.CasWebApplicationContext] - <Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'registeredServiceResourceRestController' defined in class path resource [org/apereo/cas/support/rest/config/RestServicesConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apereo.cas.support.rest.RegisteredServiceResource]: Factory method 'registeredServiceResourceRestController' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: No attribute name is defined to enforce authorization when adding services via CAS REST APIs. This is likely due to misconfiguration in CAS settings where the attribute name definition is absent>

我哪里出错了?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-12-30 11:48:10

删除以下内容:

代码语言:javascript
复制
compile "org.apereo.cas:cas-server-support-rest-services:6.0.0"

这个模块是这样做的:

调用CAS将应用程序注册到自己的服务注册表中。REST调用必须使用基本身份验证进行身份验证,其中凭据是由现有CAS身份验证策略认证和接受的,而且必须使用通过CAS属性在CAS配置中指定的预先配置的角色/属性名称和值来授权经过身份验证的主体。请求的主体必须是以JSON格式注册的服务定义,当然,CAS必须配置为接受在主体中定义的特定服务类型。此请求接受的媒体类型是application/json。

所以你可以删除它,如果你不需要它的功能。

如果您确实需要它,您将需要定义属性名称/值,这些属性名/值可以像错误消息告诉您的那样强制授权。

在通过

REST添加服务时,定义了任何属性名称以强制授权。这可能是由于CAS设置中不存在属性名定义的错误配置所致。

因此,定义:

代码语言:javascript
复制
# cas.rest.attributeName=
# cas.rest.attributeValue=

不要添加你不需要的东西。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59528438

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档