-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(datahub-frontend): Adding basic file-based authentication to datahub-frontend #2818
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
Merged
Merged
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| // This is a sample JAAS config that uses the following login module | ||
| // DummyLoginModule -- this module can work with a username (that is in user table) and any password | ||
| // org.eclipse.jetty.jaas.spi.PropertyFileLoginModule -- this module can work with a username and any password defined in the `../conf/user.props` file | ||
|
|
||
| WHZ-Authentication { | ||
| security.DummyLoginModule sufficient; | ||
| org.eclipse.jetty.jaas.spi.PropertyFileLoginModule sufficient | ||
| debug="true" | ||
| file="/datahub-frontend/conf/user.props"; | ||
| }; |
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 @@ | ||
| datahub:datahub |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // This is a sample JAAS config that uses the following login module | ||
| // This is a sample JAAS config that uses the following login module | ||
| // org.eclipse.jetty.jaas.spi.PropertyFileLoginModule -- this module can work with a username and any password defined in the `../conf/user.props` file | ||
|
|
||
| WHZ-Authentication { | ||
| org.eclipse.jetty.jaas.spi.PropertyFileLoginModule sufficient | ||
| debug="true" | ||
| file="../conf/user.props"; | ||
| }; | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # JaaS Authentication | ||
|
|
||
| ## Overview | ||
|
|
||
| The DataHub frontend server comes with support for plugging in [JaaS](https://docs.oracle.com/javase/7/docs/technotes/guides/security/jaas/JAASRefGuide.html) modules. | ||
| This allows you to use a custom authentication protocol to log your users into DataHub. | ||
|
|
||
| By default, we in include sample configuration of a file-based username / password authentication module ([PropertyFileLoginModule](http://archive.eclipse.org/jetty/8.0.0.M3/apidocs/org/eclipse/jetty/plus/jaas/spi/PropertyFileLoginModule.html)) | ||
| that is configured with a single username / password combination: datahub - datahub. | ||
|
Contributor
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. And once we have fine grained access controls, this login module allows us to define the use role as well 👍
Collaborator
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. Heck yeah! |
||
|
|
||
| To change or extend the default behavior, you have multiple options, each dependent on which deployment environment you're operating in. | ||
|
|
||
| ### Modify user.props file directly (Local Testing) | ||
|
|
||
| The first option for customizing file-based users is to modify the file `datahub-frontend/app/conf/user.props` directly. | ||
| Once you've added your desired users, you can simply run `./dev.sh` or `./datahub-frontend/run-local-frontend` to validate your | ||
| new users can log in. | ||
|
|
||
| ### Mount a custom user.props file (Docker Compose) | ||
|
|
||
| By default, the `datahub-frontend` container will look for a file called `user.props` mounted at the container path | ||
| `/datahub-frontend/conf/user.props`. If you wish to launch this container with a custom set of users, you'll need to override the default | ||
| file mounting when running using `docker-compose`. | ||
|
|
||
| To do so, change the `datahub-frontend-react` service in the docker-compose.yml file containing it to include the custom file: | ||
|
|
||
| ``` | ||
| datahub-frontend-react: | ||
| build: | ||
| context: ../ | ||
| dockerfile: docker/datahub-frontend/Dockerfile | ||
| image: linkedin/datahub-frontend-react:${DATAHUB_VERSION:-head} | ||
| env_file: datahub-frontend/env/docker.env | ||
| hostname: datahub-frontend-react | ||
| container_name: datahub-frontend-react | ||
| ports: | ||
| - "9002:9002" | ||
| depends_on: | ||
| - datahub-gms | ||
| volumes: | ||
| - ./my-custom-dir/user.props:/datahub-frontend/conf/user.props | ||
| ``` | ||
|
|
||
| And then run `docker-compose up` against your compose file. | ||
|
|
||
|
|
||
| ## Custom JaaS Configuration | ||
|
|
||
| In order to change the default JaaS module configuration, you will have to launch the `datahub-frontend-react` container with the custom `jaas.conf` file mounted as a volume | ||
| at the location `/datahub-frontend/conf/jaas.conf`. | ||
|
|
||
| To do so, change the `datahub-frontend-react` service in the docker-compose.yml file containing it to include the custom file: | ||
|
|
||
| ``` | ||
| datahub-frontend-react: | ||
| build: | ||
| context: ../ | ||
| dockerfile: docker/datahub-frontend/Dockerfile | ||
| image: linkedin/datahub-frontend-react:${DATAHUB_VERSION:-head} | ||
| env_file: datahub-frontend/env/docker.env | ||
| hostname: datahub-frontend-react | ||
| container_name: datahub-frontend-react | ||
| ports: | ||
| - "9002:9002" | ||
| depends_on: | ||
| - datahub-gms | ||
| volumes: | ||
| - ./my-custom-dir/jaas.conf:/datahub-frontend/conf/jaas.conf | ||
| ``` | ||
|
|
||
| And then run `docker-compose up` against your compose file. | ||
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
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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.