アプリケーション・クライアントの許可は、ObjectGrid 許可クラス、許可メカニズム、許可検査期間、および作成者限定アクセス許可から構成されます。
eXtreme Scale の許可 は Subject オブジェクトおよびアクセス権に基づいています。本製品 は、2 種類の許可メカニズム、つまり、Java 認証・承認サービス (JAAS) とカスタム許可をサポートしています。
eXtreme Scale は、 パフォーマンス上の理由で、マップ許可検査結果のキャッシングをサポートしています。このメカニズムがないと、特定の許可クラスのメソッドのリストにあるメソッドが呼び出されたときに、ランタイムは、構成された許可メカニズムを呼び出してアクセスを許可します。 この許可検査期間が設定されていると、許可メカニズムは、許可検査期間に基づいて定期的に呼び出されます。各許可クラスのメソッドのリストについては、クライアント許可プログラミングを参照してください。
アクセス権の許可情報は Subject オブジェクトに基づいています。クライアントがメソッドにアクセスしようとすると、eXtreme Scale ランタイムは、Subject オブジェクトに基づいて キャッシュ内を検索します。キャッシュ内でオブジェクトが見つからない場合、 ランタイムは、この Subject オブジェクトに付与されている許可を確認し、 この許可をキャッシュに格納します。
許可 検査期間は、ObjectGrid が初期化される前に定義しておく必要があります。許可検査期間は、以下の 2 とおりの方法で構成できます。
<objectGrids>
<objectGrid name="secureClusterObjectGrid" securityEnabled="true"
authorizationMechanism="AUTHORIZATION_MECHANISM_JAAS"
permissionCheckPeriod="45">
<bean id="bean id="TransactionCallback"
className="com.ibm.websphere.samples.objectgrid.HeapTransactionCallback" />
...
</objectGrids>
/**
* This method takes a single parameter indicating how often you
* want to check the permission used to allow a client access. If the
* parameter is 0 then every single get/put/update/remove/evict call
* asks the authorization mechanism, either JAAS authorization or custom
* authorization, to check if the current subject has permission. This might be
* prohibitively expensive from a performance point of view depending on
* the authorization implementation, but if you need to have ever call check the
* authorization mechanism, then set the parameter to 0.
* Alternatively, if the parameter is > 0 then it indicates the number
* of seconds to cache a set of permissions before returning to
* the authorization mechanism to refresh them. This value provides much
* better performance, but if the back-end
* permissions are changed during this time then the ObjectGrid can
* allow or prevent access even though the back-end security
* provider was modified.
*
* @param period the permission check period in seconds.
*/
void setPermissionCheckPeriod(int period);
作成者限定アクセス許可を 使用すると、エントリーを ObjectGrid マップに挿入したユーザーのみ (関連付けられた Principal オブジェクト によって表される) が、そのエントリーにアクセス (read、update、invalidate、および remove) できます 。
既存の ObjectGrid マップの許可モデルは、 アクセス・タイプに基づいていて、データ・エントリーには基づいていません。すなわち、 ユーザーは、read、write、insert、delete、または invalidate などの特定の アクセス・タイプをマップ内のすべてのデータに対して保持しているか、 またはどのデータに対しても保持していないかのいずれかです。しかし、eXtreme Scale は、個別のデータ・エントリーに 対するユーザーの許可は行いません。この機能は、データ・エントリーに対してユーザーを許可するための 新しい方法を提供します。
さまざまなユーザーが異なるデータのセットにアクセスするような シナリオでは、このモデルが便利です。ユーザーがデータを 永続ストアから ObjectGrid マップにロードするときに、永続ストアによって アクセスを許可できます。このケースでは、ObjectGrid マップ層で別の 許可を実行する必要がありません。必要な処理は、作成者限定アクセスの機能を使用可能にして、 データをマップにロードするユーザーが、確実にそのデータにアクセスできる ようにするのみです。
作成者限定アクセス・モードは、次の 2 とおりの方法で 構成できます。
XML ファイルを使用:
<objectGrids>
<objectGrid name="secureClusterObjectGrid" securityEnabled="true"
accessByCreatorOnlyMode="supersede"
<bean id="TransactionCallback"
classname="com.ibm.websphere.samples.objectgrid.HeapTransactionCallback" />
...
</objectGrids>
プログラムで:
/**
* Set the "access by creator only" mode.
* Enabling "access by creator only" mode ensures that only the user (represented
* by the Principals associated with it), who inserts the record into the map,
* can access (read, update, invalidate, and remove) the record.
* The "access by creator only" mode can be disabled, or can complement the
* ObjectGrid authorization model, or it can supersede the ObjectGrid
* authorization model. The default value is disabled:
* {@link SecurityConstants#ACCESS_BY_CREATOR_ONLY_DISABLED}.
* @see SecurityConstants#ACCESS_BY_CREATOR_ONLY_DISABLED
* @see SecurityConstants#ACCESS_BY_CREATOR_ONLY_COMPLEMENT
* @see SecurityConstants#ACCESS_BY_CREATOR_ONLY_SUPERSEDE
*
* @param accessByCreatorOnlyMode the access by creator mode.
*
* @since WAS XD 6.1 FIX3
*/
void setAccessByCreatorOnlyMode(int accessByCreatorOnlyMode);
grant codebase "http://www.ibm.com/com/ibm/ws/objectgrid/security/PrivilegedAction"
Principal com.acme.PrincipalImpl "Manager1" {
permission com.ibm.websphere.objectgrid.security.MapPermission
"banking.account", "all"
};
grant codebase "http://www.ibm.com/com/ibm/ws/objectgrid/security/PrivilegedAction"
Principal com.acme.PrincipalImpl "Employee1" {
permission com.ibm.websphere.objectgrid.security.MapPermission
"banking.account", "read, insert"
};