wiki:udg/ecoms/RPackage/authentication

Version 7 (modified by maru, 8 years ago) (diff)

--

Authentication

The SPECS-EUPORIAS Data Portal is based on a password-protected THREDDS data server providing metadata and data access to a set of geo-referenced atmospheric variables using OPeNDAP and other remote data access protocols. Therefore, before accessing the data, authentication is required at the SPECS-EUPORIAS Data Portal. To this aim, user's must be registered and activate their role as EUPORIAS/SPECS users, following these steps?.

Once registered as users, the registration within the R session can be easily accomplished assuming that we already have a valid username, role and password. To this aim, in the following lines we illustrate how to proceed using the R-to-Java interface provided by the package rJava (For more information on the authentication procedure click on the help page).

> username <- "myUsername" # This is a character string with the username
> password <- "myPassword" # This is a character string with the password
> aux <- .jnew("ucar/nc2/util/net/HTTPBasicProvider", username, password)
> J("ucar.nc2.util.net.HTTPSession")$setGlobalCredentialsProvider(aux)

IMPORTANT: proxy server connections

In case the connection is performed via a proxy, it is necessary to set up the proxy prior to the authentication step, in order to connect to the server.

> proxyHost <- "proxy.host.com" # Your institution Proxy configuration: host
> proxyPort <- as.integer(1234) # and port
> J("ucar.nc2.util.net.HTTPSession")$setGlobalProxy(proxyHost,proxyPort)

Note that the object proxyHost is a character string, whereas the proxyPort must be an integer.