Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
0f9904e
WIP: First attempt at auth0 flow for 'nextflow auth login'
ewels Sep 4, 2025
b599fe1
Handle Enterprise installs without auth0
ewels Sep 4, 2025
5fa52fc
Add auth0 client ID
ewels Sep 4, 2025
f031622
Hardcode 'platform' as audience as shouldn't ever need to edit this
ewels Sep 4, 2025
a0d800a
Add additional allowed API URLs for auth0 flow
ewels Sep 5, 2025
ec86e14
Use auth0 to generate a Platform PAT, add to bashrc
ewels Sep 5, 2025
356e8f5
WIP: Started work on 'nextflow auth logout'
ewels Sep 5, 2025
b6b6127
Rewrite: Save to ~/.nextflow/config instead of using env vars
ewels Sep 5, 2025
ec03361
Always set tower.enabled true when logging in
ewels Sep 5, 2025
cf344f9
nextflow auth config
ewels Sep 5, 2025
f6f3694
Add code comment next to workspace ID saying what the org / ws is
ewels Sep 5, 2025
ba279b1
New nextflow auth status command
ewels Sep 6, 2025
0b01234
Don't prompt for API URL, just have it as a CLI option
ewels Sep 10, 2025
1909da0
Add warnings to login and logout if TOWER_ACCESS_TOKEN is set
ewels Sep 10, 2025
0b3ffab
Bugfix: change how workspace name and fullName are used
ewels Sep 10, 2025
b31b1c7
Tell the user we're using their env var token in 'auth config'
ewels Sep 10, 2025
b9547ff
Add colour
ewels Sep 10, 2025
fa056b5
Refactor colour helpers to take string argument
ewels Sep 10, 2025
320bee4
Minor tweak
ewels Sep 10, 2025
39d3c64
Switch from PKCE to device-flow auth, with code confirmation
ewels Sep 11, 2025
261e1e6
Add support for Platform auth on stage and prod
ewels Sep 11, 2025
8a2b847
Tweak formatting
ewels Sep 11, 2025
a340b66
Auth flow with code, appended to URL
ewels Sep 20, 2025
4c7cf83
Prompt to open browser, don't do it without warning
ewels Sep 20, 2025
564890b
Rename AuthColorUtil to ColorUtil, expect to use it elsewhere
ewels Sep 20, 2025
4015186
Improve styling and flow for status / auth
ewels Sep 20, 2025
95908ff
lots of testing and tweaking CLI
ewels Sep 20, 2025
3a67b90
Code cleanup
ewels Sep 20, 2025
248fedc
Add some tests
ewels Sep 20, 2025
5c7a192
move authcommand implementation to nf-tower
jorgee Sep 26, 2025
4bdf462
Fix log
jorgee Sep 29, 2025
0273b40
Fixing nf-tower load in AuthCommand
jorgee Sep 30, 2025
00b4590
Spliting auth tests in nexflow and nf-tower
jorgee Sep 30, 2025
1f56862
change modifications in .nextflow/config by /.nexflow/.login and incl…
jorgee Oct 1, 2025
4f0773e
clean implementation and fix tests
jorgee Oct 2, 2025
b1d5301
include more tests
jorgee Oct 2, 2025
29a2a54
Catch user cancellation of auth flow cleanly
ewels Oct 6, 2025
4c2270f
Add confirmation when running 'auth logout'
ewels Oct 6, 2025
21088fa
Rename .login to seqera_auth.config
ewels Oct 6, 2025
e148ed5
Tweaks to help text, status table printing
ewels Oct 6, 2025
f28cbc3
Improve CLI output when running config with workspaces
ewels Oct 6, 2025
b5852d7
Update tests
ewels Oct 6, 2025
7f84c61
Check that the default workspace has CEs, and prompt to set one as pr…
ewels Oct 6, 2025
c53a4ee
auth status: show primary CE and default work directory
ewels Oct 6, 2025
3f11aa8
Sort selection lists
ewels Oct 6, 2025
2f35683
Update tests
ewels Oct 6, 2025
e42c958
Add nextflow auth docs
christopher-hakkaart Oct 7, 2025
805843f
Update langauge for cli commands
christopher-hakkaart Oct 7, 2025
864c209
Update language in install
christopher-hakkaart Oct 7, 2025
a0f633a
Revise text
christopher-hakkaart Oct 7, 2025
f17a8c2
Address comments
christopher-hakkaart Oct 7, 2025
8df0ae8
Remove extra space
christopher-hakkaart Oct 7, 2025
04c6b07
Merge pull request #3 from christopher-hakkaart/nextflow-auth
ewels Oct 7, 2025
e91848a
Merge branch 'master' into nextflow-auth
pditommaso Oct 7, 2025
0ae13cf
Rename seqera_auth.config to seqera-auth.config
ewels Oct 7, 2025
8f3e2eb
Move Auth0 keys into PlatformHelper library
ewels Oct 7, 2025
cf05f3f
Refactor getting token to use PlatformHelper.getAccessToken
ewels Oct 7, 2025
bb0ebe8
Remove unused AbortOperationException
ewels Oct 7, 2025
7c0c8e4
Always log.debug when catching exceptions
ewels Oct 7, 2025
217cb76
Fix regression with PlatformHelper.getAccessToken
ewels Oct 7, 2025
342d33a
Update tests
ewels Oct 7, 2025
84c3584
Tone down the colours a little
ewels Oct 7, 2025
991579f
Use PlatformHelper for endpoint and workflow ID too
ewels Oct 8, 2025
50b1671
Update test case
ewels Oct 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,14 @@ The standalone distribution will still download core and third-party plugins as
You can launch workflows directly from [Seqera Platform](https://seqera.io/platform/) without installing Nextflow locally.
Launching from Seqera Platform provides you with:
Launching from Seqera provides you with:
- User-friendly launch interfaces.
- Automated cloud infrastructure creation.
- Organizational user management.
- Advanced analytics with resource optimization.
Seqera Cloud Basic is free for small teams. Researchers at qualifying academic institutions can apply for free access to Seqera Cloud Pro.
See the [Seqera Platform documentation](https://docs.seqera.io/platform) for tutorials to get started.
See [Seqera Platform Cloud](https://docs.seqera.io/platform) to get started.
If you have installed Nextflow locally, you can use the {ref}`nextflow auth <cli-auth>` command to authenticate with Seqera and automatically configure workflow monitoring.
74 changes: 74 additions & 0 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,80 @@ Available options:

## Commands

(cli-auth)=

### `auth`

:::{versionadded} 25.09.0-edge
:::

Manage Seqera Platform authentication.

**Usage**

```console
$ nextflow auth <subcommand> [options]
```

**Description**

The `auth` command provides authentication and configuration management for Seqera. For Seqera Cloud, it uses an OAuth2 authentication flow generate and save a Personal Access Token (PAT) locally. For Seqera Enterprise installations, it uses direct PAT authentication. Credentials are saved to `~/.nextflow/seqera-auth.config`.

**Options**

`-h, -help`
: Prints the command usage information.

**Subcommands**

`login`
: Authenticates with Seqera and saves credentials. Sets Seqera primary compute environment, monitoring, and workspace.
: The following options are available:

`-u, -url`
: Specifies your Seqera API endpoint (default: `https://api.cloud.seqera.io`)

`logout`
: Removes Seqera authentication and revokes the Seqera Cloud access token (if applicable).

`config`
: Sets Seqera primary compute environment, monitoring, and workspace.

`status`
: Shows Seqera authentication status and configuration.

**Examples**

Authenticate with Seqera Cloud:

```console
$ nextflow auth login
```

Authenticate with an Enterprise installation:

```console
$ nextflow auth login -u https://tower.example.com/api
```

View current authentication status:

```console
$ nextflow auth status
```

Configure Seqera settings:

```console
$ nextflow auth config
```

Remove authentication:

```console
$ nextflow auth logout
```

(cli-clean)=

### `clean`
Expand Down
273 changes: 273 additions & 0 deletions modules/nextflow/src/main/groovy/nextflow/cli/CmdAuth.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
/*
* Copyright 2013-2025, Seqera Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package nextflow.cli

import com.beust.jcommander.Parameter
import com.beust.jcommander.Parameters
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import nextflow.Const
import nextflow.SysEnv
import nextflow.config.ConfigBuilder
import nextflow.exception.AbortOperationException
import nextflow.plugin.Plugins
import org.fusesource.jansi.Ansi
import org.pf4j.ExtensionPoint

import java.nio.file.Paths

import static org.fusesource.jansi.Ansi.*

import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.StandardOpenOption
import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeUnit
import java.util.regex.Pattern

/**
* Implements the 'nextflow auth' commands
*
* @author Phil Ewels <[email protected]>
*/
@Slf4j
@CompileStatic
@Parameters(commandDescription = "Manage Seqera Platform authentication")
class CmdAuth extends CmdBase implements UsageAware {

interface SubCmd {
String getName()
void apply(List<String> result)
void usage(List<String> result)
}

interface AuthCommand extends ExtensionPoint {
void login(String url)
void logout()
void config()
void status()
}

static public final String NAME = 'auth'

private List<SubCmd> commands = []

private AuthCommand operation

String getName() {
return NAME
}

@Parameter(hidden = true)
List<String> args

@Parameter(names = ['-u', '-url'], description = 'Seqera Platform API endpoint')
String apiUrl

CmdAuth() {
commands.add(new LoginCmd())
commands.add(new LogoutCmd())
commands.add(new ConfigCmd())
commands.add(new StatusCmd())
}

void usage() {
usage(args)
}

void usage(List<String> args) {
List<String> result = []
if (!args) {
result << this.getClass().getAnnotation(Parameters).commandDescription()
result << 'Usage: nextflow auth <sub-command> [options]'
result << ''
result << 'Commands:'
result << ' login Authenticate with Seqera Platform'
result << ' logout Remove authentication and revoke access token'
result << ' status Show current authentication status and configuration'
result << ' config Configure Seqera Platform settings'
result << ''
} else {
def sub = commands.find { it.name == args[0] }
if (sub)
sub.usage(result)
else {
throw new AbortOperationException("Unknown auth sub-command: ${args[0]}")
}
}
println result.join('\n').toString()
}

@Override
void run() {
if (!args) {
usage()
return
}
// load the Auth command implementation
this.operation = loadOperation()
if( !operation )
throw new IllegalStateException("Unable to load auth extensions.")
// consume the first argument
getCmd(args).apply(args.drop(1))
}

protected AuthCommand loadOperation(){
// setup the plugins system and load the secrets provider
Plugins.init()
// load the config
Plugins.start('nf-tower')
// get Auth command operations implementation from plugins
return Plugins.getExtension(AuthCommand)
}

protected SubCmd getCmd(List<String> args) {
def cmd = commands.find { it.name == args[0] }
if (cmd) {
return cmd
}

def matches = commands.collect { it.name }.closest(args[0])
def msg = "Unknown auth sub-command: ${args[0]}"
if (matches)
msg += " -- Did you mean one of these?\n" + matches.collect { " $it" }.join('\n')
throw new AbortOperationException(msg)
}

//
// nextflow auth login
//
class LoginCmd implements SubCmd {

@Override
String getName() { 'login' }

@Override
void apply(List<String> args) {
if (args.size() > 0) {
throw new AbortOperationException("Too many arguments for ${name} command")
}
operation.login(apiUrl)
}



@Override
void usage(List<String> result) {
result << 'Authenticate with Seqera Platform'
result << "Usage: nextflow auth $name [-u <endpoint>]".toString()
result << ''
result << 'Options:'
result << ' -u, -url <endpoint> Seqera Platform API endpoint (default: https://api.cloud.seqera.io)'
result << ''
result << 'This command will:'
result << ' 1. Display a URL and device code for OAuth2 authentication (Cloud) or prompt for PAT (Enterprise)'
result << ' 2. Wait for user to complete authentication in web browser'
result << ' 3. Generate and save access token to home-directory Nextflow config'
result << ' 4. Configure tower.accessToken, tower.endpoint, and tower.enabled settings'
result << ''
}
}

class LogoutCmd implements SubCmd {

@Override
String getName() { 'logout' }

@Override
void apply(List<String> args) {
if (args.size() > 0) {
throw new AbortOperationException("Too many arguments for ${name} command")
}
operation.logout()
}


@Override
void usage(List<String> result) {
result << 'Log out and remove Seqera Platform authentication'
result << "Usage: nextflow auth $name".toString()
result << ''
result << 'This command will:'
result << ' 1. Check if tower.accessToken is configured'
result << ' 2. Validate the token with Seqera Platform'
result << ' 3. Delete the PAT from Platform (only if Seqera Platform Cloud)'
result << ' 4. Remove the authentication from Nextflow config'
result << ''
}
}

//
// nextflow auth config
//
class ConfigCmd implements SubCmd {

@Override
String getName() { 'config' }

@Override
void apply(List<String> args) {
if (args.size() > 0) {
throw new AbortOperationException("Too many arguments for ${name} command")
}

operation.config()
}


@Override
void usage(List<String> result) {
result << 'Configure Seqera Platform settings'
result << "Usage: nextflow auth $name".toString()
result << ''
result << 'This command will:'
result << ' 1. Check authentication status'
result << ' 2. Configure tower.enabled setting for workflow monitoring'
result << ' 3. Configure default workspace (tower.workspaceId)'
result << ''
}
}

class StatusCmd implements SubCmd {

@Override
String getName() { 'status' }

@Override
void apply(List<String> args) {
if (args.size() > 0) {
throw new AbortOperationException("Too many arguments for ${name} command")
}
operation.status()
}


@Override
void usage(List<String> result) {
result << 'Show authentication status and configuration'
result << "Usage: nextflow auth $name".toString()
result << ''
result << 'This command shows:'
result << ' - Authentication status (yes/no) and source'
result << ' - API endpoint and source'
result << ' - Monitoring enabled status and source'
result << ' - Default workspace and source'
result << ' - System health status (API connection and authentication)'
result << ''
}
}
}
Loading