-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #668 from nasa/harmony-1938
HARMONY-1938: Support running harmony without using an EDL app
- Loading branch information
Showing
55 changed files
with
233 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
services/harmony/app/middleware/earthdata-login-skipped.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import HarmonyRequest from '../models/harmony-request'; | ||
import env from '../util/env'; | ||
|
||
if (process.env.USE_EDL_CLIENT_APP === 'false' && !process.env.EDL_TOKEN) { | ||
throw new Error( | ||
'Earthdata Login configuration error: You must set EDL_TOKEN in the environment ' + | ||
'when USE_EDL_CLIENT_APP is false', | ||
); | ||
} | ||
|
||
/** | ||
* Builds Express.js middleware for bypassing EDL client authentication. This should only | ||
* be used for local testing and will limit harmony functionality to endpoints that do | ||
* not require an EDL client to perform checks. EDL token verification will not be | ||
* performed directly by the harmony app, but the EDL_TOKEN environment variable will | ||
* be passed to CMR and to download sites when trying to retrieve data at which point | ||
* those applications will validate the token. | ||
* | ||
* @returns Express.js middleware for doing EDL token authentication | ||
*/ | ||
export default async function edlSkipped(req: HarmonyRequest, res, next): Promise<void> { | ||
req.user = 'anonymous'; | ||
req.accessToken = env.edlToken; | ||
req.authorized = true; | ||
return next(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.