netcdf-c/include/ncauth.h
Dennis Heimbigner 6b69b9c52c Significantly Improve Amazon S3 Cloud Storage Support
## S3 Related Fixes

* Add comprehensive support for specifying AWS profiles to provide access credentials.
* Parse the files "~/.aws/config" and "~/.aws/credentials to provide credentials for the HDF5 ROS3 driver and to locate default region.
* Add a function to obtain the currently active S3 credentials. The search rules are defined in docs/nczarr.md.
* Provide documentation for the new features.
* Modify the struct NCauth (in include/ncauth.h) to replace specific S3 credentials with a profile name.
* Add a unit test to test the operation of profile and credentials management.
* Add support for URLS of the form "s3://<bucket>/<key>"; this requires obtaining a default region.
* Allows the specification of profile and/or region in a URL of the form "#mode=nczarr,...&aws.region=...&aws.profile=..."

## Misc. Fixes

* Move the ezxml code to libdispatch so that it can be used both by DAP4 and nczarr.
* Modify nclist to provide a deep clone operation.
* Modify ncuri to provide a deep clone operation.
* Modify the .rc file format to allow the specification of a path to be tested when looking for an entry in the .rc file.
* Ensure that the NC_rcload function is called.
* Modify nchttp to support setting request headers.
2021-09-27 18:36:33 -06:00

71 lines
2.0 KiB
C

/*
Copyright (c) 1998-2018 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT for license information.
*/
/*
Common authorization tracking.
Currently for DAP2 and DAP4 protocols.
Every curl connection will need a copy of this.
*/
#ifndef NCAUTH_H
#define NCAUTH_H
/* Need these support includes */
#include "ncrc.h"
typedef struct NCauth {
struct curlflags {
int proto_https; /* is https: supported? */
int compress; /*CURLOPT_ENCODING*/
int verbose; /*CURLOPT_ENCODING*/
int timeout; /*CURLOPT_TIMEOUT*/
int connecttimeout; /*CURLOPT_CONNECTTIMEOUT*/
int maxredirs; /*CURLOPT_MAXREDIRS*/
char* useragent; /*CURLOPT_USERAGENT*/
int cookiejarcreated;
char* cookiejar; /*CURLOPT_COOKIEJAR,CURLOPT_COOKIEFILE*/
char* netrc; /*CURLOPT_NETRC,CURLOPT_NETRC_FILE*/
} curlflags;
struct ssl {
int verifypeer; /* CURLOPT_SSL_VERIFYPEER;
do not do this when cert might be self-signed
or temporarily incorrect */
int verifyhost; /* CURLOPT_SSL_VERIFYHOST; for client-side verification */
char* certificate; /*CURLOPT_SSLCERT*/
char* key; /*CURLOPT_SSLKEY*/
char* keypasswd; /*CURLOPT_SSLKEYPASSWD*/
char* cainfo; /* CURLOPT_CAINFO; certificate authority */
char* capath; /*CURLOPT_CAPATH*/
} ssl;
struct proxy {
char *host; /*CURLOPT_PROXY*/
int port; /*CURLOPT_PROXYPORT*/
char* user; /*CURLOPT_PROXYUSERNAME*/
char* pwd; /*CURLOPT_PROXYPASSWORD*/
} proxy;
struct credentials {
char *user; /*CURLOPT_USERNAME*/
char *pwd; /*CURLOPT_PASSWORD*/
} creds;
char* s3profile;
} NCauth;
#if defined(__cplusplus)
extern "C" {
#endif
extern int NC_authsetup(NCauth**, NCURI*);
extern void NC_authfree(NCauth*);
extern char* NC_combinehostport(NCURI*);
extern int NC_parsecredentials(const char* userpwd, char** userp, char** pwdp);
extern int NC_authgets3creds(NCauth* auth, const char* profile, const char** accessidp, const char** secretkeyp);
#if defined(__cplusplus)
}
#endif
#endif /*NCAUTH_H*/