2014-08-30 5 views
1

membershipreboot.owin을 사용하는 사용자 정의 사용자 계정으로 다중 소유자 예제를 만들었습니까?MembershipReboot.Owin에 사용자 지정 UserAccount를 등록하는 방법은 무엇입니까?

맞춤 계정을 사용할 때 멤버십 미들웨어를 구성하는 방법을 파악하는 데 어려움이 있습니다. 기본 예제가 적용되지 않습니다. 그리고 나는 충분히 펑키 한 Funcs로 경험하지 못했을 것 같습니다. 어떤 도움을 주시면 감사하겠습니다.

Thx.

 public static class MembershipRebootOwinExtensions 
    { 
     public static void UseMembershipReboot<TAccount>(
     this IAppBuilder app, 
     Func<IDictionary<string, object>, UserAccountService<TAccount>>   userAccountServiceFactory, 
     Func<IDictionary<string, object>, AuthenticationService<TAccount>> authenticationServiceFactory = null 
     ) 
     where TAccount : UserAccount 
     { 
      app.Use<MembershipRebootMiddleware<TAccount>>(userAccountServiceFactory, authenticationServiceFactory); 
      app.UseMembershipReboot(); 
     } 

    public static void UseMembershipReboot<TAccount>(
     this IAppBuilder app, 
     CookieAuthenticationOptions cookieOptions, 
     Func<IDictionary<string, object>, UserAccountService<TAccount>> userAccountServiceFactory, 
     Func<IDictionary<string, object>, AuthenticationService<TAccount>> authenticationServiceFactory = null 
     ) 
     where TAccount : UserAccount 
     { 
      app.Use<MembershipRebootMiddleware<TAccount>>(userAccountServiceFactory, authenticationServiceFactory); 
      app.UseMembershipReboot(cookieOptions); 
     } 

가 어떻게 두 FUNC 년대에 채울 것 : 같은

OwinExtentionMethods

보인다?

Func<IDictionary<string, object>, UserAccountService<TAccount>> 

Func<IDictionary<string, object>, AuthenticationService<TAccount>> 

답변

0

맞춤 사용자 계정 샘플 제네릭을 사용하는 예를 가지고

https://github.com/brockallen/BrockAllen.MembershipReboot/tree/master/samples/CustomUserAccount

+0

그 샘플은 Owin을 사용하지 않습니다! 권리? –

+0

아니요. 그러나 모든 제네릭과 함께 사용자 지정 사용자 계정을 사용하는 방법을 보여줍니다. –

+0

어쩌면 그 Func의 내 부족한 이해하지만 예제가 도움이되지 않습니다. Generic DataSource 클래스, generic 저장소 클래스를 인스턴스화하는 방법 만 보여줍니다. 내 문제는 제네릭 매개 변수로 funcs를 제공하는 방법을 이해하는 데 어려움이 있습니다. –

0

단순히 현재의 콘텍스트를 획득을 owin

var owin = ctx.Resolve<IOwinContext>(); 

로서

다음 사용자 지정 사용자 계정을

var owinAuth = new OwinAuthenticationService<CustomUserAccount>(AuthenticationTypes.Negotiate, ctx.Resolve<UserAccountService<CustomUserAccount>>(), owin.Environment); 

으로 등록하십시오. 너무 늦지 않기 바랍니다.

+0

댓글을 달려면 Thx에 대해 살펴 보겠습니다. 보이는 유망한 .. –

관련 문제