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

AUTH password configuring #9

Closed ddydeveloper closed 6 years ago

ddydeveloper commented 6 years ago

Good morning! Could you specify is it possible to set up an AUTH passsword if you configure this option for the redis service.

I've tried to use ConfigurationOptions:

    .AddOperationalStore(opt =>
    {
        opt.RedisConnectionString = "localhost:6379";
        opt.ConfigurationOptions = new ConfigurationOptions {Password = "redispassword"};
    });

But anyway I got the following error:

It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. AuthenticationFailure on PING

It doesn't work in this way too:

    .AddOperationalStore(opt =>
    {
        opt.RedisConnectionString = "redispassword@localhost:6379";
    });

If I use the same password with redis-cli is it OK:

redis 127.0.0.1:6379> auth redispassword OK

AliBazzi commented 6 years ago

Hi @ddydeveloper According to the error, the component is not yet able to connect to the server, this is before even trying to authentication using the password, what I suggest is to try connect first to that Redis instance without configure the authentication on it, to pin point it's a connection issue.

Lastely, this IdentityServer.Contrib.RedisStore library proxies all these configuration to the excellent StackExchange.Redis library, I recommend you to read the documentation and raise any issue you are facing at the StackExchange.Redis repository.

ddydeveloper commented 6 years ago

@AliBazzi, good morning!

Thank you for suggestion. This problem appeared straight after configuring the password for redis service. If I disable AUTH it works as expected.

I use Redis as an operational storage for the IdentityServer and nowhere else, in this code only:

    .AddOperationalStore(opt =>
    {
        opt.RedisConnectionString = Configuration.GetConnectionString("Redis.Cache");
    });

So I suppose IdentityServer4.Contrib.RedisStore library should provide the way to connect to the redis service with password. I'll continue investigating but It would be great if you give an example how to provide the AUTH password in AddOperationalStore API.

ddydeveloper commented 6 years ago

@AliBazzi I've found the right way! You were right, it is not about the IdentityServer4.Contrib.RedisStore. All you need just set a password in connection string like this:

"localhost:6379,password=password"

The StackExchenge doc:

https://stackexchange.github.io/StackExchange.Redis/Configuration

AliBazzi commented 6 years ago

@ddydeveloper Great that your problem is solved !