我一直在使用从示例创建的库,该库允许我使用Azure Active Directory验证.NET核心Web应用并利用各种OpenIdConnectOptions事件(例如OnTokenValidated)向主体添加某些声明,并将该数据添加到类似于身份的数据库,因此API可以基于调用者的令牌对调用者进行基于策略的确定。
但是我宁愿使用Microsoft.AspNetCore.Authentication.AzureAD.UINuGet软件包,也不愿使用我的自定义版本,我只是不确定如何访问和访问事件OpenIdConnectOptions。
我不知道这不是可以完成的事情,还是我对依赖注入没有足够的了解以了解如何做到这一点。
还是我应该考虑在流程的其他部分添加索赔等?
public static AuthenticationBuilder AddAzureAD(
this AuthenticationBuilder builder,
string scheme,
string openIdConnectScheme,
string cookieScheme,
string displayName,
Action<AzureADOptions> configureOptions) {
AddAdditionalMvcApplicationParts(builder.Services);
builder.AddPolicyScheme(scheme, displayName, o => {
o.ForwardDefault = cookieScheme;
o.ForwardChallenge = openIdConnectScheme;
});
builder.Services.Configure(
TryAddOpenIDCookieSchemeMappings(scheme, openIdConnectScheme, cookieScheme));
builder.Services.TryAddSingleton<IConfigureOptions<AzureADOptions>, AzureADOptionsConfiguration>();
// They put in their custom OpenIdConnect configuration, but I can't see how to get at the events.
builder.Services.TryAddSingleton<IConfigureOptions<OpenIdConnectOptions>, OpenIdConnectOptionsConfiguration>();
builder.Services.TryAddSingleton<IConfigureOptions<CookieAuthenticationOptions>, CookieOptionsConfiguration>();
builder.Services.Configure(scheme, configureOptions);
builder.AddOpenIdConnect(openIdConnectScheme, null, o => { …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用DocuSign SOAP API,并且正在使用其开发人员站点和GitHub站点中的示例。虽然这两位代码并不完全匹配,但似乎都不起作用。我不断收到消息System.ServiceModel.FaultException,“由于传入消息中不存在安全头,因此不满足安全要求。”
我正在使用带有VS2012的服务参考来代理服务https://demo.docusign.net/api/3.0/dsapi.asmx,并且已经通过使用在线REST API资源管理器来获取登录信息来验证我的帐户可以正常工作为我的模拟帐户。
有人遇到这个问题或有什么建议吗?
我正在尝试在 .NET 6 中创建一个标准 WebAPI 项目。我注意到标准 ApiController 路由没有我喜欢的主要 api 路由。当我添加它时,控制器崩溃了。它不会给我一个 404(未找到),它只是给我一个索引页,上面写着我必须启用 JavaScript。我真的不知道该怎么做才能使我的应用程序正常工作,我可以将其放在api路线的开头:
[Route("api/[controller]")]
我尝试以不同的组合将其添加到默认控制器路由映射中。我尝试UseEndpoints在 Program 类中添加该方法。我只是不确定 6 有什么不同。
对于那些想要“查看我的代码”的人,我只是使用带有 React 的标准 WebAPI 项目(没有 Redux!)。