Hello there,
I am developing a web service application with .NET Framework 4.5 / Web API 2 and I am using OWIN for authentication and authorization.
So, for this application we need a load balancer solution then we set up that as you know after that users' tokens are not working properly. Because if a user take token from server A then can't use it on server B.
Because of it, I need use Redis with Redis every application's OWIN will save authentication to redis
Thank you.
What I have tried:
I used https://github.com/ziyasal/Owin.Security.RedisTokenProviders this package, but it does not help. I guess I am missing a point.
Here is the my Configuration Method on Startup.cs
public void Configuration(IAppBuilder appBuilder)
{
HttpConfiguration httpConfiguration = new HttpConfiguration();
httpConfiguration.DependencyResolver = new NinjectResolver(NinjectWebCommon.CreateKernel());
ConfigureOAuth(appBuilder);
WebApiConfig.Register(httpConfiguration);
appBuilder.UseWebApi(httpConfiguration);
}
and my Server Option in same class
OAuthAuthorizationServerOptions oAuthAuthorizationServerOptions = new OAuthAuthorizationServerOptions()
{
TokenEndpointPath = new Microsoft.Owin.PathString("/signin"),
AccessTokenExpireTimeSpan = TimeSpan.FromHours(1),
AllowInsecureHttp = true,
Provider = new SimpleAuthorizationServerProvider(),
RefreshTokenProvider = new RedisRefreshTokenProvider(new ProviderConfiguration
{
ConnectionString = "12.0.0.145:6379",
Db = 0,
ExpiresUtc = DateTime.UtcNow.AddMinutes(5),
AbortOnConnectFail = true
})
};