Class TestSecurity
java.lang.Object
dev.relism.flash.ext.security.test.TestSecurity
- All Implemented Interfaces:
dev.relism.flash.extension.FlashExtension
Authenticates test requests as any
Principal, whatever mechanisms the application
installs — an OIDC user, an API key, a plain name — without an identity provider.
FlashTest app = FlashTest.of(flash -> flash.apply(new MyApp()).install(new TestSecurity()));
app.request().with(TestSecurity.as(() -> "alice")).get("/me");
Works because FlashTest serves the application in the test's own JVM: the principal
is handed over by reference, under a token only this process can have issued.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
TestSecurity
public TestSecurity()
-
-
Method Details
-
as
public static Consumer<dev.relism.flash.testing.FlashRequest> as(dev.relism.flash.ext.security.Principal principal) Sends the request asprincipal. -
configure
public void configure(dev.relism.flash.extension.FlashRegistrar<?> app, dev.relism.flash.extension.FlashContext ctx) - Specified by:
configurein interfacedev.relism.flash.extension.FlashExtension
-