Cuối cùng tôi đã tìm thấy bài viết "so sánh" tối qua.
http://www.c-sharpcorner.com/uploadfile/a.ferendeles/netsqlazman12122006123316pm/netsqlazman.aspx
Tôi sẽ dán phần có liên quan ở đây (bên dưới). (Chỉ trong trường hợp trang web chấm dứt tồn tại trong tương lai. Cơ hội nhỏ, tôi biết, nhưng tôi ghét liên kết "Câu trả lời là ở đây" và khi bạn nhấn vào liên kết, đó là liên kết đã chết.)
Từ những gì Tôi có thể kể.
NetSqlAzMan cung cấp hàm (do người dùng xác định-chức năng) mà bạn có thể quá tải để cung cấp danh sách người dùng (được gán cho vai trò/nhiệm vụ). NetSqlAzMan không chỉ cung cấp ánh xạ "Vâng bạn có thể" (Grant), mà còn cung cấp cả Deny và Grant-With-Delegate. NetSqlAzMan và Azman cho phép người dùng (nhóm) ánh xạ vai trò. Chỉ NetSqlAzMan cho phép người dùng ánh xạ nhiệm vụ.
Sau khi xem xét một vài mẫu ... mô hình đối tượng của NetSqlAzMan rất sạch sẽ.
============================================== =========
Ms Authorization Manager (AzMan) vs NET Sql Authorization Manager (NetSqlAzMan)
Như đã chỉ ra trước đó, một sản phẩm của Microsoft tương tự đã tồn tại và được gọi là Authorization Manager (AzMan); AzMan hiện diện, theo mặc định, trong Windows Server 2003 và, thông qua thiết lập Gói quản trị, trong Windows XP.
Sự khác biệt quan trọng giữa AzMan và NetSqlAzMan là đầu tiên là dựa trên vai trò, đó là, dựa trên thuộc - Vai trò khái niệm và container hoạt động trong mỗi vai trò, trong khi thứ hai là dựa trên item (hoặc nếu bạn thích dựa trên hoạt động), đó là người dùng hoặc người dùng nhóm hoặc nhóm các nhóm có thể hoặc không thể thuộc về vai trò hoặc thực hiện nhiệm vụ và/hoặc hoạt động đó (mục).
Đây là tính năng quan trọng nhất và khác biệt giữa hai sản phẩm :
Ms AzMan:
* It's COM.
* It's equipped by a MMC 2.0 (COM) console.
* Its storage can be an XML file or ADAM (Active Directory Application Mode - e un LDAP).
* It's role-based.
* It supports static/dynamic applicative groups, members/not-members.
* Structure based on Roles -> Tasks -> Operations. (Hierarchical Roles and Tasks , none Operations).
* Authorizations can be added only to Roles.
* It doesn't implement the "delegate" concept.
* It doesn't manage authorizations "in the time".
* It doesn't trigger events.
* The only type of authorization is "Allow".
(to "deny" it needs to remove the user/group from his Role).
* It supports Scripting/Biz rules.
* It supports Active Directory users/groups and ADAM users.
NetSqlAzMan:
* It's .NET 2.0.
* It's equipped by a MMC 3.0 (.NET) console.
* Its storage is a Sql Server database(2000/MSDE/2005/Express).
* It's based on Tdo - Typed Data Object technology.
* It's Item-based.
* Structure based on Roles -> Tasks -> Operations. (all hierarchical ones).
* Authorizations can be added to Roles, Task and Operations.
* It supports static/dynamic applicative groups, members/not-members.
* LDAP query testing directly from console.
* It's time-dependant.
* It's delegate-compliant.
* It triggers events (ENS).
* It supports 4 authorization types:
o Allow with delegation (authorized and authorized to delegate).
o Allow (authorized).
o Deny (not authorized).
o Neutral (neutral permission, it depends on higher level Item permission).
* Hierarchical authorizations.
* It supports Scripting/Biz rules (compiled in .NET - C# - VB - and not interpreted)
* It supports Active Directory users/groups and custom users defined in SQL Server Database.
Dưới đây là Gotcha khác.
Azman mẫu mã: http://channel9.msdn.com/forums/sandbox/252978-AzMan-in-the-Enterprise-Sample-Code http://channel9.msdn.com/forums/sandbox/252973-Programming-AzMan-Sample-Code
using System;
using System.Security.Principal;
using System.Runtime.InteropServices;
using AZROLESLib;
namespace TreyResearch {
public class AzManHelper : IDisposable {
AzAuthorizationStore store;
IAzApplication app;
string appName;
public AzManHelper(string connectionString, string appName) {
this.appName = appName;
try {
// load and initialize the AzMan runtime
store = new AzAuthorizationStore();
store.Initialize(0, connectionString, null);
// drill down to our application
app = store.OpenApplication(appName, null);
}
catch (COMException x) {
throw new AzManException("Failed to initizlize AzManHelper", x);
}
catch (System.IO.FileNotFoundException x) {
throw new AzManException(string.Format("Failed to load AzMan policy from {0} - make sure your connection string is correct.", connectionString), x);
}
}
public void Dispose() {
if (null == app) return;
Marshal.ReleaseComObject(app);
Marshal.ReleaseComObject(store);
app = null;
store = null;
}
public bool AccessCheck(string audit, Operations op,
WindowsIdentity clientIdentity) {
try {
// first step is to create an AzMan context for the client
// this looks at the security identifiers (SIDs) in the user's
// access token and maps them onto AzMan roles, tasks, and operations
IAzClientContext ctx = app.InitializeClientContextFromToken(
(ulong)clientIdentity.Token.ToInt64(), null);
// next step is to see if this user is authorized for
// the requested operation. Note that AccessCheck allows
// you to check multiple operations at once if you desire
object[] scopes = { "" };
object[] operations = { (int)op };
object[] results = (object[])ctx.AccessCheck(audit, scopes, operations,
null, null, null, null, null);
int result = (int)results[0];
return 0 == result;
}
catch (COMException x) {
throw new AzManException("AccessCheck failed", x);
}
}
public bool AccessCheckWithArg(string audit, Operations op,
WindowsIdentity clientIdentity,
string argName, object argValue) {
try {
// first step is to create an AzMan context for the client
// this looks at the security identifiers (SIDs) in the user's
// access token and maps them onto AzMan roles, tasks, and operations
IAzClientContext ctx = app.InitializeClientContextFromToken(
(ulong)clientIdentity.Token.ToInt64(), null);
// next step is to see if this user is authorized for
// the requested operation. Note that AccessCheck allows
// you to check multiple operations at once if you desire
object[] scopes = { "" };
object[] operations = { (int)op };
object[] argNames = { argName };
object[] argValues = { argValue };
object[] results = (object[])ctx.AccessCheck(audit, scopes, operations,
argNames, argValues,
null, null, null);
int result = (int)results[0];
return 0 == result;
}
catch (COMException x) {
throw new AzManException("AccessCheckWithArg failed", x);
}
}
// use this to update a running app
// after you change the AzMan policy
public void UpdateCache() {
try {
store.UpdateCache(null);
Marshal.ReleaseComObject(app);
app = store.OpenApplication(appName, null);
}
catch (COMException x) {
throw new AzManException("UpdateCache failed", x);
}
}
}
public class AzManException : Exception {
public AzManException(string message, Exception innerException)
: base(message, innerException)
{}
}
}
Đó là Azman mã giúp đỡ. Đó là công cụ COM/Interopish xấu xí.: <
Bây giờ kiểm tra mẫu mã NetSqlAzMan:
http://netsqlazman.codeplex.com/wikipage?title=Samples
/// <summary>
/// Create a Full Storage through .NET code
/// </summary>
private void CreateFullStorage()
{
// USER MUST BE A MEMBER OF SQL DATABASE ROLE: NetSqlAzMan_Administrators
//Sql Storage connection string
string sqlConnectionString = "data source=(local);initial catalog=NetSqlAzManStorage;user id=netsqlazmanuser;password=password";
//Create an instance of SqlAzManStorage class
IAzManStorage storage = new SqlAzManStorage(sqlConnectionString);
//Open Storage Connection
storage.OpenConnection();
//Begin a new Transaction
storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
//Create a new Store
IAzManStore newStore = storage.CreateStore("My Store", "Store description");
//Create a new Basic StoreGroup
IAzManStoreGroup newStoreGroup = newStore.CreateStoreGroup(SqlAzManSID.NewSqlAzManSid(), "My Store Group", "Store Group Description", String.Empty, GroupType.Basic);
//Retrieve current user SID
IAzManSid mySid = new SqlAzManSID(WindowsIdentity.GetCurrent().User);
//Add myself as sid of "My Store Group"
IAzManStoreGroupMember storeGroupMember = newStoreGroup.CreateStoreGroupMember(mySid, WhereDefined.Local, true);
//Create a new Application
IAzManApplication newApp = newStore.CreateApplication("New Application", "Application description");
//Create a new Role
IAzManItem newRole = newApp.CreateItem("New Role", "Role description", ItemType.Role);
//Create a new Task
IAzManItem newTask = newApp.CreateItem("New Task", "Task description", ItemType.Task);
//Create a new Operation
IAzManItem newOp = newApp.CreateItem("New Operation", "Operation description", ItemType.Operation);
//Add "New Operation" as a sid of "New Task"
newTask.AddMember(newOp);
//Add "New Task" as a sid of "New Role"
newRole.AddMember(newTask);
//Create an authorization for myself on "New Role"
IAzManAuthorization auth = newRole.CreateAuthorization(mySid, WhereDefined.Local, mySid, WhereDefined.Local, AuthorizationType.AllowWithDelegation, null, null);
//Create a custom attribute
IAzManAttribute<IAzManAuthorization> attr = auth.CreateAttribute("New Key", "New Value");
//Create an authorization for DB User "Andrea" on "New Role"
IAzManAuthorization auth2 = newRole.CreateAuthorization(mySid, WhereDefined.Local, storage.GetDBUser("Andrea").CustomSid, WhereDefined.Local, AuthorizationType.AllowWithDelegation, null, null);
//Commit transaction
storage.CommitTransaction();
//Close connection
storage.CloseConnection();
}
Đó kể một câu chuyện trong và của chính nó.
Tôi chỉ muốn chỉ ra rằng các bài viết và các điểm thực hiện về AzMan là từ một bài báo đăng tải trong năm 2006. Azman đã được cập nhật và cải tiến (escpecially sự hỗ trợ API và SQL Server Store) khi Windows Server 2008 bước ra. Nhưng có vẻ như Azman đã bị bỏ rơi. Bản cập nhật blog của Azman Team mới nhất là từ năm 2008. – Haydar
Cảm ơn bạn đã có mẹo. Không được tải lên trên Azman, nhưng thực tế nó được gắn với các phiên bản O/S cụ thể ...... đó là một điểm rắc rối với tôi. Nhưng nó có thể là một trong những thứ đó là nguồn cảm hứng cho một số thứ tốt hơn .... – granadaCoder
Là NETSQL Azman phụ thuộc vào Windows Azman theo bất kỳ cách nào. Kể từ khi Azman có thể không được chấp nhận trong các phiên bản Windows trong tương lai, điều đó có nghĩa là NETSQL Azman sẽ không hoạt động khi điều đó xảy ra? – Donny