Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token based authentication integration with core extension #4011

Merged
merged 24 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6689d65
tba draft
atakavci Nov 6, 2024
a18e632
- stop authxmanager on pool close
atakavci Nov 7, 2024
392b3b0
drop use of authxmanager and authenticatedconnection from core
atakavci Nov 12, 2024
f037440
-update submodule ref
atakavci Nov 17, 2024
eb63520
- remove submodule
atakavci Nov 18, 2024
cbb7781
Merge branch 'master' into ali/authx2
atakavci Nov 18, 2024
523fe42
back to current version
atakavci Nov 19, 2024
4e71535
- move autxhmanager creation to user space
atakavci Dec 5, 2024
08750e5
- prevent use of pubsub with TBA+RESP2 combination
atakavci Dec 5, 2024
b1ab1db
- support tba with clusters
atakavci Dec 6, 2024
1ec5239
- remove onerror from authxmanager
atakavci Dec 6, 2024
7d3a0ae
- fix flaky test
atakavci Dec 9, 2024
2176505
fix renewalDuringOperationsTest
atakavci Dec 9, 2024
9ea510d
-reviews from @sazzad16
atakavci Dec 10, 2024
e077031
Merge branch 'master' into ali/authx2
atakavci Dec 10, 2024
2175c15
- fix config for managedIdentity
atakavci Dec 11, 2024
86cf6f6
review from @ggivo
atakavci Dec 12, 2024
9717c9a
handle and propogate from unsuccessful AUTH response
atakavci Dec 12, 2024
9185f44
adding reauth support for both pubsub and shardedpubsub
atakavci Dec 14, 2024
5f8159d
fix ping issue with pubsub
atakavci Dec 15, 2024
9da80c4
Merge branch 'master' into ali/authx2
atakavci Dec 17, 2024
edf631a
- review from @sazzad16 : make JedisSafeAuthenticator protected
atakavci Dec 20, 2024
88a20c2
update authx version
atakavci Dec 20, 2024
93f53a2
- remove workaround for standalone endpoint
atakavci Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review from @ggivo
- use getuser instead oid from Token
  • Loading branch information
atakavci committed Dec 12, 2024
commit 86cf6f6655fcfd09f239be80505432c2c0def0d1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void start() {
try {
safeStarter.get();
} catch (InterruptedException | ExecutionException e) {
log.error("AuthXManager failed to start!", e);
throw new JedisAuthenticationException("AuthXManager failed to start!",
(e instanceof ExecutionException) ? e.getCause() : e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TokenCredentials implements RedisCredentials {
private final char[] password;

public TokenCredentials(Token token) {
user = token.tryGet("oid");
user = token.getUser();
password = token.getValue().toCharArray();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
Expand Down Expand Up @@ -96,8 +95,8 @@ public void testJedisConfig() {
assertNotNull(mock);
doAnswer(invocation -> {
counter.incrementAndGet();
return new SimpleToken("token1", System.currentTimeMillis() + 5 * 60 * 1000,
System.currentTimeMillis(), Collections.singletonMap("oid", "default"));
return new SimpleToken("default", "token1", System.currentTimeMillis() + 5 * 60 * 1000,
System.currentTimeMillis(), null);
}).when(mock).requestToken();
})) {

Expand Down Expand Up @@ -312,9 +311,8 @@ public void connectionAuthWithExpiredTokenTest() {
jedis.del(key);
}

token
.set(new SimpleToken("token1", System.currentTimeMillis() - 1, System.currentTimeMillis(),
Collections.singletonMap("oid", idp.requestToken().tryGet("oid"))));
token.set(new SimpleToken(idp.requestToken().getUser(), "token1",
System.currentTimeMillis() - 1, System.currentTimeMillis(), null));

JedisAccessControlException aclException = assertThrows(JedisAccessControlException.class,
() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public IdentityProvider getProvider() {
return new IdentityProvider() {
@Override
public Token requestToken() {
return new SimpleToken("cluster", System.currentTimeMillis() + 5 * 1000,
System.currentTimeMillis(),
Collections.singletonMap("oid", "default"));
return new SimpleToken("default", "cluster",
System.currentTimeMillis() + 5 * 1000, System.currentTimeMillis(),
null);
}
};
}
Expand Down Expand Up @@ -77,9 +77,9 @@ public IdentityProvider getProvider() {
return new IdentityProvider() {
@Override
public Token requestToken() {
return new SimpleToken("cluster", System.currentTimeMillis() + 5 * 1000,
System.currentTimeMillis(),
Collections.singletonMap("oid", "default"));
return new SimpleToken("default", "cluster",
System.currentTimeMillis() + 5 * 1000, System.currentTimeMillis(),
null);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import static org.hamcrest.Matchers.contains;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
Expand Down Expand Up @@ -64,8 +63,8 @@ public void testJedisPooledForInitialAuth() {

IdentityProvider idProvider = mock(IdentityProvider.class);
when(idProvider.requestToken())
.thenReturn(new SimpleToken(password, System.currentTimeMillis() + 100000,
System.currentTimeMillis(), Collections.singletonMap("oid", user)));
.thenReturn(new SimpleToken(user, password, System.currentTimeMillis() + 100000,
System.currentTimeMillis(), null));

IdentityProviderConfig idProviderConfig = mock(IdentityProviderConfig.class);
when(idProviderConfig.getProvider()).thenReturn(idProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void withExpirationRefreshRatio_testJedisAuthXManagerTriggersEvict() thro

IdentityProvider idProvider = mock(IdentityProvider.class);
when(idProvider.requestToken())
.thenReturn(new SimpleToken("password", System.currentTimeMillis() + 1000,
.thenReturn(new SimpleToken("default","password", System.currentTimeMillis() + 1000,
System.currentTimeMillis(), Collections.singletonMap("oid", "default")));

TokenManager tokenManager = new TokenManager(idProvider,
Expand All @@ -88,7 +88,7 @@ public void withLowerRefreshBounds_testJedisAuthXManagerTriggersEvict() throws E

IdentityProvider idProvider = mock(IdentityProvider.class);
when(idProvider.requestToken())
.thenReturn(new SimpleToken("password", System.currentTimeMillis() + 1000,
.thenReturn(new SimpleToken("default","password", System.currentTimeMillis() + 1000,
System.currentTimeMillis(), Collections.singletonMap("oid", "default")));

TokenManager tokenManager = new TokenManager(idProvider,
Expand Down Expand Up @@ -205,7 +205,7 @@ public void testCalculateRenewalDelay() {
public void testAuthXManagerReceivesNewToken()
throws InterruptedException, ExecutionException, TimeoutException {

IdentityProvider identityProvider = () -> new SimpleToken("tokenVal",
IdentityProvider identityProvider = () -> new SimpleToken("user1","tokenVal",
System.currentTimeMillis() + 5 * 1000, System.currentTimeMillis(),
Collections.singletonMap("oid", "user1"));

Expand Down Expand Up @@ -277,7 +277,7 @@ public void testTokenManagerWithFailingTokenRequest()
if (requesLatch.getCount() > 0) {
throw new RuntimeException("Test exception from identity provider!");
}
return new SimpleToken("tokenValX", System.currentTimeMillis() + 50 * 1000,
return new SimpleToken("user1","tokenValX", System.currentTimeMillis() + 50 * 1000,
System.currentTimeMillis(), Collections.singletonMap("oid", "user1"));
});

Expand Down Expand Up @@ -313,7 +313,7 @@ public void testTokenManagerWithHangingTokenRequest()
}
return null;
}
return new SimpleToken("tokenValX", System.currentTimeMillis() + tokenLifetime,
return new SimpleToken("user1","tokenValX", System.currentTimeMillis() + tokenLifetime,
System.currentTimeMillis(), Collections.singletonMap("oid", "user1"));
};

Expand Down
Loading