TsgcWSPServer_sgc › プロパティ › RPCAuthentication
RPC メソッドとそれを実行するのに必要なユーザーのオプションの許可リスト。
property RPCAuthentication: TsgcWSAuthentication_Methods read FRPCAuthentication write SetRPCAuthentication;
—
EnabledがTrueの場合、着信するすべてのRPC呼び出しはまずMethodsリストに対してチェックされます。各エントリは、素のメソッド名(認証済みの任意のユーザーに許可)またはmethod=userペア(その認証済みユーザーのみに許可)のいずれかです。どのエントリにも一致しないメソッドはOnRPCAuthenticationイベントをトリガーするため、ハンドラは実行時に決定できます。イベントが割り当てられていない場合、またはハンドラがFalseを返す場合、サーバーはJSON-RPCの「Method not found」エラーで応答します。EnabledがFalseの場合、すべてのメソッドが受け入れられます。
oProtocol.RPCAuthentication.Enabled := True;
oProtocol.RPCAuthentication.Methods.Add('ping');
oProtocol.RPCAuthentication.Methods.Add('admin=root');