-
Notifications
You must be signed in to change notification settings - Fork 21
Feature/1356 openid configuration #1357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
e8807a4
4844f2e
da61564
df0f4ef
75bf33c
168da2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <!doctype html> | ||
| <html lang="en-US"> | ||
| <body> | ||
| <script src="oauth2-redirect.js"></script> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| "use strict" | ||
| function run () { | ||
| var oauth2 = window.opener.swaggerUIRedirectOauth2 | ||
| var sentState = oauth2.state | ||
| var redirectUrl = oauth2.redirectUrl | ||
| var isValid, qp, arr | ||
|
|
||
| if (/code|token|error/.test(window.location.hash)) { | ||
| qp = window.location.hash.substring(1).replace("?", "&") | ||
| } else { | ||
| qp = location.search.substring(1) | ||
| } | ||
|
|
||
| arr = qp.split("&") | ||
| arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace("=", '":"') + '"' }) | ||
| qp = qp ? JSON.parse("{" + arr.join() + "}", | ||
| function (key, value) { | ||
| return key === "" ? value : decodeURIComponent(value) | ||
| } | ||
| ) : {} | ||
|
|
||
| isValid = qp.state === sentState | ||
|
|
||
| if (( | ||
| oauth2.auth.schema.get("flow") === "accessCode" || | ||
| oauth2.auth.schema.get("flow") === "authorizationCode" || | ||
| oauth2.auth.schema.get("flow") === "authorization_code" | ||
| ) && !oauth2.auth.code) { | ||
| if (!isValid) { | ||
| oauth2.errCb({ | ||
| authId: oauth2.auth.name, | ||
| source: "auth", | ||
| level: "warning", | ||
| message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server" | ||
| }) | ||
| } | ||
|
|
||
| if (qp.code) { | ||
| delete oauth2.state | ||
| oauth2.auth.code = qp.code | ||
| oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl}) | ||
| } else { | ||
| let oauthErrorMsg | ||
| if (qp.error) { | ||
| oauthErrorMsg = "["+qp.error+"]: " + | ||
| (qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") + | ||
| (qp.error_uri ? "More info: "+qp.error_uri : "") | ||
| } | ||
|
|
||
| oauth2.errCb({ | ||
| authId: oauth2.auth.name, | ||
| source: "auth", | ||
| level: "error", | ||
| message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server" | ||
| }) | ||
| } | ||
| } else { | ||
| oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl}) | ||
| } | ||
| window.close() | ||
| } | ||
|
|
||
| if( document.readyState !== "loading" ) { | ||
| run() | ||
| } else { | ||
| document.addEventListener("DOMContentLoaded", function () { | ||
| run() | ||
| }) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ import react from "@vitejs/plugin-react"; | |
|
|
||
| // https://vitejs.dev/config/ | ||
| export default defineConfig(({ mode }) => { | ||
| // const env = loadEnv(mode, process.cwd(), ""); | ||
| const env = loadEnv(mode, process.cwd(), ""); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works with Node, but you should also see https://vite.dev/guide/env-and-mode i.e.
Where you prefix with VITE_ to avoid accidental env var injection.. from your
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, was wondering why that that was comment out.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, that doesn't actually work within the vite.config.js |
||
| // const BASE_PATH = env?.BASE_PATH ?? "/cwms-data"; | ||
| return { | ||
| base: "/cwms-data", | ||
|
|
@@ -14,12 +14,22 @@ export default defineConfig(({ mode }) => { | |
| server: { | ||
| proxy: { | ||
| "^/cwms-data/timeseries/.*": { | ||
| target: "https://cwms-data.usace.army.mil", | ||
| target: env.CDA_API_ROOT, | ||
| changeOrigin: true, | ||
| secure: false, | ||
| }, | ||
| "^/cwms-data/catalog/.*": { | ||
| target: "https://cwms-data.usace.army.mil", | ||
| target: env.CDA_API_ROOT, | ||
| changeOrigin: true, | ||
| secure: false, | ||
| }, | ||
| "^/cwms-data/auth/.*": { | ||
| target: env.CDA_API_ROOT, | ||
| changeOrigin: true, | ||
| secure: false, | ||
| }, | ||
| "^/cwms-data/swagger-docs$": { | ||
| target: env.CDA_API_ROOT, | ||
| changeOrigin: true, | ||
| secure: false, | ||
| }, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to these changes, but is that timeout value of "604800" in minutes or seconds? I believe it gets parsed as minutes which is like 420 days
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be seconds, so about a week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UrlResolver thinks its minutes.
public UrlResolver(URL jwksUrl, int keyTimeoutMinutes)Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... well then, I can math. 🤦♂️ .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I'm not going to fix it this pr, will adjust separate it's been there for ever and the places it's used I can override easily and things are restarted regularly anyways.