From 92e718e10041a6812bdf0d0378c914cfb2a32c0c Mon Sep 17 00:00:00 2001 From: Poom Date: Sat, 12 Aug 2023 22:32:25 +0700 Subject: [PATCH] feat: Add example build for Okta authentication --- Dockerfile | 24 ++++++++++++++++++++++++ build.sh | 2 ++ example/config/application-test.yml | 23 +++++++++++++++++++++++ example/entrypoint.sh | 14 ++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 Dockerfile create mode 100755 build.sh create mode 100644 example/config/application-test.yml create mode 100644 example/entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..8fee1005173 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM azul/zulu-openjdk-alpine@sha256:a36679ac0d28cb835e2a8c00e1e0d95509c6c51c5081c7782b85edb1f37a771a + +RUN apk add --no-cache \ + # snappy codec + gcompat \ + # configuring timezones + tzdata \ + # bash + bash + +RUN mkdir -p /app/kafka-ui + +COPY example/config /app/kafka-ui/config +COPY example/entrypoint.sh /app/kafka-ui/entrypoint.sh +COPY kafka-ui-api/target/kafka-ui-api-0.0.1-SNAPSHOT.jar /app/kafka-ui/kafka-ui-api.jar + +RUN chmod +x /app/kafka-ui/entrypoint.sh + +EXPOSE 8080 + +WORKDIR /app/kafka-ui + +ENTRYPOINT ["./entrypoint.sh"] + diff --git a/build.sh b/build.sh new file mode 100755 index 00000000000..d82c3c0e37f --- /dev/null +++ b/build.sh @@ -0,0 +1,2 @@ +#!/bin/bash +./mvnw -pl kafka-ui-api -am -Dmaven.test.skip=true -Ddocker.skip=true -Dcheckstyle.skip clean package -Pprod diff --git a/example/config/application-test.yml b/example/config/application-test.yml new file mode 100644 index 00000000000..113f20a4393 --- /dev/null +++ b/example/config/application-test.yml @@ -0,0 +1,23 @@ +auth: + type: OAUTH2 + oauth2: + client: + okta: + clientId: + clientSecret: + scope: [ 'openid', 'profile', 'email', 'groups' ] + client-name: Okta + provider: okta + redirect-uri: "{baseUrl}/login/oauth2/code/okta" + authorization-grant-type: authorization_code + issuer-uri: https:// + authorization-uri: /oauth2/v1/authorize + token-uri: /oauth2/v1/token + user-info-uri: /oauth2/v1/userinfo + jwk-set-uri: /oauth2/v1/keys + user-name-attribute: email + custom-params: + type: oauth + roles-field: groups +server: + port: 8080 diff --git a/example/entrypoint.sh b/example/entrypoint.sh new file mode 100644 index 00000000000..8e32c2731da --- /dev/null +++ b/example/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Configure proxy Java options +PROXY_JAVA_OPTS='' +if [[ -n $PROXY_HOST && -n $PROXY_PORT ]]; then + PROXY_JAVA_OPTS="$PROXY_JAVA_OPTS -Dhttp.proxyHost=$PROXY_HOST -Dhttp.proxyPort=$PROXY_PORT -Dhttps.proxyHost=$PROXY_HOST -Dhttps.proxyPort=$PROXY_PORT" +fi +if [[ -n $NON_PROXY_HOSTS ]]; then + PROXY_JAVA_OPTS="$PROXY_JAVA_OPTS -Dhttp.nonProxyHosts=$NON_PROXY_HOSTS -Dhttps.nonProxyHosts=$NON_PROXY_HOSTS" +fi + +CMD="java --add-opens java.rmi/javax.rmi.ssl=ALL-UNNAMED $PROXY_JAVA_OPTS -jar -Dspring.profiles.active=test kafka-ui-api.jar" +echo "Starting Kafka UI with command : $CMD" + +eval "exec $CMD"