AliBazzi / IdentityServer4.Contrib.RedisStore

A persistence layer using Redis DB for operational data and for caching capability for Identity Server 4
https://www.nuget.org/packages/IdentityServer4.Contrib.RedisStore
MIT License
137 stars 48 forks source link

StackExchange.Redis.ConfigurationOptions exists in 2 libraries #1

Closed gilm0079 closed 6 years ago

gilm0079 commented 6 years ago

Not sure if I'm just setting this up incorrectly, but I used nuget to install the IdentityServer4.Contrib.RedisStore (v1.0.0). It looks like it has dependencies on StackExchange.Redis (1.2.6) and StackExchange.Redis.StrongName (1.2.4). I tried to new up a ConfigurationOptions object in the Startup.cs and I get an error that ConfigurationOptions exists in both of the StackExchange libraries. I even pulled down the StackExchange.Redis (1.26) and updated StackExchange.Redis.StrongName to 1.26 via nuget and still get the same error.

From what I remember the IdentityServer3 contrib library didn't have a dependency on the StrongName library. If I then try to remove the StrongName nuget package it just reverts to the Contrib dependency of 1.2.4.

I'm not sure what version of IdentityServer4 this project was compiled for. I'm running near latest (2.0.5) which uses Asp.Net Core 2.

AliBazzi commented 6 years ago

Hi,

I tried to replicate the issue and I was able to see the same error message.

This library was created while Identity server was supporting .Net core 1.1 only, with that, it relies on StackExchange.Redis library(v 1.2.6). While Microsoft.AspNetCore.All package includes Microsoft.Extensions.Caching.Redis, which in turns relies on StackExchange.Redis.StrongName (v1.2.4) So from here, the conflict is happening, I will update the library to rely on StackExchange.Redis.StrongName (v1.2.4), which is still compatible with .Net core 1.1, and Identity Server 4 (v 1.0). With that I think you will be able to use this library in Asp.Net core 2 and Latest Identity Server version.

AliBazzi commented 6 years ago

@gilm0079 a release is deployed to fix your issue, please let me know if it not fix your problem.

gilm0079 commented 6 years ago

@AliBazzi your update fixed the build error for me. Thanks.

Would you be able to increment up the assembly version and publish a new version to nuget? Right now I just have your project from here added to my solution.

Not related to this problem. I was going to setup the StackExchange.Redis.ConfigurationOptions object to be used in the startup.cs. Do you know what properties are important to get the connection setup? The structure is a little different than how it worked in IdentityServer3 with the ConnectionMultiplexer. I'm assuming at a minimum I need to put a host name, port, and prefix for the redis keys in the ConfigurationObject?

AliBazzi commented 6 years ago

Sorry @gilm0079 my mistake, maybe I didn't clarify enough what I meant by release deployed; the Nuget Package is update to 1.0.1 since yesterday, no need to add the project as reference. for the other question, you still have an overload that allows you to use connection string style initialization, you can use that, for what to use while you initializing ConfigurationOptions object, you can refer to StackExchange.Redis docs.

Please let me know if I can close the issue now, thanks.

gilm0079 commented 6 years ago

Thanks. My VS2017 must have just been not syncing with nuget. I wasn't finding 1.0.1 yesterday now it finds it today.

Just for notes for others. It looks like if you want to use the ConfigurationOptions class to setup the operational store the syntax is: StackExchange.Redis.ConfigurationOptions redisOptions = StackExchange.Redis.ConfigurationOptions.Parse("<redisServerIp>:<port>"); it can then be used on the IIdentityServerBuilder object as .AddOperationalStore(redisOptions) Additional properties on the redisOptions object can be appended before this step.