-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TBA auth support for cluster connections
- Loading branch information
Showing
7 changed files
with
109 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
src/main/java/io/lettuce/core/RenewableRedisCredentialsProvider.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
src/main/java/io/lettuce/core/StreamingCredentialsProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.lettuce.core; | ||
|
||
import reactor.core.publisher.Flux; | ||
|
||
public interface StreamingCredentialsProvider extends RedisCredentialsProvider { | ||
|
||
/** | ||
* Returns a {@link Flux} emitting {@link RedisCredentials} that can be used to authorize a Redis connection. This | ||
* credential provider supports streaming credentials, meaning that it can emit multiple credentials over time. | ||
* | ||
* @return | ||
*/ | ||
Flux<RedisCredentials> credentials(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/io/lettuce/core/cluster/RedisClusterAuthenticationHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2019-Present, Redis Ltd. and Contributors | ||
* All rights reserved. | ||
* | ||
* Licensed under the MIT License. | ||
* | ||
* This file contains contributions from third-party contributors | ||
* licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.lettuce.core.cluster; | ||
|
||
import io.lettuce.core.*; | ||
import io.lettuce.core.cluster.pubsub.StatefulRedisClusterPubSubConnection; | ||
|
||
import io.lettuce.core.protocol.*; | ||
import io.netty.util.internal.logging.InternalLogger; | ||
import io.netty.util.internal.logging.InternalLoggerFactory; | ||
|
||
class RedisClusterAuthenticationHandler extends BaseRedisAuthenticationHandler<StatefulRedisClusterConnectionImpl<?, ?>> { | ||
|
||
private static final InternalLogger logger = InternalLoggerFactory.getInstance(RedisChannelHandler.class); | ||
|
||
public RedisClusterAuthenticationHandler(StatefulRedisClusterConnectionImpl<?, ?> connection) { | ||
super(connection); | ||
} | ||
|
||
protected boolean isSupportedConnection() { | ||
if (connection instanceof StatefulRedisClusterPubSubConnection | ||
&& ProtocolVersion.RESP2 == connection.getConnectionState().getNegotiatedProtocolVersion()) { | ||
logger.warn("Renewable credentials are not supported with RESP2 protocol on a pub/sub connection."); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters