Tag: openiddict

在OpenIddict中处理请求时发生未处理的exception

所以,我正在尝试使用.net核心1.1实现OpenIddict版本1.0.0-beta2-0580,我收到以下错误: 处理请求时发生未处理的exception 这是基于此: https : //github.com/openiddict/openiddict-core/tree/dev/samples db正确注册数据库,加载设置,一切都在这里工作。 数据库中的表格: __efmigrationshistory , aspnetroleclaims , aspnetroles , aspnetuserclaims , aspnetuserlogins , aspnetuserroles , aspnetusers , aspnetusertokens , basetransaction , openiddictapplications , openiddictauthorizations , openiddictscopes , openiddicttokens 然后我有 堆栈跟踪: InvalidOperationException: The authentication ticket was rejected because the mandatory subject claim was missing. AspNet.Security.OpenIdConnect.Server.OpenIdConnectServerHandler+d__5.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Microsoft.AspNetCore.Authentication.AuthenticationHandler+d__66.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task […]

OpenIddict – 如何获取用户的访问令牌?

我正在使用AngularJs为OpenIddict开发示例应用程序。 我被告知你不应该使用像Satellizer这样的客户端框架,因为这不是建议的,而是允许服务器处理服务器端的登录(本地和使用外部登录提供程序),并返回访问令牌。 我有一个演示angularJs应用程序并使用服务器端登录逻辑并回调角度应用程序,但我的问题是,我如何获得当前用户的访问令牌? 这是我的startup.cs文件,所以到目前为止你可以看到我的配置 public void ConfigureServices(IServiceCollection services) { var configuration = new ConfigurationBuilder() .AddJsonFile(“config.json”) .AddEnvironmentVariables() .Build(); services.AddMvc(); services.AddEntityFramework() .AddSqlServer() .AddDbContext(options => options.UseSqlServer(configuration[“Data:DefaultConnection:ConnectionString”])); services.AddIdentity() .AddEntityFrameworkStores() .AddDefaultTokenProviders() .AddOpenIddict(); services.AddTransient(); services.AddTransient(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) { env.EnvironmentName = “Development”; var factory = app.ApplicationServices.GetRequiredService(); factory.AddConsole(); factory.AddDebug(); app.UseDeveloperExceptionPage(); app.UseIISPlatformHandler(options => { options.FlowWindowsAuthentication = false; }); app.UseOverrideHeaders(options […]

找不到类型或命名空间名称“OpenIddictDbContext ”

我有个问题。 我今天早上打开了我的项目并得到了错误: 找不到类型或命名空间名称’OpenIddictDbContext ‘(您是否缺少using指令或程序集引用?)[netcoreapp1.1] 我恢复并构建项目时发生此错误。 这很奇怪,因为我在我的project.json文件中有“OpenIddict”:“1.0.0- *” ,我正在使用引用: using OpenIddict ; 这个问题在我的项目中无处不在,因为他似乎没有认识到“使用OpenIddict” 如果它有帮助,这是我得到错误的例子(ApplicationDbContext.cs) namespace Overnight.Db { //the error: The type or namespace name ‘OpenIddictDbContext’ could not be found (are you missing a using directive or an assembly reference?) public class ApplicationDbContext : OpenIddictDbContext { 要么 //the error: ‘OpenIddictDbContext’ does not contain a constructor that takes […]

将google idToken替换为本地openId令牌c#

我正在使用这个github项目https://github.com/openiddict/openiddict-core这很棒。 但是,当用户使用外部身份提供商时,我会被困在程序应该是什么,或者如何实现它们,对于这个例子,我将使用谷歌。 我有一个angular2 app运行,带有aspnet核心webAPI。 我的所有本地登录工作都很完美,我使用用户名和密码调用connect/token ,并返回accessToken。 现在我需要将谷歌作为外部身份提供商实施。 我已按照此处的所有步骤实施Google登录按钮。 这会在用户登录时打开一个弹出窗口。这是我为google按钮创建的代码。 // Angular hook that allows for interaction with elements inserted by the // rendering of a view. ngAfterViewInit() { // check if the google client id is in the pages meta tags if (document.querySelector(“meta[name=’google-signin-client_id’]”)) { // Converts the Google login button stub to an actual button. […]

丰富的Twitter数字/谷歌Auth与OpenIdDictServer

我们的应用需要通过手机号码或Google登录。 我们计划通过Twitter数字进行手机号码validation。 我理解的注册和认证流程如下: 移动应用程序使用Twitter数字或Google登录进行丰富的身份validation(用户可以使用丰富的身份validation而不是打开网络浏览器选项卡获得更好的用户体验)。 Twitter Digits / Google Sign In返回身份令牌。 移动应用程序将AuthServer调用到SignIn并显示身份令牌。 身份服务器使用Digits服务或Google Auth服务validation所呈现的身份令牌。 一旦validation,AuthServer将尝试找到用户,如果不存在,它将创建一个。 AuthServer将Access Token返回给移动应用程序。 现在,我正在寻找实施步骤#3-4的选项。 目前,我所做的是修改令牌端点代码,该代码将用户名作为电话号码或电子邮件地址和密码作为Google / Twitter数字ID令牌发送。 现在,由于auth服务器需要知道发送的密码实际上是需要通过第三方服务validation的令牌,我通过在TokenHint中发送服务名称“Digits”或“Google”来解决它。 这非常有效,但我想知道什么是最干净的方式来支持我想要实现的目标。