-
Notifications
You must be signed in to change notification settings - Fork 397
Improve application access validation in client authentication #2942
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
base: master
Are you sure you want to change the base?
Changes from all 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 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -615,6 +615,9 @@ public static boolean authenticateClient(String clientId, String clientSecretPro | |||||||||||||||||
public static boolean authenticateClient(String clientId, String clientSecretProvided, String appTenant) | ||||||||||||||||||
throws IdentityOAuthAdminException, IdentityOAuth2Exception, InvalidOAuthClientException { | ||||||||||||||||||
|
||||||||||||||||||
if (!isApplicationAccessible(clientId, appTenant)) { | ||||||||||||||||||
throw new InvalidOAuthClientException("Application is disabled for the client_id: " + clientId); | ||||||||||||||||||
Comment on lines
+618
to
+619
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. Log Improvement Suggestion No: 2
Suggested change
|
||||||||||||||||||
} | ||||||||||||||||||
OAuthAppDO appDO = OAuth2Util.getAppInformationByClientId(clientId, appTenant); | ||||||||||||||||||
if (appDO == null) { | ||||||||||||||||||
if (log.isDebugEnabled()) { | ||||||||||||||||||
|
@@ -660,6 +663,30 @@ public static boolean authenticateClient(String clientId, String clientSecretPro | |||||||||||||||||
return true; | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
private static boolean isApplicationAccessible(String clientId, String appTenant) | ||||||||||||||||||
throws IdentityOAuth2Exception { | ||||||||||||||||||
|
||||||||||||||||||
Comment on lines
+666
to
+668
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. Log Improvement Suggestion No: 3
Suggested change
|
||||||||||||||||||
ServiceProvider serviceProvider = OAuth2Util.getServiceProvider(clientId, appTenant); | ||||||||||||||||||
DiagnosticLog.DiagnosticLogBuilder diagnosticLogBuilder = null; | ||||||||||||||||||
if (LoggerUtils.isDiagnosticLogsEnabled()) { | ||||||||||||||||||
diagnosticLogBuilder = new DiagnosticLog.DiagnosticLogBuilder( | ||||||||||||||||||
OAuthConstants.LogConstants.OAUTH_INBOUND_SERVICE, | ||||||||||||||||||
OAuthConstants.LogConstants.ActionIDs.VALIDATE_APPLICATION_ENABLED_STATUS); | ||||||||||||||||||
diagnosticLogBuilder.inputParam(LogConstants.InputKeys.CLIENT_ID, clientId) | ||||||||||||||||||
.logDetailLevel(DiagnosticLog.LogDetailLevel.APPLICATION); | ||||||||||||||||||
} | ||||||||||||||||||
if (!serviceProvider.isApplicationEnabled()) { | ||||||||||||||||||
if (diagnosticLogBuilder != null) { | ||||||||||||||||||
Comment on lines
+678
to
+679
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. Log Improvement Suggestion No: 4
Suggested change
|
||||||||||||||||||
diagnosticLogBuilder | ||||||||||||||||||
.resultMessage("Application is disabled.") | ||||||||||||||||||
.resultStatus(DiagnosticLog.ResultStatus.FAILED); | ||||||||||||||||||
LoggerUtils.triggerDiagnosticLogEvent(diagnosticLogBuilder); | ||||||||||||||||||
} | ||||||||||||||||||
return false; | ||||||||||||||||||
} | ||||||||||||||||||
Comment on lines
+685
to
+686
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. Log Improvement Suggestion No: 5
Suggested change
|
||||||||||||||||||
return true; | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
private static boolean isTenantActive(String tenantDomain) throws IdentityOAuth2Exception { | ||||||||||||||||||
try { | ||||||||||||||||||
TenantManager tenantManager = OAuthComponentServiceHolder.getInstance() | ||||||||||||||||||
|
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.
Log Improvement Suggestion No: 1