-
Notifications
You must be signed in to change notification settings - Fork 20
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
Open
MikeNeilson
wants to merge
6
commits into
develop
Choose a base branch
from
feature/1356-openid-configuration
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f18aac2
Auth + PKCE from Swagger UI works.
MikeNeilson 3972a72
Additional parameter works, but not ideal.
MikeNeilson dbe171a
Improve kc-idp-hint extension, add client id value.
MikeNeilson 92c75ed
Initial hook-point to setup oauth.
MikeNeilson 08fd768
Configure Swagger OAuth systems from OpenAPI extension values.
MikeNeilson 25c1edf
Update docker file so that the initial -dev deploy will work.
MikeNeilson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,6 @@ | ||
| <!doctype html> | ||
| <html lang="en-US"> | ||
| <body> | ||
| <script src="oauth2-redirect.js"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or 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,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() | ||
| }) | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This works with Node, but you should also see
https://vite.dev/guide/env-and-mode
i.e.
const CUSTOM_VAR = import.meta.env.VITE_CUSTOM_VARWhere you prefix with VITE_ to avoid accidental env var injection.. from your
.envfilesThere 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.
Thanks, was wondering why that that was comment out.
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, that doesn't actually work within the vite.config.js