Skip to content

Commit

Permalink
Update to Keycloak 17.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jacekkow committed Mar 9, 2022
1 parent f4c9ba0 commit de93e7b
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 78 deletions.
68 changes: 33 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ jobs:
steps:
- id: checkout
name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install Java and Maven
uses: actions/setup-java@v1
- id: java
name: Install Java and Maven
uses: actions/setup-java@v2
with:
java-version: 8
distribution: zulu
java-version: 11

- id: vars
name: Get project variables
Expand All @@ -36,10 +38,11 @@ jobs:
mvn -B test package
- name: Upload artifact
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: jar
path: target/${{ steps.vars.outputs.artifactId }}-${{ steps.vars.outputs.projectVersion }}.jar
if-no-files-found: error

outputs:
artifact_id: ${{ steps.vars.outputs.artifactId }}
Expand All @@ -51,54 +54,49 @@ jobs:
name: Test
runs-on: ubuntu-latest
needs: build
services:
keycloak:
image: quay.io/keycloak/keycloak:${{ needs.build.outputs.keycloak_version }}
env:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
ports:
- 8080:8080
volumes:
- '${{ github.workspace }}:/workspace'
steps:
- id: checkout
name: Checkout code
uses: actions/checkout@v2

- id: download_artifact
name: Download artifact
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: jar

- id: create_container
name: Create Keycloak container
run: |
docker run -i -t -d -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin -p 8080:8080 --name keycloak "quay.io/keycloak/keycloak:${{ needs.build.outputs.keycloak_version }}" start-dev
- id: deploy
name: Deploy artifact
run: |
CONTAINER="${{ job.services.keycloak.id }}"
CONTAINER="keycloak"
NAME="${{ needs.build.outputs.artifact_id }}-${{ needs.build.outputs.project_version }}.jar"
FILE="/opt/jboss/keycloak/standalone/deployments/${NAME}"
docker cp "jar/${NAME}" "${CONTAINER}:/tmp/"
docker exec -i "${CONTAINER}" /bin/bash <<EOF
cp "/tmp/${NAME}" "${FILE}"
for i in {1..60}; do
echo -n .
[ -f "${FILE}.deployed" ] && echo && echo "Deployment succeeded!" && exit 0
[ -f "${FILE}.failed" ] && echo && echo "Deployment failed!" && exit 1
sleep 1
done
echo && echo "Deployment timeout!" && exit 1
EOF
FILE="/opt/keycloak/providers/${NAME}"
docker cp "${NAME}" "${CONTAINER}:${FILE}"
docker restart "${CONTAINER}"
for i in {1..60}; do
if curl --silent --max-time 1 -o /dev/null http://localhost:8080; then
echo && echo "Deployment succeeded!" && exit 0
else
sleep 1
echo -n "."
fi
done
echo && echo "Deployment timeout!" && exit 1
- id: configure_keycloak
name: Configure Keycloak
run: |
CONTAINER="${{ job.services.keycloak.id }}"
CONTAINER="keycloak"
docker exec -i "${CONTAINER}" /bin/bash <<EOF
/opt/jboss/keycloak/bin/kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password admin
/opt/jboss/keycloak/bin/kcadm.sh create clients -r master -s clientId=test -s protocol=cas -s enabled=true -s publicClient=true \
/opt/keycloak/bin/kcadm.sh config credentials --server http://localhost:8080 --realm master --user admin --password admin
/opt/keycloak/bin/kcadm.sh create clients -r master -s clientId=test -s protocol=cas -s enabled=true -s publicClient=true \
-s 'redirectUris=["http://localhost/*"]' -s baseUrl=http://localhost -s adminUrl=http://localhost
/opt/jboss/keycloak/bin/kcadm.sh get serverinfo -r master --fields "providers(login-protocol(providers(cas)))" | grep cas
/opt/keycloak/bin/kcadm.sh get serverinfo -r master --fields "providers(login-protocol(providers(cas)))" | grep cas
EOF
- id: run_tests
Expand All @@ -113,7 +111,7 @@ jobs:
steps:
- id: download_artifact
name: Download artifact
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: jar

Expand All @@ -135,6 +133,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: jar/${{ needs.build.outputs.artifact_id }}-${{ needs.build.outputs.project_version }}.jar
asset_path: ${{ needs.build.outputs.artifact_id }}-${{ needs.build.outputs.project_version }}.jar
asset_name: ${{ needs.build.outputs.artifact_id }}-${{ needs.build.outputs.project_version }}.jar
asset_content_type: application/java-archive
64 changes: 31 additions & 33 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ jobs:
steps:
- id: checkout
name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install Java and Maven
uses: actions/setup-java@v1
- id: java
name: Install Java and Maven
uses: actions/setup-java@v2
with:
java-version: 8
distribution: zulu
java-version: 11

- id: vars
name: Get project variables
Expand All @@ -34,10 +36,11 @@ jobs:
mvn -B test package
- name: Upload artifact
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: jar
path: target/${{ steps.vars.outputs.artifactId }}-${{ steps.vars.outputs.projectVersion }}.jar
if-no-files-found: error

outputs:
artifact_id: ${{ steps.vars.outputs.artifactId }}
Expand All @@ -49,54 +52,49 @@ jobs:
name: Test
runs-on: ubuntu-latest
needs: build
services:
keycloak:
image: quay.io/keycloak/keycloak:${{ needs.build.outputs.keycloak_version }}
env:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
ports:
- 8080:8080
volumes:
- '${{ github.workspace }}:/workspace'
steps:
- id: checkout
name: Checkout code
uses: actions/checkout@v2

- id: download_artifact
name: Download artifact
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: jar

- id: create_container
name: Create Keycloak container
run: |
docker run -i -t -d -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin -p 8080:8080 --name keycloak "quay.io/keycloak/keycloak:${{ needs.build.outputs.keycloak_version }}" start-dev
- id: deploy
name: Deploy artifact
run: |
CONTAINER="${{ job.services.keycloak.id }}"
CONTAINER="keycloak"
NAME="${{ needs.build.outputs.artifact_id }}-${{ needs.build.outputs.project_version }}.jar"
FILE="/opt/jboss/keycloak/standalone/deployments/${NAME}"
docker cp "jar/${NAME}" "${CONTAINER}:/tmp/"
docker exec -i "${CONTAINER}" /bin/bash <<EOF
cp "/tmp/${NAME}" "${FILE}"
for i in {1..60}; do
echo -n .
[ -f "${FILE}.deployed" ] && echo && echo "Deployment succeeded!" && exit 0
[ -f "${FILE}.failed" ] && echo && echo "Deployment failed!" && exit 1
sleep 1
done
echo && echo "Deployment timeout!" && exit 1
EOF
FILE="/opt/keycloak/providers/${NAME}"
docker cp "${NAME}" "${CONTAINER}:${FILE}"
docker restart "${CONTAINER}"
for i in {1..60}; do
if curl --silent --max-time 1 -o /dev/null http://localhost:8080; then
echo && echo "Deployment succeeded!" && exit 0
else
sleep 1
echo -n "."
fi
done
echo && echo "Deployment timeout!" && exit 1
- id: configure_keycloak
name: Configure Keycloak
run: |
CONTAINER="${{ job.services.keycloak.id }}"
CONTAINER="keycloak"
docker exec -i "${CONTAINER}" /bin/bash <<EOF
/opt/jboss/keycloak/bin/kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password admin
/opt/jboss/keycloak/bin/kcadm.sh create clients -r master -s clientId=test -s protocol=cas -s enabled=true -s publicClient=true \
/opt/keycloak/bin/kcadm.sh config credentials --server http://localhost:8080 --realm master --user admin --password admin
/opt/keycloak/bin/kcadm.sh create clients -r master -s clientId=test -s protocol=cas -s enabled=true -s publicClient=true \
-s 'redirectUris=["http://localhost/*"]' -s baseUrl=http://localhost -s adminUrl=http://localhost
/opt/jboss/keycloak/bin/kcadm.sh get serverinfo -r master --fields "providers(login-protocol(providers(cas)))" | grep cas
/opt/keycloak/bin/kcadm.sh get serverinfo -r master --fields "providers(login-protocol(providers(cas)))" | grep cas
EOF
- id: run_tests
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/update-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ jobs:
steps:
- id: checkout
name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- id: java
name: Install Java and Maven
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 8
distribution: zulu
java-version: 11

- id: update_keycloak
name: Update Keycloak
Expand Down Expand Up @@ -87,7 +88,7 @@ jobs:
- id: create_pull_request_default_token
name: Create pull request
if: steps.check_branch.outputs.commit == ''
uses: actions/github-script@0.9.0
uses: actions/github-script@v6
with:
github-token: ${{ env.GH_TOKEN }}
script: |
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ As a rule of thumb plugin version should **match your Keycloak version**.

## Installation

Installation of a compatible plugin version is simple and can be done without a Keycloak server restart.
Quarkus is the default distribution method of Keycloak 17.0.0 and newer. For legacy installations using WildFly, please refer to the [old README](https://github.com/jacekkow/keycloak-protocol-cas/blob/16.1.1/README.md).

1. Download the latest release compatible with your Keycloak version from the [releases page](https://github.com/jacekkow/keycloak-protocol-cas/releases).
2. Copy the JAR file into the `standalone/deployments` directory in your Keycloak server's root.
2. Put the downloaded JAR file into the `providers/` directory inside Keycloak installation folder.
3. Stop the Keycloak server.
4. (Re-)build the installation using `kc.sh build` command.
5. Start the Keycloak: `kc.sh start`

Remember to update plugin artifact with each Keycloak server upgrade!

Expand All @@ -43,7 +46,7 @@ To use the new protocol, you have to create a client within Keycloak as usual, s
As there is no client ID indication in protocol, the client will be identified by the redirect URIs
configured in Keycloak.

Enter `https://your.keycloak.host/auth/realms/master/protocol/cas` as the CAS URL into your SP.
Enter `https://your.keycloak.host/realms/master/protocol/cas` as the CAS URL into your SP.
This assumes that you use the default `master` realm - if not, modify the URL accordingly.

Note that some client implementations require you to enter login and validate URLs, not CAS URL!
Expand Down
2 changes: 1 addition & 1 deletion integrationTest/suite.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

keycloak_cas_url='http://localhost:8080/auth/realms/master/protocol/cas'
keycloak_cas_url='http://localhost:8080/realms/master/protocol/cas'
action_pattern='action="([^"]+)"'
ticket_pattern='Location: .*\?ticket=(ST-[-A-Za-z0-9_.=]+)'

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@

<groupId>org.keycloak</groupId>
<artifactId>keycloak-protocol-cas</artifactId>
<version>16.1.1</version>
<version>17.0.0</version>
<name>Keycloak CAS Protocol</name>
<description />

<properties>
<keycloak.version>${project.version}</keycloak.version>
<jboss.logging.version>3.4.1.Final</jboss.logging.version>
<jboss.logging.version>3.4.3.Final</jboss.logging.version>
<jboss.logging.tools.version>2.2.1.Final</jboss.logging.tools.version>
<junit.version>4.13.2</junit.version>

Expand Down

0 comments on commit de93e7b

Please sign in to comment.