私の典型的なアプリでは、ユーザーはaspxページのボタンをクリックし、C#ビジネスオブジェクトを呼び出してから、ストアドプロシージャを実行します。
役割のチェックは、スタックの一番上、スタックの一番下、またはすべてのレベルで実行する必要がありますか?悪意のあるユーザーが1つのメソッドを呼び出すことができる場合、彼は任意のメソッドを呼び出すことができるようです。したがって、効果的なセキュリティのために、すべてのメソッドをチェックする必要があります(そしてそれは書くための余分なコードがたくさんあります)。
これが私の質問を説明するための典型的なコールスタックです:
Page_Load()
{
if(p.IsInRole("Managers")) //or equivalent attribute
{
AddAccount.Visible =true;
}
}
AddAccount_OnClick()
{
if(p.IsInRole("Managers")) //or equivalent attribute
{
//Add the account
Account.Add(...); //and maybe another role check...
}
}
-- TSQL doesn't understand .NET authorization, this call is in a 'trusted' subsystem
create proc Add_Account @user, @account_name
If @user in (Select user from role_table where role='manager')
-- Add the account