Single sign on 为CAS Apereo版本CAS-overlay-template-6.0启用REST服务

Single sign on 为CAS Apereo版本CAS-overlay-template-6.0启用REST服务,single-sign-on,cas,apereo,Single Sign On,Cas,Apereo,我想为CAS Apereo版本CAS-overlay-template-6.0(在Ubuntu 16.04上)启用REST服务 我已完成以下步骤: 步骤1:将compile for REST API添加到build.gradle文件 root@ubuntu16:~/cas-overlay-template-6.0# nano build.gradle And add two line below under dependencies clock compile "org.apereo.cas:c

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

我已完成以下步骤:

步骤1:将compile for REST API添加到build.gradle文件

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:清洁构建

root@ubuntu16:~/cas-overlay-template-6.0# ./build.sh clean

步骤3:再次构建源代码

root@ubuntu16:~/cas-overlay-template-6.0# ./build.sh run
但在第三步,我得到了这样的错误

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>
CAS配置为接受用于身份验证的静态凭据列表。虽然这通常对演示有用,但强烈建议您禁用此身份验证方法(通过将“cas.authn.accept.users”设置为空值),并切换到更适合生产的模式。>
2019-12-30 01:17:55465警告[org.apereo.cas.config.support.authentication.AcceptUsersAuthenticationEventExecutionPlanConfiguration]-
2019-12-30 01:17:55806信息[org.apereo.cas.config.CasPersonDirectoryConfiguration]-
2019-12-30 01:17:59004警告[org.apereo.cas.web.CasWebApplicationContext]-

我哪里出错了?

删除此项:

compile "org.apereo.cas:cas-server-support-rest-services:6.0.0"
本模块将执行以下操作:

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

因此,如果您不需要该功能,可以将其删除

如果您确实需要它,您将需要定义属性名称/值,以便按照错误消息告诉您的那样强制执行授权

在通过CAS REST API添加服务时,未定义属性名称以强制授权。这可能是由于缺少属性名称定义的CAS设置中的配置错误造成的

因此,定义:

# cas.rest.attributeName=
# cas.rest.attributeValue=
PS不添加您不需要的内容。

删除此项:

compile "org.apereo.cas:cas-server-support-rest-services:6.0.0"
本模块将执行以下操作:

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

因此,如果您不需要该功能,可以将其删除

如果您确实需要它,您将需要定义属性名称/值,以便按照错误消息告诉您的那样强制执行授权

在通过CAS REST API添加服务时,未定义属性名称以强制授权。这可能是由于缺少属性名称定义的CAS设置中的配置错误造成的

因此,定义:

# cas.rest.attributeName=
# cas.rest.attributeValue=

PS不要添加您不需要的内容。

@Misagh Moayyed先生,如果我使用REST JSON,您可以清楚地给我看一些指南吗?您可能会发现这很有用:@Misagh Moayyed先生,如果我使用REST JSON,您可以清楚地给我看一些指南吗?您可能会发现这很有用: