This repository was archived by the owner on May 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 591
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ing-security-oauth2` Tests that use the dependency are also deleted.
onobc
reviewed
Apr 6, 2022
.../main/java/org/springframework/cloud/dataflow/server/service/SpringSecurityAuditorAware.java
Show resolved
Hide resolved
onobc
reviewed
Apr 6, 2022
.../main/java/org/springframework/cloud/dataflow/server/service/SpringSecurityAuditorAware.java
Show resolved
Hide resolved
onobc
suggested changes
Apr 6, 2022
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.
onobc
reviewed
Apr 7, 2022
.../java/org/springframework/cloud/dataflow/server/service/SpringSecurityAuditorAwareTests.java
Show resolved
Hide resolved
onobc
reviewed
Apr 7, 2022
* Test the fix for the case where the authentication doesn't contain a name but isn't anonymous it resulted in an NPE. | ||
*/ | ||
@Test | ||
public void testNullPointerOnUnnamedPrincipal() { |
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.
[NIT] 2 features Junit5 brings that we should use more is
- no need for public class or methods
- no need to prefix method names w/ "test"
I will adjust during merge.
onobc
reviewed
Apr 7, 2022
.../java/org/springframework/cloud/dataflow/server/service/SpringSecurityAuditorAwareTests.java
Show resolved
Hide resolved
Closed via b8bf2de |
And !false is true.
…On Wed, 06 Apr 2022, 21:03 Chris Bono, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/service/SpringSecurityAuditorAware.java
<#4876 (comment)>
:
> @@ -41,8 +43,8 @@ public SpringSecurityAuditorAware(SecurityStateBean securityStateBean) {
final boolean authenticationEnabled = securityStateBean.isAuthenticationEnabled();
if (authenticationEnabled && SecurityContextHolder.getContext() != null) {
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
- if (!(authentication instanceof AnonymousAuthenticationToken)) {
- return Optional.of(authentication.getName());
+ if (authentication != null && !(authentication instanceof AnonymousAuthenticationToken)) {
I believe this null check is redundant as null instanceof Foo) is always
false.
—
Reply to this email directly, view it on GitHub
<#4876 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADR35XAK3OIP3OWFTUFDVDVDXNWJANCNFSM5SW3Z5DQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixing NPE in getCurrentAuditor.
Fixes #4861