Edge で SAML または LDAP を有効にすると、基本認証を無効にできます。ただし、Basic 認証を無効にする前に、次のことを行う必要があります。
- システム管理者を含むすべての Edge ユーザーを IDP に追加していることを確認します。
- Edge UI と Edge Management API で IDP 認証を徹底的にテストしてください。
- Apigee Developer Services ポータル(略して「ポータル」)を使用している場合は、ポータルで外部 IDP を構成してテストし、ポータルが Edge に接続できることを確認します。外部 IDP 用にポータルを構成するをご覧ください。
現在のセキュリティ プロファイルを表示する
Edge セキュリティ プロファイルを表示して、現在の構成を確認し、基本認証と外部 IDP が現在有効になっているかどうかを判断できます。Edge で現在使用されているセキュリティ プロファイルを表示するには、Edge Management Server で次の Edge Management API 呼び出しを使用します。
curl -H "accept:application/xml" http://localhost:8080/v1/securityprofile -u sysAdminEmail:pWord
外部 IDP をまだ構成していない場合、レスポンスは次のようになります。これは、基本認証が有効になっていることを意味します。
<SecurityProfile enabled="true" name="securityprofile">
<UserAccessControl enabled="true">
</UserAccessControl>
</SecurityProfile>外部 IDP をすでに有効にしている場合は、レスポンスに <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>外部 IDP が有効になっているバージョンでは、<BasicAuthEnabled>true</BasicAuthEnabled> も表示されます。これは、基本認証が引き続き有効であることを意味します。
Basic 認証を無効にする
Basic 認証を無効にするには、Edge Management Server で次の Edge Management API 呼び出しを使用します。前のセクションで返された XML オブジェクトをペイロードとして渡します。唯一の違いは <BasicAuthEnabled> を false に設定していることです。次の例をご覧ください。
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>'Basic 認証を無効にした後、Basic 認証の認証情報を渡す Edge Management API 呼び出しは、次のエラーを返します。
<Error>
<Code>security.SecurityProfileBasicAuthDisabled</Code>
<Message>Basic Authentication scheme not allowed</Message>
<Contexts/>
</Error>Basic 認証を再び有効にする
なんらかの理由で Basic 認証を再度有効にする必要がある場合は、次の手順を行います。
- 任意の 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...
- Basic 認証と外部 IDP 認証を再度有効にします。
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>'
これで、Basic 認証を再び使用できるようになります。新しい Edge エクスペリエンスが有効になっている場合、Basic 認証は機能しません。