AX2012可以创建一种account type为claims user的账号,这种账号不需要在AD中事先已创建用户,但是claims账号是无法通过rich client登陆到AX,它的主要应用场景是在enterprise protal或者AIF中,这里具体来看看如何在AIF中使用Claims user。首先在AX中创建一个Claims user:

User Id是必须输入的,根据自己的命名规则可以任意编写,network domain也是可以根据自己的用途任意输入,alias可以使用邮件地址。

接下来我们创建一个名为ItemsPort的inbound ports,service operations中只选择InventItemService.find操作。需要注意的是我们要勾选“Allow trusted intermediary to impersonate”,在Trusted intermediary users中我们添加一个用户,比如Administrator账号。这是一个AD域用户的账号,后续我们的程序要用这个账号来执行。

创建一个c#的控制台程序,在service reference中添加从http://AOS_HOST:8101/DynamicsAx/Services/ItemsPort导入的服务,命名空间我们取为ItemReference。完整的程序如下:

using ConsoleApplication1.ItemReference;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var context = new CallContext
{
Company = "USMF",
LogonAsUser = "TestApp\\cu001@testapp.local",
Language = "en-gb"
};
var client = new ItemServiceClient();
var criteria = new QueryCriteria();
var itemIdCriteria = new CriteriaElement
{
DataSourceName = "InventTable",
FieldName = "ItemId",
Operator = Operator.Range,
Value1 = "A",
Value2 = "B"
};
criteria.CriteriaElement = new CriteriaElement[];
criteria.CriteriaElement[] = itemIdCriteria; try
{
var myItem = client.find(context, criteria);
if (myItem != null &&
myItem.InventTable != null &&
myItem.InventTable.Length > )
{
foreach (var item in myItem.InventTable)
{
Console.WriteLine("Item Id {0} - {1}", item.ItemId,item.NameAlias);
}
}
}
catch (Exception e)
{
Console.WriteLine("Error {0}", e.Message);
} Console.ReadKey();
}
}
}

程序是在inventtable查找首字母介于A和B直接的料号,运行后得到的结果是:“Error Access denied to method find in class InventItemService.”,这是因为我们没有对CU001用户授予权限,可以添加system administrator角色到CU001,重新运行就能得到正确的结果。

注意我们运行这个C#程序时用的域管理员账号,这个账号也是被添加到ItemPorts的Trusted intermediary users列表,如果我们把这个账号从Trusted intermediary users删除会是什么结果?我们会得到异常“Error An error occurred.”,具体的信息可以在system administration->periodic->services and application framework->exceptions查看,看到的是“The submitting user 'admin' has not been configured as a trusted intermediary for the port.”,“User is not authorised for this port.”。

如果不勾选“Allow trusted intermediary to impersonate”,又会是什么结果呢?得到的错误是“The submitting user 'Admin' is different from the logon user 'CU001', but a trusted intermediary has not been enabled on the port.”,同样最后结果也是“User is not authorised for this port.”。

回过头来看看AX没有要求CU001用户输入密码,只用它的用户名就可以登陆,这是因为AX信任当前程序的运行账号,相信这个Trusted intermediary users已经代为对CU001进行了认证。这是AIF的例子,EP也是同样如此,我们不需要对vendor和customer在AD中创建账号,而是直接在AX中创建对应的claims用户,而对这些用户的认证交由EP站点,AX信任EP站点连接时所有的BCP 代理账号。

[AX2012]Claims user的更多相关文章

  1. 全新的membership框架Asp.net Identity(2)——绕不过的Claims

    本来想直接就开始介绍Identity的部分,奈何自己挖坑太深,高举高打的方法不行.只能自己默默下载了Katana的源代码研究了好一段时间.发现要想能够理解好用好Identity, Claims是一个绕 ...

  2. AX2012导Demo数据

    看到这篇文章后http://www.cnblogs.com/duanshuiliu/archive/2012/07/18/2597645.html,为了大家的方便就分享下 关于AX2012的导Demo ...

  3. Creating Custom Connector Sending Claims with SharePoint 2013

    from:http://blogs.msdn.com/b/security_trimming_in_sharepoint_2013/archive/2012/10/29/creating-custom ...

  4. Claims Identity

    using System;using System.Collections.Generic;using System.Linq;using System.Security.Claims;using S ...

  5. AX2012 DMF数据导入的问题

    由于AX2012的数据结构比较复杂,通过Excel直接导入表的方式很多数据已经难以导入,比如物料信息,2009只需要导入InventTable,InventTableModule和InventItem ...

  6. [AX]AX2012 Number sequence framework :(三)再谈Number sequence

    AX2012的number sequence framework中引入了两个Scope和segment两个概念,它们的具体作用从下面序列的例子说起. 法国/中国的法律要求财务凭证的Journal nu ...

  7. [AX2012 R3]在SSRS报表中使用QR二维码

    AX2012是自带生成QR二维码的类,可以很方便的用在SSRS报表中,下面演示如何在RDP的报表中使用二维码,首先从定义临时表开始: 字段URL是要用于二维码的字符串,QrCode是container ...

  8. [AX2012 R3]关于Alerts

    AX2012提供两种类型的Alert,Change-based alert和Due-date-based alert,前者用于在对新建记录.删除记录.记录的某个指定字段被改变的时候发出提醒,后者则是用 ...

  9. AX2012 R3升级CU8的一些错误

    AX2012 R3安装升级包CU8后进入系统,系统会提示打开软件升级清单“Software update checklist”,清单列出了升级要做的一系列动作. 在进行到编译应用时“Compile a ...

随机推荐

  1. 根据Url 获取图片尺寸 iOS

    // 根据图片url获取图片尺寸 +(CGSize)getImageSizeWithURL:(id)imageURL {     NSURL* URL = nil;     if([imageURL ...

  2. .NET Core竟然无法在Mac下进行build

    KRuntime 改为 XRE 之后(详见从 KRE 到 XRE :ASP.NET 5 中正在消失的那些K),昨天在 mac 用 git 签出 XRE 的代码库,直接执行其中的 build 命令 sh ...

  3. 利用Junit4进行程序模块的测试,回归测试

    ①在你的工程里导入JUnit4的包 ②右击创建JUnit测试类,在测试类中编写测试代码即可. JUnit 目前需要掌握的有一下几点: Fixture系列:BeforeClass,AfterClass, ...

  4. Chrome RenderText分析(2)

      接Chrome RenderText分析(1) 继续分析以下步骤   一.TextRun结构 struct TextRun { TextRun(); ~TextRun(); ui::Range r ...

  5. Nginx学习笔记(九) 配置文件详细说明

    配置文件详细说明 工作了几个月要开始做一些后台开发,免不了接触nginx,以前一般只是简单的使用,更多的分析内部模块的具体实现,为了部署需要进一步掌握配置方法. 全局配置信息 #nginx worke ...

  6. [游戏模版11] Win32 动画 时间消息

    >_<:This time we will study a new way to operate your picture.That is running your picture by ...

  7. Linux服务器Cache占用过多内存导致系统内存不足问题的排查解决(续)

    作者: 大圆那些事 | 文章可以转载,请以超链接形式标明文章原始出处和作者信息 网址: http://www.cnblogs.com/panfeng412/archive/2013/12/17/dro ...

  8. .net中对象序列化技术浅谈

    .net中对象序列化技术浅谈 2009-03-11 阅读2756评论2 序列化是将对象状态转换为可保持或传输的格式的过程.与序列化相对的是反序列化,它将流转换为对象.这两个过程结合起来,可以轻松地存储 ...

  9. paip.提升中文分词准确度---新词识别

    paip.提升中文分词准确度---新词识别 近来,中文每年大概出现800---1仟个新的词.. 60%的分词错误是由新词导致的 作者Attilax  艾龙,  EMAIL:1466519819@qq. ...

  10. iOS开发-友盟分享使用(2)

    1.友盟SDK提供功能:分享喜欢的东西到新浪微博.qq空间.为微信朋友圈等等等等社交圈. 2.友盟分享前期准备 (1)注册账号 去官网 (2)创建应用获取appkey 类似5556a53667e*** ...