How to enable token authentication in Jupyter Notebook? - jupyter-notebook

I am running Juypter Notebook version 6.0.0 on a remote server. There is password authentication in place and according to the docs if this is so then token authentication is disabled. However I need to enable token authentication so I can set up Google Colab(which requires token based authentication) with a local runtime on the remote server. While there are several links describing how to disable authentication, I couldn't find any on how to enable it.
The output of jupyter notebook list does not show any tokens. Even resetting the password does not generate a token.

I see that your notebook provider has disabled tokens. In this doc the steps to disable token is given, so I applied exactly opposite steps and it worked. Since you have a remote server, if you somehow manage to restart jupyter notebook remotely, then you can do the same.
Steps:
Edit the config file, jupyter_notebook_config.json
Add this line to the config, as in the picture
"token": "YOUR_TOKEN",
You can use token consisting of hex characters (0-9, a-f) as a token
Remove the line that contains password
Now you need to restart the server
Exit by clicking 'Quit'
After you log back next time, give the token instead
Location of config file:
Windows: "C:\Users\Username\.jupyter\"
Linux: "/home/user/.jupyter"

Related

I can't see custom grant token in devportal

I have a problem with runing a custom grant in wso2.
I'm add the following lines to my deployment.toml:
[[oauth.custom_grant_type]]
name="Grant_u80"
grant_handler="com.mm.eee.libs.wso2.b002_oauth2.grant_u80.GrantHandler"
grant_validator="com.mm.eee.libs.wso2.b002_oauth2.grant_u80.GrantValidator"
IdTokenAllowed=true
Also I add token's new library in /home/wso2carbon/wso2am-4.1.0/repository/components/lib/, added library properties to /home/wso2carbon/wso2am-4.1.0/repository/conf/custom/ and verify the following default.json line is uncommented:
"oauth.token_renewal.renew_access_token_per_request": true
That it's the point:
If i run wso2 on my local computer, the token works correctly in
carbon and devportal.
If i run wso2 on docker image in my local computer, the token works correctly too.
But, if I run the same docker image in kubernetes, the custom token appears only in carbon, and not in devportal.
¿Anybody knows why the custom grant token doesn't appear in devportal applications?
Thanks you!

Why am I prompted to enter username and password when using `salt -a pam`?

I am following the external authentication documentation at https://docs.saltstack.com/en/latest/topics/eauth/index.html
I have configured external_auth in the master to allow the user ubuntu to issue salt commands.
Running salt -a pam '*' test.ping as user ubuntu works, except I am being prompted for user and password.
I know the about -T authentication token option, but it still requires the initial password prompt and it expires.
The command is being executed as ubuntu already, why am I being prompted again? Is there a way to remove the prompt altogether? Allowing unattended programs running as the ubuntu user to issue salt commands?
Is this a problem with Saltstack, or a matter of pam configuration? According to the documentation Saltstack uses the login service (e.g. /etc/pam.d/login).
In the documentation it's stated: "Pass in an external authentication medium to validate against. The credentials will be prompted for. ", so it's expected.
If you're logged on the master, you shouldn't have to use external_auth.
You should instead use publisher_acl:
"The salt publisher ACL system is a means to allow system users other than root to have access to execute select salt commands on minions from the master."
See the docs for more infos.

Windows task fails because of .httr-oauth file

I've programmed a task using Windows task manager. It consists of accessing BigQuery data via bigrquery library. I've stored my credentials in a local file httr-oauth.
I'm using these libraries:
library(bigrquery)
library(assertthat)
library(httpuv)
The task has been working for a few weeks and suddenly I see this message in the log file (.Rout):
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Please point your browser to the following url:
https://accounts.google.com/o/oauth2/auth?client_id=....
It looks like token needs to be refreshed, but if I run the script manually everything is ok and my httr-oauth works fine.
Any idea about what's happening? Thanks in advance!
In short you need to use a service account.
Find out how to configure the library driver to authenticate the connection with a Google service account. When you authenticate your connection this way, the driver handles authentication on behalf of the service account, so that an individual user account is not directly involved and no user input is required.
To authenticate your connection this way, you must provide a Google service account email address and the full path to a private key file for the service account. You can generate and download the private key file when you set up the service account.
More here: https://developers.google.com/identity/protocols/OAuth2ServiceAccount

R server with REST API and user authentication

I need help from more exprienced R users. I am looking for R server app with REST API. I would like to send and run R script using HTTP and retrieve results.
The important thing is user authentication and authorization - scripts should be executed in separated workspace (like user home directory). The best solution will be user system account authentication/authorization.
Does anyone know such application?
I found application like OpenCPU but without authentication support.
In details:
r server app should be standalone application running on machine with Linux. It listen on HTTP port for request. Clients applications comunicate with server only via REST API. To execute R code, client must authenticate first using system account username and password. After succesful authentication user have access to their own home directory (or other dedicated workspace dir). User can read/writes files in workspace from R code. The R code to execute is sent as plain text in POST request. Eventualy it could be run as script from user's workspace directory. Support for full R functionality is required
The general idea is similar to RStudio Server or JupyterHub except the client is not web browser but external (for example Java) application.
Unfortunatelly I didn't found reasonable API documentation for RStudio or JupyterHub
I have accomplished the same using RApache
http://rapache.net
You can run your R scripts by making a Rest call and can also pass arguments (GET and POST) to your scripts
<Location /helloworld>
SetHandler r-handler
RFileHandler /path/helloworld.r
</Location>
Here helloworld will be API endpoint and it will in turn execute the helloworld.r script
It also supports authentication as is build on top of Apache

TortoiseGit - When does it ask for a username and password?

I want to implement a little Git Webserver running as an IIS application. I managed it that I can pull and push from and to it. But now I want to implement some basic credentials.
What I do not want to have is, to add a remote url like http://username:password#domain.tld/repo.git. I do not want to have the password in the url (username will be ok).
Currently I want to have this for the HTTP protocol (HTTPS will also be fine)
What do I have to return from my server to tortoisegit, so it will prompt me for a password?
TortoiseGit would use the same curl commands than msysgit to access to an http server (IIS or other).
See "Git - How to use .netrc file on windows to save user and password": you can save your username and password in %HOME%/_netrc (you need to define HOME on Windows).
The other option is to use the credential helpers packages with git1.7.9+. You enter your username and password once per session (and avoid the _netrc plain text file).

Resources