Class SecuredBrowserlessApplicationContext
-
- All Implemented Interfaces:
-
java.lang.AutoCloseable
public class SecuredBrowserlessApplicationContext<C> extends BrowserlessApplicationContext
Credential-aware application context.
Extends BrowserlessApplicationContext with a configured, non-null SecurityContextHandler and credential-typed
newUser(...)overloads for installing per-user security state. Build instances via a BrowserlessApplicationContext.Builder configured with withSecurityContextHandler, which transitions to Builder and produces this typed context.All thread-affinity and lifecycle guarantees of the base BrowserlessApplicationContext apply unchanged.
- Since:
1.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classSecuredBrowserlessApplicationContext.BuilderBuilder for SecuredBrowserlessApplicationContext. Obtained from withSecurityContextHandler; delegates to the underlying base builder for shared configuration.
-
Method Summary
Modifier and Type Method Description BrowserlessUserContextnewUser(C credentials)Creates a new user context with the given credentials. BrowserlessUserContextnewUser(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
-
-
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
credentialsisnull, 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, ornullfor 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 overridecreateCredentialsto opt into this helper.- Parameters:
username- the usernameroles- the roles for the user; may be empty- Returns:
the new user context
-
-
-
-