diff --git a/src/main/java/io/github/javacoded78/jwthumble/storage/RedisTokenStorageImpl.java b/src/main/java/io/github/javacoded78/jwthumble/storage/RedisTokenStorageImpl.java index 0322bf6..3afbac1 100644 --- a/src/main/java/io/github/javacoded78/jwthumble/storage/RedisTokenStorageImpl.java +++ b/src/main/java/io/github/javacoded78/jwthumble/storage/RedisTokenStorageImpl.java @@ -5,6 +5,7 @@ import io.github.javacoded78.jwthumble.config.redis.RedisSchema; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; +import redis.clients.jedis.JedisPoolConfig; /** * Implementation of TokenStorage based on Redis. @@ -43,6 +44,48 @@ public RedisTokenStorageImpl(final JedisPool jedisPool, this.redisSchema = redisSchema; } + /** + * Creates an object. + * + * @param host Redis host + * @param port Redis port + */ + public RedisTokenStorageImpl(final String host, + final int port) { + JedisPoolConfig config = new JedisPoolConfig(); + config.setJmxEnabled(false); + this.jedisPool = new JedisPool( + config, + host, + port + ); + this.redisSchema = new DefaultRedisSchema(); + } + + /** + * Creates an object. + * + * @param host Redis host + * @param port Redis port + * @param user Redis username + * @param password Redis password + */ + public RedisTokenStorageImpl(final String host, + final int port, + final String user, + final String password) { + JedisPoolConfig config = new JedisPoolConfig(); + config.setJmxEnabled(false); + this.jedisPool = new JedisPool( + config, + host, + port, + user, + password + ); + this.redisSchema = new DefaultRedisSchema(); + } + @Override public void save(final String token, final TokenParameters params) {