Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add additional security controls #45

Closed
jkerr5 opened this issue Jan 10, 2018 · 5 comments
Closed

Add additional security controls #45

jkerr5 opened this issue Jan 10, 2018 · 5 comments
Assignees

Comments

@jkerr5
Copy link
Collaborator

jkerr5 commented Jan 10, 2018

Koop currently authenticates to MarkLogic as a single user and the feature service exposed by Koop does not have authentication enabled.

Investigate if/how to enable authentication for feature services. How does this work with Esri tools that consume the feature service?

@tdiepenbrock
Copy link
Contributor

We want to implement the koop auth provider spec, most easily seen by example at https://github.com/koopjs/koop-auth-direct-file. This implements Esri's token service (https://developers.arcgis.com/rest/services-reference/generate-token.htm).

To accomplish this we'll need to modify our provider to validate user credentials supplied in the Esri service calls against marklogic somehow, potentially by calling the REST ping service. We will need to do the following tasks:

  • modify server.js to register an auth module that implements the koop auth provider spec. Most likely we will configure the module's name in config/default.json.

  • a separate DatabaseClient should be created for every unique user subject and cached for a period of time equal to the jwt expiration time. Presumably this will happen somehow via the auth module's authorize() and/or authenticate() functions.

  • A singleton Agent should be shared across all DatabaseClient instances. This will make the DatabaseClient instance a lightweight object suitable for caching. DatabaseClient currently uses the yakaa client (https://www.npmjs.com/package/yakaa) by default, although we may switch shortly to the builtin Node Agent. Create the Agent just like this example:

var http = require('http');
var Agent = require('yakaa');
var keepAliveAgent = new Agent({ keepAlive: true });  

Pass the keepAliveAgent in as the agent parameter to the marklogic.createDatabaseClient() function.

  • query.js should no longer create a new DatabaseClient for every request. Rather, it should use the cached client for the current subject.

  • It is VERY important that we NOT call releaseClient() method on the DatabaseClient. This will destroy the shared Agent as well, which will effectively break the entire application except for the first request.

@jkerr5
Copy link
Collaborator Author

jkerr5 commented Apr 8, 2020 via email

@tdiepenbrock
Copy link
Contributor

Commits made, still in feature/45. We need test cases now. Three classes of test cases are needed:

a) configuration-related: does the app work properly with/without auth plugins configured, misconfigured plugins, etc

b) authentication-related: does the token service work, does it properly accept/reject calls with/without valid tokens

c) authorization-related: do users only get to see what they're allowed to see

@mfgumban
Copy link
Contributor

Test cases have been added for all auth strategies: none (default), MarkLogic, and file-based.

@jkerr5
Copy link
Collaborator Author

jkerr5 commented Jan 16, 2023

This is complete

@jkerr5 jkerr5 closed this as completed Jan 16, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants