Skip to content

v3.0.0

Choose a tag to compare

@sku0x20 sku0x20 released this 27 Sep 16:35
· 238 commits to main since this release

Authentication (helidon-extensions)

Endpoints can now declare an Authentication parameter; the codegen resolves it from the request context.

  • Authentication / AuthenticationResolver interfaces and AuthenticationFilter (lazy resolution per request)
  • Provide an AuthenticationResolver via the registry (@Creates); it's wired into routing automatically
  • Declared Authentication parameter types are type-checked against the resolved authentication
data class UserAuthN(val id: String) : Authentication

@Get("/user")
fun user(auth: UserAuthN, res: ServerResponse) {
    res.send(auth.id)
}
ksp {
    arg("stopgap.codegen.endpoint.auth.defaultType", "public") // or an Authentication FQN
}

See docs/proposals/0001-securing-api.md.

helidon-test

  • SetupCapture gains authResolver (defaults to TestAuthFakeResolver)
  • WebserverExtension registers AuthenticationFilter for integration tests

⚠️ Breaking changes

  • Closed by default: endpoint methods without an Authentication parameter fail compilation unless stopgap.codegen.endpoint.auth.defaultType is configured
  • KSP option renamed: endpoint.codegen.registry.skip=true → stopgap.codegen.endpoint.registry.enabled=false (no fallback)
  • SetupCapture: new authResolver parameter in 2nd position — positional args must be updated
dependencies {
    implementation("dev.sku20.stopgap:helidon-extensions:3.0.0")
    testImplementation("dev.sku20.stopgap:helidon-test:3.0.0")
}