小编Jay*_*ran的帖子

如何在 Azure Active Directory 中使用多个 OpenIdConnectAuthenticationOptions

在我们的项目中,我们想要显示两个选项(以员工身份登录和以客户身份登录)。根据选择,我们希望使用 Azure Active Directory B2B 或 Azure B2C 对用户进行身份验证。

我可以将身份验证模式设置为被动并在单击链接后打开登录页面。配置单个 OpenIdConnectAuthenticationOptions 时效果很好。但当我配置多个 OpenIdConnectAuthenticationOptions 时,这不起作用。

        app.UseOpenIdConnectAuthentication(
            new OpenIdConnectAuthenticationOptions
            {
                AuthenticationMode = AuthenticationMode.Passive,
                MetadataAddress = String.Format(aadInstance2, tenant2, SignUpSignInPolicyId),
                ClientId = clientId2,
                RedirectUri = redirectUri2,
                PostLogoutRedirectUri = postLogoutRedirectUri,
            });

        app.UseOpenIdConnectAuthentication(
            new OpenIdConnectAuthenticationOptions
            {
                AuthenticationMode = AuthenticationMode.Passive,
                ClientId = clientId,
                Authority = authority,
                PostLogoutRedirectUri = postLogoutRedirectUri,
            });

    public void Redirect()
    {
       HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "https://localhost/WebApp1/" }, OpenIdConnectAuthenticationDefaults.AuthenticationType);
    }
Run Code Online (Sandbox Code Playgroud)

c# azure oauth-2.0 azure-active-directory openid-connect

6
推荐指数
1
解决办法
4443
查看次数

何时使用dynamoDB -UseCases

我试图找出最适合Amazon dynamoDB的用例。

当我搜索大多数博客时,DyanmoDb将仅用于大量数据(BigData)。

我有关系数据库的背景。NoSQL DB对我来说是新的。因此,当我尝试将其与常规关系数据库知识联系起来时。

与DynamoDb相关的大多数概念是使用分区键/排序键创建无模式表。并尝试根据键查询它们。此外,没有这样的存储过程概念可以使查询更容易和简单。

如果我们管理如此庞大的数据,并且每次都执行如此复杂的查询来检索数据,那将是没有存储过程的正确方法吗?

注意:我可能对该概念有错误的理解。所以,请任何人在这里清除我的想法

预先感
谢杰伊

bigdata nosql amazon-dynamodb

6
推荐指数
1
解决办法
1840
查看次数

使用Add-AzureVHD命令行开关在Azure Powershell中上载VHD的问题

我正在尝试什么应该是一个非常基本的任务.我已经创建了一个工作站模板的本地VHD,我想上传它以便在我的Azure环境中使用.我在Azure Powershell工作.

我上传了我的.cer文件来创建管理证书.我已导入.publishsettings文件,我可以使用Set-AzureSubscription和Select-AzureSubscription,没有明显的问题:

Set-AzureSubscription -SubscriptionName "Windows Azure Enterprise" -CurrentStorageAccount ATOQA

Select-AzureSubscription -SubscriptionName "Windows Azure Enterprise"
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是当我尝试使用Add-AzureVHD时:

PS C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-10\bin> add-azurevhd -destination "https://ATOQA.blob.core.windows.net/vhds/ztemplate-W7.vhd" -localfilepath "C:\VM\W7_Template\ztemplate-w7.vhd"
add-azurevhd : "An exception occurred when calling the ServiceManagement API. HTTP Status Code: 404. Service Management Error Code: ResourceNotFound. Message: The requested storage account 
'atoqa' was not found.. Operation Tracking ID: df91c24901254047b39a7a7d5b037ea0."
At line:1 char:1
+ add-azurevhd -destination "https://ATOQA.blob.core.windows.net/vhds/ztemplate-W7 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Add-AzureVhd], ServiceManagementClientException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.StorageServices.AddAzureVhdCommand …
Run Code Online (Sandbox Code Playgroud)

powershell azure azure-storage

5
推荐指数
1
解决办法
9246
查看次数

dynamodb:如何归档所有没有特定属性的项目?

我有一个用户表,主用哈希键为userId.每个用户可能/可能没有称为"环境"的字符串属性.我想让所有拥有"environment"="xyz"或没有"environment"属性的用户.

以下代码将使用environment = xyz过滤这些用户,但如何过滤那些没有环境的项目?Dynamo API不允许过滤空字符串.

    AmazonDynamoDBClient client = DbClientManager.getDynamoDbClient();

    ArrayList<AttributeValue> avList = new ArrayList<AttributeValue>();
    avList.add(new AttributeValue().withS("xyz"));

    Condition scanFilterCondition = new Condition()
            .withComparisonOperator(ComparisonOperator.EQ.toString())
            .withAttributeValueList(avList);
    Map<String, Condition> conditions = new HashMap<>();
    conditions.put("environment", scanFilterCondition);

    ScanRequest scanRequest = new ScanRequest()
            .withTableName("users")
            .withAttributesToGet(
                    "userId", 
                    "environment");
            .withScanFilter(conditions);

    ScanResult result = client.scan(scanRequest);
Run Code Online (Sandbox Code Playgroud)

现在我刚刚删除了扫描过滤器,我在客户端进行过滤.有没有办法在服务器方面做到这一点?

谢谢,Aliza

java amazon-dynamodb

5
推荐指数
2
解决办法
1万
查看次数

无法从Azure AD获取承载令牌以与API App一起使用

我有一个MVC应用程序需要访问Azure中受Azure AD身份验证保护的私有API应用程序.因此,我需要获取Azure AD不记名令牌,将其转移到Zumo-Auth令牌中并使用它来访问API应用程序.

我正在阅读本教程,一切正常,直到我需要请求令牌authContext.这是代码的片段:

var authContext = new AuthenticationContext(
    "https://login.microsoftonline.com/MyADDomain.onmicrosoft.com");

ClientCredential credential = new ClientCredential(
    "04472E33-2638-FAKE-GUID-F826AF4928DB", 
    "OMYAPIKEY1x3BLAHEMMEHEHEHEHEeYSOMETHINGRc=");

// Get the AAD token.
var appIdUri = 
    "https://MyAppGateway-814485545465FAKE4d5a4532cd.azurewebsites.net/login/aad";

//var appIdUri = "https://MyADDomain.onmicrosoft.com/MyAppName";
//var appIdUri = "https://MyADDomain.onmicrosoft.com/";
//var appIdUri = "https://graph.windows.net";

AuthenticationResult result = 
    authContext.AcquireToken(appIdUri, credential); // <-- can't get the token from AD

// downhill from here
var aadToken = new JObject();
aadToken["access_token"] = result.AccessToken;
var appServiceClient = new AppServiceClient(
    "https://MyAppGateway-814485545465FAKE4d5a4532cd.azurewebsites.net/");

// Send the AAD token …
Run Code Online (Sandbox Code Playgroud)

c# azure azure-active-directory azure-api-apps azure-ad-graph-api

5
推荐指数
1
解决办法
8077
查看次数

以错误的请求返回Json

所以OK(value)返回带有application/json头的格式化的json.然而,BadRequest()没有.如果请求是一个应用程序/ json,即使这是一个错误的请求,也不应该像那样响应?

[HttpPost]
    public IActionResult Post([FromBody]Resolution value)
    {
        using (_ctx)
        {
            try
            {
                if (ValidateResolution(value.Size))
                {
                    _ctx.Resolution.Add(value);
                    _ctx.SaveChanges();
                    return Ok(value);
                }
                return BadRequest("{message:hello}");
            } catch (Exception) {
                return BadRequest();
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core asp.net-core-webapi

5
推荐指数
1
解决办法
9440
查看次数

Request.Content.IsMimeMultipartContent() 失败

我正在尝试使用 Html2 输入 type="file" 和 angular2 http.post 请求上传文件。当请求到达 web api 时,它失败了

Request.Content.IsMimeMultipartContent()
Run Code Online (Sandbox Code Playgroud)

使用Postman提交请求时不会失败(我不在标头中包含 Content-Type 时,因为邮递员会处理它)。

请参阅我的代码:Html:

 <input type="file" (change)="fileChange($event)" placeholder="Upload file" accept=".pdf,.doc,.docx,.dwg,.jpeg,.jpg">
Run Code Online (Sandbox Code Playgroud)

服务功能:

uploadFile(event) {
    let fileUploadUrl = this.webApiFileUploadURL;
    let fileList: FileList = event.target.files;
    if(fileList.length > 0) {
        let file: File = fileList[0];
        let formData:FormData = new FormData();
        formData.append('uploadFile', file, file.name);
        let headers = new Headers();
        headers.append('Content-Type', 'multipart/form-data');
        headers.append('Accept', 'application/json');
        let options = new RequestOptions({ headers: headers });
        this._http.post(`${this.webApiFileUploadURL}`, formData, options)
            .map(res => res.json())
            .catch(error => Observable.throw(error)) …
Run Code Online (Sandbox Code Playgroud)

c# http-post asp.net-web-api

5
推荐指数
2
解决办法
8838
查看次数

DateConverter 无法将 java.lang.String 转换为 java.util.Date。引起:org.modelmapper.MappingException:ModelMapper 映射错误:

我正在尝试使用 modelmapper 将我的类与传入的请求进行映射。

看起来 Date 无法在 modelmapper 中自动转换。

转换器 org.modelmapper.internal.converter.DateConverter@7595415b 未能将 java.lang.String 转换为 java.util.Date。引起:org.modelmapper.MappingException:ModelMapper 映射错误:

以上是get的异常。

那么如何单独跳过这个日期字段

目前我的代码看起来像,

ModelMapper mapper = new ModelMapper();
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
MyClass obj=mapper.map(anotherObject,MyClass.class);
Run Code Online (Sandbox Code Playgroud)

我的课

public class MyClass {

    int id;

    Date updated_at;

}
Run Code Online (Sandbox Code Playgroud)

另一个Object.toString

{id=6,updated_at=2018-02-23T03:01:12}
Run Code Online (Sandbox Code Playgroud)

更新 2

为这里的误导道歉。实际上,我的anotherObject不是类对象。我将在下面解释我的确切情况

我的 API 响应

{
    "rows": 1,
    "last": null,    
    "results": [
        {
            "id": "1",
            "updated_at;": "2018-01-22T13:00:00",
        },
        {
            "id": "2",
            "updated_at;": "2018-01-22T13:00:00",
        }

                ]
}
Run Code Online (Sandbox Code Playgroud)

我的超级班

public class MysuperClass {

    int rows;

    String last;

    List<Object> results;

}
Run Code Online (Sandbox Code Playgroud)

使用 …

java api spring modelmapper

5
推荐指数
1
解决办法
5195
查看次数

Logic Apps-Http + Swagger-基于令牌的身份验证的标头属性

我正在尝试将标题添加到Logic App中的Http + Swagger操作。

当添加一个简单的Http Action时,我可以清楚地看到设计器中的Headers。但是,通过Swagger + Http操作,它消失了。

我正在使用基于令牌的身份验证,并且需要将Header添加到此API调用中。因此,我修改了如下代码视图,但似乎无济于事!

在这方面找不到太多资源。任何帮助表示赞赏。

谢谢。

"Information_Process": {
                            "inputs": {
                                "body": {
                                    "fileId": "Test.json",
                                    "items": [
                                        {
                                            "item": {
                                                "prop1": "@items('For_each')?['Item']?['prop1']",
                                                "prop2": "@items('For_each')?['Item']?['prop2']",
                                                "prop3": "@items('For_each')?['Item']?['prop3']"                                               
                                            }
                                        }
                                    ]

                                },
                                "headers": {
                                    "Authorization": "@{concat('Bearer ',variables('BearerTokenValue'))}"
                                },
                                "method": "post",
                                "uri": "https://appone.azurewebsites.net/api/information/proccessing"
                            },
                            "metadata": {
                                "apiDefinitionUrl": "https://appone.azurewebsites.net//swagger/docs/v1",
                                "swaggerSource": "custom"
                            },                           
                            "type": "Http"
                        }
Run Code Online (Sandbox Code Playgroud)

json http azure swagger azure-logic-apps

5
推荐指数
1
解决办法
380
查看次数

无法在{path}中解析“ @ material-ui / lab / Slider”

我导入了Slider:

import Slider from '@material-ui/lab/Slider';
Run Code Online (Sandbox Code Playgroud)

并已在渲染中返回。

代码未编译,并引发错误:

找不到模块:错误:Can't resolve '@material-ui/lab/Slider' in {path}

有人可以帮我吗?谢谢。

reactjs material-ui lab

5
推荐指数
2
解决办法
2642
查看次数