Class SecuredBrowserlessApplicationContext

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      BrowserlessUserContext newUser(C credentials) Creates a new user context with the given credentials.
      BrowserlessUserContext newUser(String username, Array<String> roles) Creates a new user context for the given username and roles.
      • Methods inherited from class com.vaadin.browserless.BrowserlessApplicationContext

        close, create, create, create, createSecured, forComponent, newUser
      • Methods inherited from class java.lang.AutoCloseable

        close
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • newUser

         BrowserlessUserContext newUser(C credentials)

        Creates a new user context with the given credentials.

        The security context for this user is first cleared, then the credentials are passed to SecurityContextHandler.setupAuthentication() — including when credentials is null, so that the handler can install its anonymous-equivalent state. The resulting security state is captured as this user's initial snapshot and is automatically restored whenever one of this user's windows is activated.

        Parameters:
        credentials - framework-specific credentials, or null for an anonymous user
        Returns:

        the new user context

      • newUser

         BrowserlessUserContext newUser(String username, Array<String> roles)

        Creates a new user context for the given username and roles.

        Delegates to createCredentials on the configured handler, then to newUser. Spring and Quarkus handlers ship with overrides that mirror the conventions of @WithMockUser / Quarkus security identity construction; custom handlers must override createCredentials to opt into this helper.

        Parameters:
        username - the username
        roles - the roles for the user; may be empty
        Returns:

        the new user context