Method Security in GraalVM Native Image
While GraalVM Native Image does support Method Security, certain use cases may require the application to supply additional hints for proper functionality.
If you’re employing custom implementations of UserDetails or authentication classes and using @PreAuthorize and @PostAuthorize annotations, you may need supplementary indications. Consider a scenario where you’ve crafted a custom implementation of the UserDetails class, which is returned by your UserDetailsService:
- First, create a custom
UserDetailsimplementation as follows:
//src/main/java/com/packtpub/springsecurity/service/ CalendarUserDetails.java
public class CalendarUserDetails extends CalendarUser implements UserDetails {
CalendarUserDetails(CalendarUser user) {
setId(user.getId());
setEmail(user.getEmail());
...