0
通過IdentityServer3 MVC教程here的工作,我有一個工作示例應用程序,我可以登錄爲'bob',或者我可以使用任何Google帳戶登錄。如何使用IdentityServer3外部驗證登錄本地用戶?
什麼我想出來是工作,說Bob有一個附加字段「GoogleId」:
public static class Users
{
public static List<InMemoryUser> Get()
{
new InMemoryUser
{
Username = "bob",
Password = "secret",
Subject = "1",
GoogleId = "60a71ff098f6509cbd4fbda2f495eacb",
Claims = new[]
{
new Claim(Constants.ClaimTypes.GivenName, "Bob"),
new Claim(Constants.ClaimTypes.FamilyName, "Smith"),
new Claim(Constants.ClaimTypes.Role, "Geek"),
new Claim(Constants.ClaimTypes.Role, "Foo")
}
}
}
}
當我登錄在與谷歌,如果傳入的主題要求相匹配的用戶GoogleId,與登錄本地用戶帳戶。
IdentityServer3.AspNetIdentity project必須這樣做,因爲Asp.Net標識具有外部登錄來關閉本地用戶帳戶。但是我不能使用Asp.Net Identity用戶模型,因爲我在遺留應用程序中工作。我無法很好地理解代碼,以便將其應用於我的情況。
是否有演示此場景的示例或教程?