相关疑难解决方法(0)

Sustainsys Saml2 Handler AuthenticateAsync() 方法操作未实现

我正在尝试在 Saml2 的 Asp net Core 应用程序中进行一个简单的实现,以与 Ad FS 服务器集成。我不明白为什么我会收到这个错误。我从 gitHub 下载了示例并尝试在我的应用程序中调整它。

NotImplementedException: The method or operation is not implemented.
Sustainsys.Saml2.AspNetCore2.Saml2Handler.AuthenticateAsync()
Run Code Online (Sandbox Code Playgroud)

这是我的实现,我的应用程序在 Asp Net Core 上运行

启动时

                services
                    .AddAuthentication(sharedOptions =>
                    {
                        sharedOptions.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                        sharedOptions.DefaultChallengeScheme = Saml2Defaults.Scheme;
                    })
                    .AddSaml2(options =>
                    {
                        options.SPOptions.EntityId = new EntityId("http://myAdfsServer.myDomain.com/adfs/services/trust");
                        options.SPOptions.ReturnUrl = new Uri("https://localhost:5000");
                        options.IdentityProviders.Add(
                            new IdentityProvider(new EntityId("http://myAdfsServer.myDomain.com/adfs/services/trust"), options.SPOptions)
                            {
                               LoadMetadata = true,
                               MetadataLocation = "https://myAdfsServer.myDomain.com/FederationMetadata/2007-06/FederationMetadata.xml"
                                //MetadataLocation = "FederationMetadata.xml"
                            });

                        //options.SPOptions.ServiceCertificates.Add(new X509Certificate2(certificate.ToString()));
                    })
                    .AddCookie();

Run Code Online (Sandbox Code Playgroud)

在我的控制器上 尝试类似于Sustainsys SAML2 Sample for ASP.NET Core WebAPI without Identity …

adfs saml-2.0 asp.net-core sustainsys-saml2

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

如何在没有entityframework提供程序的情况下在.net核心中实现谷歌登录

我正在为我的.net核心网站实施Google登录.

在这段代码中

var properties = signInManager.ConfigureExternalAuthenticationProperties("Google", redirectUrl);      
return new ChallengeResult("Google", properties); 
Run Code Online (Sandbox Code Playgroud)

我需要一个signInManager(通过代码示例)这个:

private SignInManager<AppUser> signInManager;
Run Code Online (Sandbox Code Playgroud)

我通过构造函数注入它,然后我收到此错误:

尝试激活"AccountController"时,无法解析类型"Microsoft.AspNetCore.Identity.SignInManager1 [AppUser]"的服务.

谷歌搜索了我应该包括这个

services.AddIdentity<AppUser, IdentityRole>()
    .AddDefaultTokenProviders();`
Run Code Online (Sandbox Code Playgroud)

但这给了我这个错误:

尝试激活"Microsoft.AspNetCore.Identity.AspNetUserManager1 [AppUser]"时,无法解析类型"Microsoft.AspNetCore.Identity.IUserStore1 [AppUser]"的服务.

在那一刻,我得到了建议:

.AddEntityFrameworkStores<ApplicationDbContext>()
Run Code Online (Sandbox Code Playgroud)

但后来我迷路了,因为为什么SignInManager需要a IUserStore,我应该添加一个 UserStore和一个DBContext和一个EntityFramework商店,当我不会使用它(我的谷歌登录)?

所以问题是:我可以在没有Entityframework商店的情况下进行Google登录吗?

c# authentication asp.net-core-mvc .net-core asp.net-core

4
推荐指数
1
解决办法
2264
查看次数