-
Notifications
You must be signed in to change notification settings - Fork 6k
Replace deprecated #check calls with #authorize #16965
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: main
Are you sure you want to change the base?
Conversation
@@ -67,20 +67,33 @@ public ObservationAuthorizationManager(ObservationRegistry registry, Authorizati | |||
@Deprecated | |||
@Override | |||
public AuthorizationDecision check(Supplier<Authentication> authentication, T object) { |
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.
I think it's better to leave the check
method as is. There's no point in calling the authorize
method from a deprecated method.
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.
I think if we are moving away from check
method it's reasonable to stop calling user-defined check
implementations in our code, instead it's good to indicate to the user that they should fully migrate to using authorize
method if they have mix of both, the same approach is used in AuthorizationManagers#anyOf
for example.
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.
@jzheaux what do you think?
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.
Good points from both of you.
Given that this is work that can be done in advance of the next major, I think that it is worthwhile. In this way, the only thing that remains to be done when the time comes is for check
to be removed.
Hey @evgeniycheban , It would be nice if the |
Yeah, good catch, I must have missed that one. |
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.
Thanks, @evgeniycheban! I've left some feedback inline.
@@ -73,7 +73,7 @@ void setup() { | |||
@Test | |||
void verifyWhenDefaultsThenObserves() { | |||
given(this.handler.supportsContext(any())).willReturn(true); | |||
given(this.authorizationManager.check(any(), any())).willReturn(this.grant); |
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.
Let's leave unit tests as-is so that we know we are still backward compatible.
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.
I'll change it to use willCallRealMethod
instead.
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.
@@ -67,20 +67,33 @@ public ObservationAuthorizationManager(ObservationRegistry registry, Authorizati | |||
@Deprecated | |||
@Override | |||
public AuthorizationDecision check(Supplier<Authentication> authentication, T object) { |
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.
Good points from both of you.
Given that this is work that can be done in advance of the next major, I think that it is worthwhile. In this way, the only thing that remains to be done when the time comes is for check
to be removed.
Closes spring-projectsgh-16936 Signed-off-by: Evgeniy Cheban <[email protected]>
Hi, @jzheaux I've updated the PR. |
It would be nice to make the same improvement for |
Closes gh-16936