Skip to content

Commit

Permalink
feat: Add example build for Okta authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
poom-kitti committed Aug 12, 2023
1 parent b32ab01 commit 92e718e
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./mvnw -pl kafka-ui-api -am -Dmaven.test.skip=true -Ddocker.skip=true -Dcheckstyle.skip clean package -Pprod
23 changes: 23 additions & 0 deletions example/config/application-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
auth:
type: OAUTH2
oauth2:
client:
okta:
clientId: <client-id>
clientSecret: <client-secret>
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://<okta-endpoint>
authorization-uri: <okta-endpoint>/oauth2/v1/authorize
token-uri: <okta-endpoint>/oauth2/v1/token
user-info-uri: <okta-endpoint>/oauth2/v1/userinfo
jwk-set-uri: <okta-endpoint>/oauth2/v1/keys
user-name-attribute: email
custom-params:
type: oauth
roles-field: groups
server:
port: 8080
14 changes: 14 additions & 0 deletions example/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 92e718e

Please sign in to comment.