ServiceStack の SocialBootstrapAPI のサンプルをたどりましたが、リダイレクトがどのように接続されているかわかりません。認証されていない Secured コントローラーに移動すると、インデックス ページにリダイレクトされます。自分のアプリケーションで動作を再現できませんでした。この配線が行われている場所が見つかりませんでした - SocialBootstrapApi の web.config でそれらを見つけることができませんか?
から継承し、ベース コントローラーServiceStackController<AuthUserSession>
を装着しました。[Authenticate]
これは私が得るエラーです:
[NullReferenceException: Object reference not set to an instance of an object.]
ServiceStack.ServiceInterface.SessionExtensions.SessionAs(ICacheClient cache, IHttpRequest httpReq, IHttpResponse httpRes) +90
ServiceStack.Mvc.ServiceStackController.SessionAs() +64
ServiceStack.Mvc.ServiceStackController`1.get_UserSession() +36
ServiceStack.Mvc.ServiceStackController`1.get_AuthSession() +5
ServiceStack.Mvc.ExecuteServiceStackFiltersAttribute.OnActionExecuting(ActionExecutingContext filterContext) +97
これは、AppHost.cs ファイルにあるものです。
//Enable Authentication
ConfigureAuth(container);
//Register In-Memory Cache provider.
//For Distributed Cache Providers Use: PooledRedisClientManager, BasicRedisClientManager or see: https://github.com/ServiceStack/ServiceStack/wiki/Caching
container.Register<ICacheClient>(new MemoryCacheClient());
container.Register<ISessionFactory>(c =>
new SessionFactory(c.Resolve<ICacheClient>()));
ConfigureAuth() は SocialBootstrapApi サンプルに似ています (まったく同じではありませんが、近いものです)。ここに何かが欠けているとは思いません。
では、これはどのように機能するのでしょうか。