hasRole() is a Spring Security extension to SpEL that tests whether the active security context contains a specified role. Used inside @PreAuthorize, it permits a method call when the expression returns true and blocks it with AccessDeniedException when false. section 10.2
A tool such as getGameComplexity can require the PREMIUM_USER role by placing @PreAuthorize("hasRole('PREMIUM_USER')") on the @Tool method or on a Function implementation’s apply() method. Method security must be enabled with @EnableMethodSecurity. section 10.2
Role-gated game information
A premium user receives the game’s complexity, while an unauthorized user receives “That information is reserved for premium users.” The security check prevents the protected method from being invoked.

