-
Notifications
You must be signed in to change notification settings - Fork 549
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
fix: session creation - checking tenant for user #1063
base: 9.3
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
"4.0", | ||
"5.0", | ||
"5.1", | ||
"5.2" | ||
"5.2", | ||
"5.3" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,11 +99,12 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws I | |
} | ||
|
||
AccessToken.VERSION accessTokenVersion = AccessToken.getAccessTokenVersionForCDI(version); | ||
boolean shouldCheckUserForTenant = version.greaterThanOrEqualTo(SemVer.v5_3); | ||
|
||
SessionInformationHolder sessionInfo = Session.createNewSession( | ||
tenantIdentifier, storage, main, userId, userDataInJWT, | ||
userDataInDatabase, enableAntiCsrf, accessTokenVersion, | ||
useStaticSigningKey); | ||
useStaticSigningKey, shouldCheckUserForTenant); | ||
|
||
if (storage.getType() == STORAGE_TYPE.SQL) { | ||
try { | ||
|
@@ -143,6 +144,11 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws I | |
super.sendJsonResponse(200, result, resp); | ||
} catch (AccessTokenPayloadError e) { | ||
throw new ServletException(new BadRequestException(e.getMessage())); | ||
} catch (UnauthorisedException e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. catching Unauthorised and returning a different status could get confusing. Create a new exception type for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, okay There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
JsonObject reply = new JsonObject(); | ||
reply.addProperty("status", "USER_DOES_NOT_BELONG_TO_TENANT_ERROR"); | ||
reply.addProperty("message", e.getMessage()); | ||
super.sendJsonResponse(200, reply, resp); | ||
} catch (NoSuchAlgorithmException | StorageQueryException | InvalidKeyException | InvalidKeySpecException | | ||
StorageTransactionLogicException | SignatureException | IllegalBlockSizeException | | ||
BadPaddingException | InvalidAlgorithmParameterException | NoSuchPaddingException | | ||
|
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.
merge error?
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 is. Sorry I missed this
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.
done