Edge for Private Cloud v4.19.01
在 Edge 上启用 SAML 后,您可以停用基本身份验证。但是,在停用基本身份验证之前,请执行以下操作:
- 确保您已将所有 Edge 用户(包括系统管理员)添加到您的 SAML IdP。
- 确保您已在 Edge 界面和 Edge Management API 上对 SAML 身份验证进行了全面测试。
- 如果您使用的是 Apigee Developer Services 门户(简称门户),请在该门户上配置并测试 SAML,以确保该门户可以连接到 Edge。请参阅配置门户以使用 SAML 与 Edge 通信。
查看当前的安全配置文件
您可以查看边缘安全配置文件以确定当前配置,以确定当前是否启用了基本身份验证和 SAML。在边缘管理服务器上使用以下 Edge Management API 调用,以查看 Edge 当前使用的安全配置文件:
curl -H "accept:application/xml" http://localhost:8080/v1/securityprofile -u sysAdminEmail:pWord
如果您尚未配置 SAML,则响应将如下所示,表示基本身份验证已启用:
<SecurityProfile enabled="true" name="securityprofile"> <UserAccessControl enabled="true"> </UserAccessControl> </SecurityProfile>
如果您已启用 SAML,则会在输出中看到 <ssoserver>
标记:
<SecurityProfile enabled="true" name="securityprofile"> <UserAccessControl enabled="true"> <SSOServer> <BasicAuthEnabled>true</BasicAuthEnabled> <PublicKeyEndPoint>/token_key</PublicKeyEndPoint> <ServerUrl>http://35.197.37.220:9099</ServerUrl> </SSOServer> </UserAccessControl> </SecurityProfile>
请注意,启用了 SAML 的版本还会显示 <BasicAuthEnabled>true</BasicAuthEnabled>,表示基本身份验证仍处于启用状态。
停用基本身份验证
在边缘管理服务器上使用以下 Edge Management API 调用来停用基本身份验证。请注意,您要将上一部分中返回的 XML 对象作为载荷传递。唯一的区别是您设置了 <BasicAuthEnabled>false</BasicAuthEnabled>:
curl -H "Content-Type: application/xml" http://localhost:8080/v1/securityprofile -u sysAdminEmail:pWord -d '<SecurityProfile enabled="true" name="securityprofile"> <UserAccessControl enabled="true"> <SSOServer> <BasicAuthEnabled>false</BasicAuthEnabled> <PublicKeyEndPoint>/token_key</PublicKeyEndPoint> <ServerUrl>http://35.197.37.220:9099</ServerUrl> </SSOServer> </UserAccessControl> </SecurityProfile>'
停用基本身份验证后,任何传递基本身份验证凭据的 Edge Management API 调用都会返回以下错误:
<Error> <Code>security.SecurityProfileBasicAuthDisabled</Code> <Message>Basic Authentication scheme not allowed</Message> <Contexts/> </Error>
重新启用基本身份验证
如果您出于任何原因必须重新启用基本身份验证,则必须执行以下步骤:
- 登录任何 Edge ZooKeeper 节点。
- 运行以下 bash 脚本以关闭所有安全设置:
#! /bin/bash /opt/apigee/apigee-zookeeper/bin/zkCli.sh -server localhost:2181 <<EOF set /system/securityprofile <SecurityProfile></SecurityProfile> quit EOF
您将看到如下格式的输出:
Connecting to localhost:2181 Welcome to ZooKeeper! JLine support is enabled WATCHER:: WatchedEvent state:SyncConnected type:None path:null [zk: localhost:2181(CONNECTED) 0] set /system/securityprofile <SecurityProfile></SecurityProfile> cZxid = 0x89 ... [zk: localhost:2181(CONNECTED) 1] quit Quitting...
- 重新启用基本身份验证和 SAML 身份验证:
curl -H "Content-Type: application/xml" http://localhost:8080/v1/securityprofile -u sysAdminEmail:pWord -d '<SecurityProfile enabled="true" name="securityprofile"> <UserAccessControl enabled="true"> <SSOServer> <BasicAuthEnabled>true</BasicAuthEnabled> <PublicKeyEndPoint>/token_key</PublicKeyEndPoint> <ServerUrl>http://35.197.37.220:9099</ServerUrl> </SSOServer> </UserAccessControl> </SecurityProfile>'
您现在可以再次使用基本身份验证了。