如何管理ACS服务身份 - c#

我在azure WebRole中托管WCF 4.5服务
并且我使用Azure ACS服务身份来管理我的wcf用户(主动身份验证)。
我接受此模型,因为我们的用户数量有限

现在,我想知道如何通过C#代码以编程方式管理(创建/读取/更新/删除)ACS服务身份。

参考方案

看一下具有ACS Management Service API管理功能的ServiceIdentity

管理端点位于此处:https://NAMESPACE.accesscontrol.windows.net/v2/mgmt/service

您可以利用此ACS管理服务来创建新的ServiceIdentities

string name = "SampleServiceIdentity";
string password = "SampleServiceIdentityPassword";
ServiceIdentity sid = new ServiceIdentity()
{
    Name = name
};

DateTime startDate, endDate;
startDate = DateTime.UtcNow;
endDate = DateTime.MaxValue;

ServiceIdentityKey key = new ServiceIdentityKey()
{
    EndDate = endDate.ToUniversalTime(),
    StartDate = startDate.ToUniversalTime(),
    Type = "Password",
    Usage = "Password",
    Value = Encoding.UTF8.GetBytes(password),
    DisplayName = String.Format(CultureInfo.InvariantCulture, "{0} key for {1}", "Password", name)
};

svc.AddToServiceIdentities(sid);
svc.AddRelatedObject(
    sid,
    "ServiceIdentityKeys",
    key);


svc.SaveChanges(SaveChangesOptions.Batch);

此示例来自MSDN - How to: Use ACS Management Service to Configure Service Identies。

jQuery DataTable TableTool在IE和Firefox中不起作用 - c#

我在MVC4 ASP.NET Web应用程序中使用Jquery DataTable TableTool。导出到Excel和PDF可以与Chrome完美配合。但是不能在IE和FireFox中使用。我的代码如下 dom: 'T<"clear">lfrtip', tableTools: { "sSwfP…

从Azure Data Factory执行python脚本 - python

有人可以帮我从Azure数据工厂执行python函数吗?我已经将python函数存储在blob中,并且我试图触发同样的功能。但是我无法做到这一点。请协助。第二,我可以从ADF参数化python函数调用吗? python参考方案 您可能会发现ADF中的Azure Function Activity概念,它允许您在Data Factory管道中运行Azure F…

如何通过Ajax将数据发送到不同的元素? - php

script.js $(document).on("click", ".send", function (event) { $.ajax({ url: "update.php", data: { id: id, }, type: "POST", success: function…

当回复有时是一个对象有时是一个数组时,如何在使用改造时解析JSON回复? - java

我正在使用Retrofit来获取JSON答复。这是我实施的一部分-@GET("/api/report/list") Observable<Bills> listBill(@Query("employee_id") String employeeID); 而条例草案类是-public static class…

Mongo汇总 - javascript

我的收藏中有以下文件{ "_id": ObjectId("54490b8104f7142f22ecc97f"), "title": "Sample1", "slug": "samplenews", "cat": …