Skip to content

Commit 3ab7cc4

Browse files
authored
feat: Add method for checking if annotation based security is used (#19038)
1 parent 499a1a1 commit 3ab7cc4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

flow-server/src/main/java/com/vaadin/flow/server/auth/NavigationAccessControl.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,4 +401,14 @@ private static Logger getLogger() {
401401
return LoggerFactory.getLogger(NavigationAccessControl.class);
402402
}
403403

404+
/**
405+
* Checks if an access checker of the given type is in use.
406+
*
407+
* @return {@code true} if a checker is in use, {@code false} otherwise
408+
*/
409+
public boolean hasAccessChecker(
410+
Class<? extends NavigationAccessChecker> type) {
411+
return checkerList.stream()
412+
.anyMatch(checker -> type.isAssignableFrom(checker.getClass()));
413+
}
404414
}

0 commit comments

Comments
 (0)