Package dev.hilla

Class AuthenticationUtil


  • public class AuthenticationUtil
    extends Object
    Helpers for authentication related tasks.
    • Constructor Detail

      • AuthenticationUtil

        public AuthenticationUtil()
    • Method Detail

      • getSecurityHolderAuthentication

        public static org.springframework.security.core.Authentication getSecurityHolderAuthentication()
        Gets the authenticated user from the Spring SecurityContextHolder.
        Returns:
        the authenticated user or null
      • getSecurityHolderRoleChecker

        public static Function<String,​Boolean> getSecurityHolderRoleChecker()
        Gets a function for checking if the authenticated user from the Spring SecurityContextHolder is in a given role.
        Returns:
        a function for checking if the given user has the given role