在脚本中建立客户端上下文
在授权管理器中,应用程序通过调用表示客户端上下文的 IAzClientContext 对象的 AccessCheck 方法确定是否向客户端授予对操作的访问权限。
应用程序可以使用令牌的句柄、域和用户名或 安全标识符 的字符串表示形式创建客户端上下文, (客户端的 SID) 。
使用 IAzApplication 对象的 InitializeClientContextFromToken、InitializeClientContextFromName 和 InitializeClientContextFromStringSid 方法来创建客户端上下文。
以下示例演示如何根据客户端名称创建 IAzClientContext 对象。 该示例假定驱动器 C 的根目录中有一个名为 MyStore.xml 的现有 XML 策略存储,并且此存储包含名为 Expense 的应用程序。
<%@ Language=VBScript %>
<%
' Create the AzAuthorizationStore object.
Dim AzManStore
Set AzManStore = CreateObject("AzRoles.AzAuthorizationStore")
' Initialize the authorization store.
AzManStore.Initialize 0, "msxml://C:\MyStore.xml"
' Open the application object in the store.
Dim expenseApp
Set expenseApp = AzManStore.OpenApplication("Expense")
' Create a client context.
Dim clientName
clientName = Request.ServerVariables("LOGON_USER")
Dim clientContext
Set clientContext = _
expenseApp.InitializeClientContextFromName(clientName)
%>