Skip to content

Commit

Permalink
Add OGC API - Processes request filtering support
Browse files Browse the repository at this point in the history
Add basicAuth demonstration service
  • Loading branch information
gfenoy committed Nov 23, 2022
1 parent cb7bdc0 commit ae34767
Show file tree
Hide file tree
Showing 10 changed files with 509 additions and 26 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Expand Up @@ -94,6 +94,7 @@ ARG BUILD_DEPS=" \
librabbitmq-dev \
libkrb5-dev \
nlohmann-json-dev \
libaprutil1-dev\
"
WORKDIR /zoo-project
COPY . .
Expand Down Expand Up @@ -127,6 +128,13 @@ RUN set -ex \
&& cp ../zoo-services/hello-r/cgi-env/* /usr/lib/cgi-bin/ \
&& cp ../zoo-api/js/* /usr/lib/cgi-bin/ \
&& cp ../zoo-api/r/minimal.r /usr/lib/cgi-bin/ \
\
# Install Basic Authentication sample
&& cd ../zoo-services/utils/security/basicAuth \
&& make \
&& cp cgi-env/* /usr/lib/cgi-bin \
&& cd ../../../../zoo-kernel \
\
&& for i in $(ls ./locale/po/*po | grep -v utf8 | grep -v message); do \
mkdir -p /usr/share/locale/$(echo $i| sed "s:./locale/po/::g;s:.po::g")/LC_MESSAGES; \
msgfmt $i -o /usr/share/locale/$(echo $i| sed "s:./locale/po/::g;s:.po::g")/LC_MESSAGES/zoo-kernel.mo ; \
Expand Down
1 change: 1 addition & 0 deletions docker/.htaccess
@@ -1,4 +1,5 @@
RewriteEngine On
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
SetEnvIf Request_URI "^\/?(\w+)\/ogc-api(.*)" SERVICES_NAMESPACE=$1
RewriteRule ^\/?(\w+)\/ogc-api/(.*) /ogc-api/$2 [PT]
RewriteCond %{REQUEST_FILENAME} !-f
Expand Down
5 changes: 5 additions & 0 deletions zoo-project/HISTORY.txt
@@ -1,4 +1,9 @@
Version 2.0.0
* Include basicAuth build instructions in the Dockefile
* Add basicAuth service illustrating how to secure access to OGC API
- Processes using Basic Authentication
* Use the osecurity section to detect secured path, request method
from the published OpenAPI
* Update the printHeaders function to allow Status definition at runtime
* Add a [osecurity] section to secure access to path,method couple
from the published OpenAPI
Expand Down
21 changes: 12 additions & 9 deletions zoo-project/zoo-kernel/sqlapi.c
Expand Up @@ -384,11 +384,6 @@ void recordServiceStatus(maps* conf){
strlen(sid->value)+
strlen(osid->value)+
strlen(wpsStatus[2])+90+1)*sizeof(char));
if( zoo_ds_nb == 0 ){
init_sql(conf);
isCreated=1;
zoo_ds_nb++;
}
sprintf(sqlQuery,
"INSERT INTO %s.services (uuid,processid,sid,osid,fstate,itype) "
"VALUES ('%s','%s','%s','%s','%s','%s');",
Expand All @@ -399,6 +394,11 @@ void recordServiceStatus(maps* conf){
osid->value,
wpsStatus[2],
pmType->value);
if( zoo_ds_nb == 0 ){
init_sql(conf);
isCreated=1;
zoo_ds_nb++;
}
execSql(conf,zoo_ds_nb-1,sqlQuery);
free(sqlQuery);
cleanUpResultSet(conf,zoo_ds_nb-1);
Expand Down Expand Up @@ -597,20 +597,23 @@ char* _getStatusFile(maps* conf,char* pid){
*/
void removeService(maps* conf,char* pid){
int zoo_ds_nb=getCurrentId(conf);
int iCreated=0;
map *schema=getMapFromMaps(conf,"database","schema");
char *sqlQuery=(char*)
malloc((strlen(pid)+strlen(schema->value)+38+1)
*sizeof(char));
sprintf(sqlQuery,
"DELETE FROM %s.services where uuid=$$%s$$;",
schema->value,pid);
if( zoo_ds_nb == 0 ){
init_sql(conf);
zoo_ds_nb++;
iCreated=1;
}
sprintf(sqlQuery,
"DELETE FROM %s.services where uuid=$$%s$$;",
schema->value,pid);
execSql(conf,zoo_ds_nb-1,sqlQuery);
cleanUpResultSet(conf,zoo_ds_nb-1);
//close_sql(conf,zoo_ds_nb-1);
if(iCreated>0)
close_sql(conf,zoo_ds_nb-1);
free(sqlQuery);
//end_sql();
}
Expand Down

0 comments on commit ae34767

Please sign in to comment.