OIDC Authorization Code + PKCE login flow for CLI clients authenticating against Seqera Platform.
import io.seqera.platform.auth.oidc.OidcLoginFlow;
String accessToken = OidcLoginFlow.builder()
.endpoint("https://api.cloud.seqera.io")
.clientId("nextflow_cli")
.build()
.login(url -> {
// open the authorization URL in the user's browser
Desktop.getDesktop().browse(URI.create(url));
});The login method:
- Discovers OIDC endpoints from
{endpoint}/.well-known/openid-configuration - Generates a PKCE code verifier and challenge
- Starts a local callback server on
127.0.0.1(ephemeral port) - Invokes the
browserLaunchercallback with the authorization URL - Waits for Platform to redirect the browser to the local callback
- Exchanges the authorization code for an access token
implementation 'io.seqera:lib-platform-oidc:0.1.0'None — uses only JDK classes (java.net.http.HttpClient, com.sun.net.httpserver.HttpServer, java.security.*).
./gradlew :lib-platform-oidc:test