Class VaadinRolePrefixHolder

java.lang.Object
com.vaadin.flow.spring.security.VaadinRolePrefixHolder
All Implemented Interfaces:
Serializable

public class VaadinRolePrefixHolder extends Object implements Serializable
Holds role prefix accessible outside an active request. Role prefix should match with SecurityContextHolderAwareRequestWrapper in Spring Security context aware environments to allow utilities like AuthenticationUtil to check roles in the same way with same role prefix.
See Also:
  • Constructor Details

    • VaadinRolePrefixHolder

      public VaadinRolePrefixHolder(String rolePrefix)
      Construct VaadinRolePrefixHolder with a role prefix.
      Parameters:
      rolePrefix - Role prefix.
  • Method Details

    • getRolePrefix

      public String getRolePrefix()
      Return role prefix. May be null.
      Returns:
      Role prefix
    • isSet

      public boolean isSet()
      Gets boolean flag indicating if role prefix is set or not.
      Returns:
      true when role prefix is set, false otherwise.
    • resetRolePrefix

      public void resetRolePrefix(VaadinRequest request)
      Reset role prefix from the given request. Works only with a VaadinServletRequest and a chain of ServletRequestWrappers to find SecurityContextHolderAwareRequestWrapper with the role prefix. Method doesn't do anything if role prefix is not found.
      Parameters:
      request - Vaadin request used to find active role prefix.
    • resetRolePrefix

      public void resetRolePrefix(org.springframework.security.web.DefaultSecurityFilterChain defaultSecurityFilterChain)
      Reset role prefix from the given DefaultSecurityFilterChain. Method doesn't do anything if role prefix is not found.
      Parameters:
      defaultSecurityFilterChain - Default security filter chain used to find active role prefix.
      Throws:
      NullPointerException - If defaultSecurityFilterChain is null.