Skip to content

das2c_credset

C. Piker edited this page Dec 12, 2023 · 3 revisions

FUNCTION

das2c_credset

PURPOSE

Set HTTP Basic Authentication credentials for a specific resources on a server

CALLING SEQUENCE

num_creds = das2c_credset(url, realm)
num_creds = das2c_credset(url, realm, param, value)
num_creds = das2c_credset(url, realm, param, value, user, password)

INPUT

Parameter Type Purpose
url String A URL string without a fragment or query parameters
realm String An authentication realm string. These are provided by a server when requesting authentication during an das2c_readhttp call

OPTIONAL INPUTS

Parameter Type Purpose
param String Associate this credential with the presence of a specific HTTP GET query parameter. Use !NULL to skip.
value String Associate this credential with a specific value of 'param' above. Use !NULL to skip.
user String Instead of prompting at the terminal (or cmd.exe), provide a username directly. Required in IDLDE. See SIDE EFFECTS below.
password String Instead of prompting at the terminal (or cmd.exe), provide a clear-text password directly. Required in IDLDE. See SIDE EFFECTS below.

OUTPUT

Returns the number of stored credentials. Exits with a message if there was an error.

SIDE EFFECTS

Normally the underlying das2C library prompts for authentication information at the terminal, on POSIX systems or in a command window on Windows and passwords are not echoed, nor saved in your history.

Unfortunately, the IDLDE (IDL Development Environment) command window is not a true terminal and so the standard method of entering user names and passwords won't work there. When called from IDLDE, you must provide the user name and password in the function call. This means your user name and password will be saved in your IDL history file and could be read by any other program that has read access to your home directory!

Thus, it's best to call this function from a command line IDL session outside of IDLDE.

EXAMPLES

  1. Set the credentials for das3 resource at the terminal with echo off:
    sURL = 'https://tracers.physics.uiowa.edu/stream/source/tr1/ql/mag/bdc_burst'
    sRealm = 'TRACERS Quicklook'
    nCreds = das2c_credset(sUrl, sRealm)
    das2c_credsave()   ; Save currently loaded credentials
    '''  
    
  2. Set the credentials for a das v2.2 resource at the IDLDE command line:
    sURL = 'https://planet.physics.uiowa.edu/das/server/'
    sRealm = 'Realm of Makebelieve'
    sDataset = 'DE/de-1/pwi_lowrate'
    sUser = 'drjfever'
    sPass = 'really~4disco'
    nCreds = das2c_credsave(sUrl, sRealm, 'dataset', sDataset, sUser, sPass)

MODIFICATION HISTORY

C. Piker, 2023-12-12 - Initial Version

Clone this wiki locally