-
Notifications
You must be signed in to change notification settings - Fork 535
9229 - enable OIDC bearer token API access #9230
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
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
861b93c
feat(api): first draft to enable OIDC bearer token API access #9229
poikilotherm f5862e3
feat(settings): add feature gates functionality for the first time #9…
poikilotherm 04b7eac
feat(api): add OIDC API access feature gate to authentication #9229
poikilotherm 3f900e5
chore(api): remove unused imports from AbstractApiBean #9229
poikilotherm 5e85143
refactor(settings,api): rename feature gates to flags as requested by…
poikilotherm b11e4f1
doc(dev,auth): add initial feature flags documentation to the guides …
poikilotherm dd4310b
refactor(auth): cleanup OIDCAuthProvider + expose UserInfo URI #9229
poikilotherm 3694d81
feat(api): query all avail OIDC providers for user info #9229
poikilotherm b1a7b85
fix(api): don't default to guest user if OIDC bearer token is present
vera 065630f
fix(api): don't strip OIDC auth scheme from Authorization header
vera 6561bac
fix(api): send appropriate error response when OIDC user is unknown
vera 62ce097
fix(api): allow Authorization header in incoming API requests
vera 34a1117
Merge pull request #599 from vera/9229-api-oidc-access
poikilotherm 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
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
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
40 changes: 40 additions & 0 deletions
40
src/main/java/edu/harvard/iq/dataverse/settings/FeatureFlags.java
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,40 @@ | ||
| package edu.harvard.iq.dataverse.settings; | ||
|
|
||
| /** | ||
| * <p>This enum holds so-called "feature flags" aka "feature gates", etc. It can be used throughout the application | ||
| * to avoid activating or using experimental functionality or feature previews that are opt-in.</p> | ||
| * | ||
| * <p>The current implementation reuses {@link JvmSettings} to interpret any | ||
| * <a href="https://download.eclipse.org/microprofile/microprofile-config-3.0/microprofile-config-spec-3.0.html#_built_in_converters">boolean values</a> | ||
| * (true == case-insensitive one of "true", "1", "YES", "Y", "ON") and hook into the usual settings system | ||
| * (any MicroProfile Config Source available).</p> | ||
| * | ||
| * If you add any new flags, please add a setting in JvmSettings, think of a default status, add some Javadocs | ||
| * about the flagged feature and add a "@since" tag to make it easier to identify when a flag has been introduced. | ||
| * | ||
| */ | ||
| public enum FeatureFlags { | ||
|
|
||
| /** | ||
| * Enabling will unblock access to the API with an OIDC access token in addition to other available methods. | ||
| * @apiNote Raise flag by setting "dataverse.feature.api-oidc-access" | ||
| * @since Dataverse 5.13 | ||
| * @see JvmSettings#FLAG_API_OIDC_ACCESS | ||
| */ | ||
| API_OIDC_ACCESS(JvmSettings.FLAG_API_OIDC_ACCESS, false), | ||
|
|
||
| ; | ||
|
|
||
| final JvmSettings setting; | ||
| final boolean defaultStatus; | ||
|
|
||
| FeatureFlags(JvmSettings setting, boolean defaultStatus) { | ||
| this.setting = setting; | ||
| this.defaultStatus = defaultStatus; | ||
| } | ||
|
|
||
| public boolean enabled() { | ||
| return setting.lookupOptional(Boolean.class).orElse(defaultStatus); | ||
| } | ||
|
|
||
| } |
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
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.
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.
FWIW: Using authSvc.getAuthenticatedUserByEmail(userInfo.getEmail().toString()); should work. This isn't checking to see if the account was created using OIDC though.