koopjs / koop-auth-direct-file

Koop authentication plugin using file-based identity-store
Other
8 stars 4 forks source link

Add new useHttp option to module #2

Closed rgwozdz closed 6 years ago

rgwozdz commented 6 years ago

Added a authSpecExtension option to module. The option, which must be a plain object, is used to extend the result of function authenticationSpecification.

rgwozdz commented 6 years ago

Re-kicking CI.

dmfenton commented 6 years ago

I don't quite understand the why of this feature? Can you give some additional context of when/why you might use this?

rgwozdz commented 6 years ago

@dmfenton - I've noted the main use (at least right now) in the README. In koop-output-geoservices, we have to construct a tokenServicesUrl. After much testing, I found that trying to set the protocol for that URL dynamically from the request was not reliable (due to redirects and server settings). As a result, I defaulted to https unless an incoming options from the authenticationSpecification indicated otherwise: https://github.com/koopjs/koop-output-geoservices/blob/https-patch/index.js#L56

I considered getting the ssl flag to koop-output-geoservices other ways, (e.g., ENV), but thought that this option to extend the result of authenticationSpecification might be useful as developers leverage the auth module for other output-services.