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

feat(jans-auth-server): Token Status List support #8620

Merged
merged 67 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
9c1b30a
chore(jans-auth-server): renamed OXAUTH_UMA_TICKET -> UMA_TICKET
yuriyz May 31, 2024
eb1340f
feat(jans-auth-server): Token Status List support
yuriyz May 31, 2024
d32bca8
fix(jans-auth-server): corrected requestContext and azd decoding
yuriyz May 31, 2024
d5b3ba9
feat(jans-auth-server): added token status list endpoint and status c…
yuriyz Jun 5, 2024
3987f87
feat(jans-auth): new cluster beans and services
yurem Jun 6, 2024
b9c5f3d
feat(jans-auth-server): added head index to list
yuriyz Jun 6, 2024
e79d463
Merge remote-tracking branch 'remotes/origin/token_list_changes' into…
yuriyz Jun 7, 2024
a1acf85
feat(jans-auth): move beans to core model
yurem Jun 7, 2024
ff7a3f9
feat(jans-auth): add index range to TokenPool
yurem Jun 7, 2024
f66c254
Merge branch 'main' into jans-auth-server-8562
yuriyz Jun 7, 2024
e8c6962
feat(jans-auth-server): added application/statuslist+json support
yuriyz Jun 7, 2024
9fc9e89
feat(jans-auth): add methods to allocate/release TokenPool
yurem Jun 7, 2024
2bb825c
feat(jans-auth): add methods to allocate/release TokenPool
yurem Jun 7, 2024
83f36ce
feat(jans-auth): fix TokenPool sort
yurem Jun 7, 2024
723ce03
feat(jans-auth): implement method to get nextIndex for token
yurem Jun 7, 2024
607cb03
feat(jans-auth): implement method to get nextIndex for token
yurem Jun 7, 2024
78bcd84
feat(jans-auth): instead of using token list status use expiration date
yurem Jun 7, 2024
63ab6b6
fix(jans-auth-server): fixed index during list joins and npe on nextI…
yuriyz Jun 7, 2024
80d0efd
Merge remote-tracking branch 'origin/jans-auth-server-8562' into jans…
yuriyz Jun 7, 2024
47b5f9b
feat(jans-auth-server): populate statusListIndex in access and id tokens
yuriyz Jun 7, 2024
5a48866
feat(jans-auth): add ClusterNode services
yurem Jun 10, 2024
4a573da
feat(jans-auth): add node base dn
yurem Jun 10, 2024
3501d12
feat(jans-auth-server): added status list update on revoke
yuriyz Jun 10, 2024
e54e82d
Merge remote-tracking branch 'origin/jans-auth-server-8562' into jans…
yuriyz Jun 10, 2024
192c3fc
fix after merge
yuriyz Jun 10, 2024
fce9bb4
feat(jans-auth): add schema for new entries
yurem Jun 11, 2024
408b7e4
feat(jans-auth): fix allocate
yurem Jun 11, 2024
8ffef42
feat(jans-auth): fix cluster nodes expiration
yurem Jun 11, 2024
2c48d79
merged main
yuriyz Jun 12, 2024
8be4f18
feat(jans-auth-server): added status list as jwt support
yuriyz Jun 12, 2024
f324c8d
feat(jans-auth): Deprecate TokenPoolStatus
yurem Jun 13, 2024
c86dd7e
feat(jans-auth): implement updateWithLock for concurent lock on revoke
yurem Jun 13, 2024
53e5c3a
feat(jans-auth-server): use updateWithLock during status update index
yuriyz Jun 13, 2024
e3cf9d9
feat(jans-auth-server): update status list on token revoke in separat…
yuriyz Jun 13, 2024
84e6d79
feat(jans-auth-server): renamed TokenPool -> StatusTokenPool, TokenPo…
yuriyz Jun 14, 2024
c066c3b
feat(jans-auth-server): removed token head index (we are using status…
yuriyz Jun 18, 2024
39c16ff
feat(jans-auth-server): added status list to swagger
yuriyz Jun 18, 2024
3a36b83
feat(jans-auth-server): added ou=node,o=jans to config
yuriyz Jun 18, 2024
46d9abc
feat(jans-auth-server): throw configuration exception if node baseDn …
yuriyz Jun 18, 2024
f1d4caf
feat(jans-auth-server): set status_list feature flag enabled by default
yuriyz Jun 19, 2024
bd4018c
fix(jans-auth-server): fixed node allocation
yuriyz Jun 19, 2024
214a489
fix(jans-auth-server): corrected bug in getClusterNodeLast
yuriyz Jun 19, 2024
3e7e322
feat(jans-auth-server): keep lockKey static and save in jansNode afte…
yuriyz Jun 19, 2024
c763ed9
fix(jans-auth-server): different fixes for cluster node management
yuriyz Jun 20, 2024
a58599e
fix(jans-auth-server): fixed allocation of status index pools
yuriyz Jun 20, 2024
44fb548
chore(jans-auth-server): added more logs for status index pool alloca…
yuriyz Jun 21, 2024
1f35103
feat(jans-auth): igore timezone when DB is PostgresSQL
yurem Jun 21, 2024
7a18504
feat(jans-auth): fetch all node entries if DB is LDAP
yurem Jun 24, 2024
1719b72
feat(jans-auth-server): added status list client
yuriyz Jun 24, 2024
11b0fbe
fix(jans-auth-server): fixed pool allocation
yuriyz Jun 24, 2024
3445a31
chore(jans-auth-server): renamed endpoint /token_status_list -> /stat…
yuriyz Jun 24, 2024
7180494
feat(jans-orm): resovle bean property name with AttributeName #8773
yurem Jun 24, 2024
36a453e
chore(jans-auth-server): renamed token_status_list -> status_list
yuriyz Jun 25, 2024
17b1431
chore(jans-auth-server): token statuses VALID - 0, INVALID - 1
yuriyz Jun 25, 2024
d5b2e82
chore(jans-auth-server): moved status list to model for re-using
yuriyz Jun 25, 2024
0a1842c
feat(jans-auth-server): added batch index update and fixed concurrent…
yuriyz Jun 26, 2024
ccf2306
feat(jans-auth-server): use new index update method in existing revok…
yuriyz Jun 26, 2024
a143dd0
fix(jans-auth-server): fixed status pool index joining
yuriyz Jun 27, 2024
6ca1e80
chore(jans-auth-server): code improvements
yuriyz Jun 27, 2024
da5f7bb
test(jans-auth-server): added full integration test for status list
yuriyz Jun 28, 2024
2148d90
test(jans-auth-server): added test for CN case
yuriyz Jun 28, 2024
c173c8d
feat(jans-auth-server): mark indexes which we are about to re-use as …
yuriyz Jun 28, 2024
f66b3a7
merged main
yuriyz Jun 28, 2024
e2d73a8
code re-format
yuriyz Jun 28, 2024
14d5dec
docs(config-api): regenerating config swagger api
pujavs Jun 28, 2024
adc3c4a
Merge branch 'main' into jans-auth-server-8562
yuriyz Jun 28, 2024
799831e
Merge branch 'main' into jans-auth-server-8562
moabu Jun 28, 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
feat(jans-auth-server): use new index update method in existing revok…
…e code

#8562
Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
  • Loading branch information
yuriyz committed Jun 26, 2024
commit ccf2306228d9ab796499fa7cfbb1f7d06ec0b451
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

Expand Down Expand Up @@ -190,15 +191,21 @@ public void validateSameClient(AuthorizationGrant grant, Client client) {
}

private void removeAllTokens(TokenTypeHint tth, ExecutionContext executionContext) {
final List<TokenEntity> tokens = grantService.getGrantsOfClient(executionContext.getClient().getClientId());
final String clientId = executionContext.getClient().getClientId();
final List<TokenEntity> tokens = grantService.getGrantsOfClient(clientId);
log.debug("Revoking all tokens of client {}...", clientId);

List<TokenEntity> tokensToRemove = new ArrayList<>();
for (TokenEntity token : tokens) {
if (tth == null ||
(tth == TokenTypeHint.ACCESS_TOKEN && token.getTokenTypeEnum() == TokenType.ACCESS_TOKEN) ||
(tth == TokenTypeHint.TX_TOKEN && token.getTokenTypeEnum() == TokenType.TX_TOKEN) ||
(tth == TokenTypeHint.REFRESH_TOKEN && token.getTokenTypeEnum() == TokenType.REFRESH_TOKEN)) {
grantService.removeSilently(token);
tokensToRemove.add(token);
}
}
grantService.removeSilently(tokensToRemove);
log.debug("Revoked all tokens of client {}.", clientId);
}

private AuthorizationGrant findAuthorizationGrant(String token, TokenTypeHint tth) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ public void removeSilently(TokenEntity token) {
}

statusListPool.execute(() -> {
statusListIndexService.updateStatusAtIndex(token.getAttributes().getStatusListIndex(), TokenStatus.INVALID);
final Integer index = token.getAttributes().getStatusListIndex();
if (index != null && index > 0) {
statusListIndexService.updateStatusAtIndexes(Lists.newArrayList(index), TokenStatus.INVALID);
}
});
} catch (Exception e) {
log.error(e.getMessage(), e);
Expand All @@ -184,9 +187,30 @@ public void remove(List<TokenEntity> entries) {

public void removeSilently(List<TokenEntity> entries) {
if (entries != null && !entries.isEmpty()) {
List<Integer> indexes = new ArrayList<>();
for (TokenEntity t : entries) {
removeSilently(t);
try {
remove(t);

if (StringUtils.isNotBlank(t.getAuthorizationCode())) {
cacheService.remove(CacheGrant.cacheKey(t.getAuthorizationCode(), t.getGrantId()));
}
if (shouldSaveInCache()) {
cacheService.remove(t.getTokenCode());
}

final Integer index = t.getAttributes().getStatusListIndex();
if (index != null && index >= 0) {
indexes.add(index);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}

statusListPool.execute(() -> {
statusListIndexService.updateStatusAtIndexes(indexes, TokenStatus.INVALID);
});
}
}

Expand Down