libdas2
das2 core C utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
DasCredMngr Struct Reference

#include <das2/credentials.h>

Detailed Description

Credentials manager Handles a list of login credentials and supplies these as needed for network operations.

Public Member Functions

DasCredMngrnew_CredMngr (const char *sKeyStore)
 Initialize a new credentials manager, optionally from a saved list. More...
 
void del_CredMngr (DasCredMngr *pThis)
 Delete a credentials manager free'ing it's internal credential store. More...
 
const char * CredMngr_getHttpAuth (DasCredMngr *pThis, const char *sServer, const char *sRealm, const char *sDataset)
 Retrive an HTTP basic authentication token for a given dataset on a given server. More...
 
void CredMngr_authFailed (DasCredMngr *pThis, const char *sServer, const char *sRealm, const char *sDataset, const char *sMsg)
 Let the credentials manager know that a particular authorization method failed. More...
 
das_prompt CredMngr_setPrompt (DasCredMngr *pThis, das_prompt new_prompt)
 Change the function used to prompt users for das2 server credentials. More...
 
bool CredMngr_save (const DasCredMngr *pThis, const char *sFile)
 Save the current credentials to the given filename. More...
 

Member Function Documentation

DasCredMngr * new_CredMngr ( const char *  sKeyStore)

Initialize a new credentials manager, optionally from a saved list.

Parameters
sKeyStoreIf not NULL, the credentials manager will initialize itself from the given file.
Returns
A new credentials manager allocated on the heap
void del_CredMngr ( DasCredMngr pThis)

Delete a credentials manager free'ing it's internal credential store.

Parameters
pThisA pointer to the credentials manager structure to free. The pointer is no-longer valid after this call and should be set to NULL.
const char * CredMngr_getHttpAuth ( DasCredMngr pThis,
const char *  sServer,
const char *  sRealm,
const char *  sDataset 
)

Retrive an HTTP basic authentication token for a given dataset on a given server.

Parameters
pThisA pointer to a credentials manager structure
sServerThe name of the server for which these credentials apply
sRealmA string identifing the system the user will be authenticating too.
sDatasetThe name of the dataset for which these credentials apply
Returns
The auth token, NULL if no auth token could be supplied
void CredMngr_authFailed ( DasCredMngr pThis,
const char *  sServer,
const char *  sRealm,
const char *  sDataset,
const char *  sMsg 
)

Let the credentials manager know that a particular authorization method failed.

The credentials manager can use this information to re-prompt the user if desired

Parameters
pThisA pointer to a credentials manager structure
sServerThe name of the server for which these credentials apply
sRealmA string identifing the system the user will be authenticating too.
sDatasetThe name of the dataset for which these credentials apply
sMsgan optional message providing more details on why authentication failed
das_prompt CredMngr_setPrompt ( DasCredMngr pThis,
das_prompt  new_prompt 
)

Change the function used to prompt users for das2 server credentials.

The built-in password prompt function assumes a console application, it asks for a username then tries to set the controlling terminal to non-echoing I/O and asks for a password.

Parameters
pThisa pointer to a credentials manager structure
new_promptThe new function, or NULL if no password prompt should ever be issued
Returns
The old password prompt function
bool CredMngr_save ( const DasCredMngr pThis,
const char *  sFile 
)

Save the current credentials to the given filename.

Parameters
pThisa pointer to a CredMngr structure
sFilethe file to hold the loosly encypted credentials

The documentation for this struct was generated from the following file: