2

(ドメインインスタンスの代わりに)ドメインクラスにACLアクセス許可を適用することは可能ですか?1つのクラスのユーザーにドメインオブジェクトを完全にCRUDするための包括的なアクセス許可を提供したいのに対し、2番目のクラスのユーザーはこれを行うために特定のACLエントリを持っている必要があるというシナリオがあります。

ACLエントリとロールベースのアクセス許可を組み合わせてこれを実現することは確かに可能ですが、インスタンスレベルに加えてクラスレベルでも機能するSpringACLのより洗練されたソリューションがあるように感じます。

わずかなSpringSecurityACLのドキュメントこの質問を調べています。

4

1 に答える 1

1

インターフェイスを見てくださいObjectIdentity。これは、システムで保護されているオブジェクトを表します。

/**
 * Obtains the actual identifier. This identifier must not be reused to represent other domain objects with
 * the same javaType.
 *
 * Because ACLs are largely immutable, it is strongly recommended to use
 * a synthetic identifier (such as a database sequence number for the primary key). Do not use an identifier with
 * business meaning, as that business meaning may change in the future such change will cascade to the ACL
 * subsystem data.
 *
 * @return the identifier (unique within this type; never null)
 */
Serializable getIdentifier();

/**
 * Obtains the "type" metadata for the domain object. This will often be a Java type name (an interface or a class)
 * – traditionally it is the name of the domain object implementation class.
 *
 * @return the "type" of the domain object (never null).
 */
String getType();

ご覧のとおりSerializable、SpringSecurityは識別子のタイプを説明するために使用します。したがって、クラス名でStringを使用することが可能です。

Spring Securityの作成者は、ほとんどの人がlong / integer IDでオブジェクトを識別すると想定しているため、SQLスキーマを更新する必要があります。

create table acl_object_identity(
...
object_id_class bigint not null,
object_id_identity bigint not null,

私がチェックしたように、それはインターフェースJdbcMutableAclServiceのみを使用するので、そのカスタマイズを処理することができObjectIdentityます。

org.springframework.security.aclsパッケージのソースコードを調べてください。

于 2012-11-19T16:00:18.843 に答える