-
Notifications
You must be signed in to change notification settings - Fork 0
Use token profile and delete check users #140
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
Conversation
Signed-off-by: achour94 <berrahmaachour@gmail.com>
Signed-off-by: achour94 <berrahmaachour@gmail.com>
Signed-off-by: achour94 <berrahmaachour@gmail.com>
|
||
if (maybeSubList != null && !maybeSubList.isEmpty()) { | ||
String sub = maybeSubList.getFirst(); | ||
return userAdminService.userRecordConnection(sub, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do fire and forget instead of waiting for the recorded user connection now that we don't need the response anymore
|
||
public UserAdminControlGlobalPreFilter(UserAdminService userAdminService) { | ||
this.userAdminService = userAdminService; | ||
super(userAdminService); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment for this class saying that this comes after other filters (getOrder), and we don't use it to reject request, only to record connection. Optionally remove the dead code that rejects (clientList and else block at the end) or add a comment saying it can't happen and needs to be refactored
return userAdminService.userExists(sub).flatMap(userExist -> Boolean.TRUE.equals(userExist) ? chain.filter(exchange) : completeWithCode(exchange, HttpStatus.FORBIDDEN)); | ||
// Record the connection with isConnectionAccepted=true | ||
// and continue with the filter chain regardless of the result | ||
return userAdminService.userRecordConnection(sub, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fire and forget
* @param exchange The server web exchange | ||
* @return Mono<Void> with unauthorized response if validation fails, null if validation passes | ||
*/ | ||
private Mono<Void> validateAudienceOrClientId(JWTClaimsSet jwtClaimsSet, ServerWebExchange exchange) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to return a synchronous value (boolean true false, or void/exception like the lib validator) and completeWithCode in the caller
* @param exchange The server web exchange | ||
* @return Mono<Void> with unauthorized response if validation fails, null if validation passes | ||
*/ | ||
private Mono<Void> validateClientId(String clientId, ServerWebExchange exchange) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same Maybe better to return a synchronous value (boolean true false, or void/exception like the lib validator) and completeWithCode in the caller
@@ -1,3 +1,5 @@ | |||
allowed-issuers: #, # | |||
allowed-issuers: http://172.17.0.1:9090 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to application-local.yml ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also we have "localhost" everywhere (except once in explore-server, probably no reason), instead of the docker localhost. Maybe keep that for homogeneity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just move it to the docker compose deployment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's already in deployment, just does not work when we don't work with docker images
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we check issuers using String.startsWith() so localhost will not work in this case since issuer in the token is 172.17.0.1
@@ -1,3 +1,5 @@ | |||
allowed-issuers: #, # | |||
allowed-issuers: http://172.17.0.1:9090 | |||
allowed-audiences: gridexplore-client, gridadmin-client, griddyna-client, gridstudy-client, gridexplore-local, gridadmin-local, griddyna-local, gridstudy-local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to put this in the docker compose deployment only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it does not work if we start gateway locally using intellij !
Signed-off-by: achour94 <berrahmaachour@gmail.com>
Signed-off-by: achour94 <berrahmaachour@gmail.com>
Signed-off-by: achour94 <berrahmaachour@gmail.com>
Signed-off-by: achour94 <berrahmaachour@gmail.com>
Signed-off-by: achour94 <berrahmaachour@gmail.com>
Signed-off-by: achour94 <berrahmaachour@gmail.com>
src/main/java/org/gridsuite/gateway/filters/AbstractGlobalPreFilter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/gateway/filters/TokenValidatorGlobalPreFilter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/gateway/filters/TokenValidatorGlobalPreFilter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/gateway/filters/TokenValidatorGlobalPreFilter.java
Outdated
Show resolved
Hide resolved
Signed-off-by: achour94 <berrahmaachour@gmail.com>
src/main/java/org/gridsuite/gateway/filters/AbstractGlobalPreFilter.java
Outdated
Show resolved
Hide resolved
Signed-off-by: achour94 <berrahmaachour@gmail.com>
Signed-off-by: achour94 <berrahmaachour@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the isValidAudienceOrClientId method is missing the by-pass for Demo env, where we don't perform audiance check if allowedAudiences is empty
src/main/java/org/gridsuite/gateway/filters/TokenValidatorGlobalPreFilter.java
Outdated
Show resolved
Hide resolved
Signed-off-by: achour94 <berrahmaachour@gmail.com>
Signed-off-by: achour94 <berrahmaachour@gmail.com>
|
Split audience validation into two separate lists:
* allowedAudiences: Exclusively for validating the aud claim in JWT tokens
* allowedClients: For validating client_id claim in JWT tokens and client IDs in opaque tokens