Skip to content
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

feat: Add method for checking if annotation based security is used #19038

Merged
merged 5 commits into from
Mar 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,15 @@ private static Logger getLogger() {
return LoggerFactory.getLogger(NavigationAccessControl.class);
}

/**
* Checks if an {@link AnnotatedViewAccessChecker} is in use, i.e. route
* annotations are read.
*
* @return {@code true} if an {@link AnnotatedViewAccessChecker} is in use,
* {@code false} otherwise
*/
public boolean isUsingAnnotatedViewAccessChecker() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be a more generic method like isUsingAccessChecker(Class<? extends NavigationAccessChecker> clazz)?

I wonder if there might be a use case for checking for RoutePathAccessChecker, for example.
If possible (and it is reasonable) I would prevent having this class filled with isUsingSometing() methods.

If it does not make sense, I'm ok with this change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the question is, should it be ”is” or ”get”

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it a more generic

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the question is, should it be ”is” or ”get”

get because there may be a use case where the checker instance could be used outside the NavigationAccessControl?

return checkerList.stream().anyMatch(
checker -> checker instanceof AnnotatedViewAccessChecker);
}
}
Loading