Accessing a job hidden behind the platform's Auth
Here are the general steps for launching a job and accessing it through the platform's Auth.

Generating a service account

Generate a service account via neuro service-account create --name <sa-name>. Make sure to store the Role and the Auth token - you will use them to authenticate your requests.

Example:

1
$ neuro service-account create --name test
2
Id service-account-b41aa732-4bb5-45e4-94c1-a078ca013255
3
Name test
4
Role janedoe/service-accounts/test
5
Owner janedoe
6
Default cluster default
7
Created at now
8
9
Full token with cluster and API url embedded (this value can be used as NEURO_PASSED_CONFIG environment variable):
10
eyJ0b2tlbi<hidden>SJ9
11
12
Just auth token (this value can be passed to neuro config login-with-token):
13
eyJhbGciOi<hidden>Np0
14
15
Save it to some secure place, you will be unable to retrieve it later!
Copied!
In this case, janedoe/service-accounts/test is the needed role and eyJhbGciOi<hidden>Np0 is the needed authentication token.

Starting the required job

Start the job you want to access later.

Example:

1
$ neuro run --http 8080 --name mytestjob python python -m http.server --cgi 8080
Copied!

Share access to the job with the service account

Share access to the job with the service account role from step 1 by using the neuro acl grant job:<job-id-or-name> <role-name> read command.

Example:

1
$ neuro acl grant job:mytestjob janedoe/service-accounts/test read
Copied!

Using the auth token

Use the token from step 1 to authenticate the request with header via the "cookie: dat=<token-here>;" command.

Example:

1
$ curl https://mytestjob--janedoe.jobs.default.org.neu.ro -H "cookie: dat=eyJhbGciOi<hidden>Np0"
2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
3
<html>
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
<title>Directory listing for /</title>
7
</head>
8
<body>
9
<h1>Directory listing for /</h1>
10
<hr>
11
<ul>
12
<li><a href=".dockerenv">.dockerenv</a></li>
13
<li><a href="bin/">bin/</a></li>
14
<li><a href="boot/">boot/</a></li>
15
....
Copied!