2014-05-21 2 views
3

누구든지 Owin Asp.Net ID 쿠키 인증 (로컬 db)과 Owin OpenId 인증 (클라우드)을 혼합하는 좋은 예를 알고 있습니까? 그런 다음 사용자는 새로운 사용자 & 패스 (로컬 데이터베이스에 저장 됨)를 생성하거나 예를 들어를 통해 로그인하거나 등록하도록 선택할 수 있습니다. Office 365 계정. 그러나 모든 사용자는 asp.net ID (로컬 데이터베이스)에서 클레임 및 역할을 사용합니다.Owin OpenId 인증을 사용한 Owin Asp.Net 인증 쿠키 인증

답변

0

나는 이렇게했는데, 이상한 문제가있다. 여기에 여기에

public ActionResult LogOff() 
    { 
     //AuthenticationManager.SignOut(); 
     AuthenticationManager.SignOut( 
      DefaultAuthenticationTypes.ExternalCookie, 
      DefaultAuthenticationTypes.ApplicationCookie, 
      OpenIdConnectAuthenticationDefaults.AuthenticationType, 
      CookieAuthenticationDefaults.AuthenticationType 
     ); 
     return RedirectToAction("Login", "Account"); 
    } 

AccountController

에서 Startup.Auth.cs

public void ConfigureAuth(IAppBuilder app) 
    { 
     // Configure the db context and user manager to use a single instance per request 
     app.CreatePerOwinContext(ApplicationDbContext.Create); 
     app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create); 

     app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); 
     //app.Properties["Microsoft.Owin.Security.Constants.DefaultSignInAsAuthenticationType"] = "ExternalCookie"; 

      // Enable the application to use a cookie to store information for the signed in user 
     // and to use a cookie to temporarily store information about a user logging in with a third party login provider 
     // Configure the sign in cookie 
     app.UseCookieAuthentication(new CookieAuthenticationOptions 
     { 
      AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, 
      // LoginPath = new PathString("/Account/Login"), 
      Provider = new CookieAuthenticationProvider 
      { 
       OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
        validateInterval: TimeSpan.FromMinutes(30), 
        regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) 
      } 
     }); 

     app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); 

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

로그 오프 방법 내 ConfigureAuth의 방법으로 문제가되고, 난 아직 응답이 없어 다른 스레드에서 설명하려고 노력했다.

Link for the question

관련 문제