-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add a new Okta JWT SSO example #55
Open
paoliniluis
wants to merge
1
commit into
master
Choose a base branch
from
okta-jwt-sso
base: master
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
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 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 @@ | ||
node_modules |
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,24 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.env |
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,13 @@ | ||
FROM node:lts-alpine as builder | ||
|
||
WORKDIR /app | ||
|
||
COPY server.js package.json /app/ | ||
COPY src /app/src | ||
COPY public /app/public | ||
ENV NODE_OPTIONS=--openssl-legacy-provider | ||
RUN npm install | ||
|
||
EXPOSE 3001 | ||
|
||
CMD [ "npm", "start" ] |
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,32 @@ | ||
# Metabase SSO with Okta + JWT | ||
|
||
An extremely basic demo of JWT SSO authentication | ||
|
||
## How does this work | ||
|
||
It's a web application that connects to Okta to authenticate, get user properties and then authenticate to Metabase via JWT with those properties | ||
|
||
## Structure of the project | ||
|
||
- server.js: the backend, here you'll see the routes and the structure to make the connection to Okta | ||
- public, src: the frontend, this is a basic react application that has a button to initiate the flow | ||
|
||
# How to run this project | ||
|
||
First of all you need to create a tenant in Okta, if you don't have one, please create a tenant | ||
|
||
In Okta: | ||
1) create a web application (OIDC - OpenID Connect) | ||
2) leave everything by default but the "Sign-in redirect URIs" (you need to enter localhost:3001/* there) | ||
3) once you confirm the project, you'll get a cliend id and a secret, please complete those in the server.js file | ||
|
||
In Metabase: | ||
1) you need a pro/enterprise token, so initialize Metabase and complete that in the settings->admin settings-license and billing section | ||
2) get the JWT signing key on settings->admin->authentication->jwt and complete that in the server.js | ||
3) complete the JWT URI to localhost:3001/auth | ||
|
||
Now go to localhost:3001 and click on sign in, you should be taken to your okta tenant where you need to authenticate and then you should be taken to Metabase | ||
|
||
## Containers | ||
|
||
There's a docker-compose.yaml file in the root folder that you can simply raise with "docker compose up" command if you have docker installed. Please remember to complete all the environment variables before starting it |
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,47 @@ | ||
services: | ||
metabase: | ||
build: metabase/. | ||
container_name: metabase_full_app_embedding_demo | ||
hostname: metabase | ||
ports: | ||
- 3000:3000 | ||
environment: | ||
- "MB_SITE_URL=http://localhost:3000" | ||
- "MB_EMBEDDING_APP_ORIGIN=*" | ||
- "MB_ENABLE_EMBEDDING=true" | ||
- "MB_PREMIUM_EMBEDDING_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | ||
- "MB_JWT_ENABLED=true" | ||
- "MB_JWT_IDENTITY_PROVIDER_URI=http://localhost:3001/login" | ||
- "MB_JWT_SHARED_SECRET=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" | ||
networks: | ||
- metanet1 | ||
healthcheck: | ||
test: curl --fail -I http://localhost:3000/api/health || exit 1 | ||
interval: 15s | ||
timeout: 5s | ||
retries: 5 | ||
setup_full_app_embedding_demo: | ||
image: bash:5.1.16 | ||
container_name: setup_full_app_embedding_demo | ||
volumes: | ||
- $PWD/setup:/tmp | ||
networks: | ||
- metanet1 | ||
depends_on: | ||
metabase: | ||
condition: service_healthy | ||
command: sh /tmp/metabase-setup.sh metabase:3000 | ||
okta_jwt_sso: | ||
build: . | ||
container_name: okta_jwt_sso | ||
hostname: webapp | ||
ports: | ||
- 3001:3001 | ||
networks: | ||
- metanet1 | ||
depends_on: | ||
metabase: | ||
condition: service_healthy | ||
networks: | ||
metanet1: | ||
driver: bridge |
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,12 @@ | ||
FROM eclipse-temurin:21-jre | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update && apt-get install -y bash fonts-noto fontconfig curl ca-certificates-java | ||
|
||
ADD https://downloads.metabase.com/enterprise/latest/metabase.jar . | ||
ADD https://raw.githubusercontent.com/metabase/metabase/master/bin/docker/run_metabase.sh . | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["java", "-jar", "metabase.jar"] |
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.
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 is deprecated and will be removed in Metabase 53. Let's change it to the separate env vars for embedding.