Skip to content

Commit e92bc21

Browse files
committed
fixed init container / added storing artifacts in github releases / other minor fixes
1 parent 6147a9f commit e92bc21

File tree

14 files changed

+92
-29
lines changed

14 files changed

+92
-29
lines changed

.run/debug-in-docker.run.xml renamed to .github/debug-in-docker.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="debug-in-docker" type="Remote">
3-
<module name="keycloak-user-attribute-authenticator" />
3+
<module name="keycloak-username-password-attribute-authenticator" />
44
<option name="USE_SOCKET_TRANSPORT" value="true" />
55
<option name="SERVER_MODE" value="false" />
66
<option name="SHMEM_ADDRESS" />

.github/workflows/automation_tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14+
1415
- name: Set up JDK 11
1516
uses: actions/setup-java@v2
1617
with:
1718
java-version: '11'
1819
distribution: 'adopt'
20+
1921
- name: Build authenticator jar file
2022
run: mvn -B -ntp package
21-
- name: Build test Docker container
22-
run: docker build -f src/main/docker/dev.Dockerfile -t kilmajster/keycloak-with-authenticator:test .
23+
24+
- name: Build test docker container
25+
run: docker-compose build
26+
2327
- name: Run Selenide tests
2428
run: mvn -B -ntp test -P automation-tests -D headless=true

.github/workflows/publish.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2
12+
1213
- name: Set up Maven Central Repository
1314
uses: actions/setup-java@v2
1415
with:
@@ -17,16 +18,21 @@ jobs:
1718
server-id: ossrh
1819
server-username: MAVEN_USERNAME
1920
server-password: MAVEN_PASSWORD
20-
- name: Build project
21+
22+
- name: Build a project
2123
run: mvn -B -ntp package
24+
2225
- name: Get the tag name
2326
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
27+
2428
- name: Set version from git tag
2529
run: mvn -B -ntp versions:set -DgenerateBackupPoms=false -DnewVersion="$TAG"
26-
- name: Import gpg secret key
30+
31+
- name: Import GPG key
2732
run: |
2833
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
2934
gpg --list-secret-keys --keyid-format LONG
35+
3036
- name: Publish maven package
3137
run: |
3238
mvn \
@@ -38,20 +44,33 @@ jobs:
3844
env:
3945
MAVEN_USERNAME: kilmajster
4046
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
47+
48+
- name: Add jar to github release
49+
uses: svenstaro/upload-release-action@v2
50+
with:
51+
repo_token: ${{ secrets.GITHUB_TOKEN }}
52+
file: target/keycloak-username-password-attribute-authenticator-${{ github.ref }}.jar
53+
asset_name: keycloak-username-password-attribute-authenticator-${{ github.ref }}.jar
54+
tag: ${{ github.ref }}
55+
4156
- name: Build docker init container
4257
run: |
4358
echo "Building docker image = kilmajster/keycloak-username-password-attribute-authenticator:$TAG" && \
4459
docker build \
60+
--build-arg VERSION="$TAG" \
4561
-f src/main/docker/initContainer.Dockerfile \
4662
-t kilmajster/keycloak-username-password-attribute-authenticator:"$TAG" \
4763
-t kilmajster/keycloak-username-password-attribute-authenticator:latest \
4864
.
65+
4966
- name: Log into Docker Hub
5067
uses: docker/login-action@v1
5168
with:
5269
username: kilmajster
5370
password: ${{ secrets.DOCKER_HUB_TOKEN }}
54-
- name: Push tagged image
71+
72+
- name: Push tagged docker image
5573
run: docker push kilmajster/keycloak-username-password-attribute-authenticator:"$TAG"
56-
- name: Push latest image
74+
75+
- name: Push latest docker image
5776
run: docker push kilmajster/keycloak-username-password-attribute-authenticator:latest

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ hs_err_pid*
2424
/build/
2525
/keycloak-username-password-attribute-authenticator.iml
2626
/.idea/
27-
/target/
27+
/target/

README.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
## Description
99
Keycloak default login form with user attribute validation.
1010

11-
## Using
11+
## How 2 use
1212
### using jar
1313
### using docker init container
14+
```
15+
kilmajster/keycloak-username-password-attribute-authenticator:latest
16+
```
17+
#### example helm chart snippet
1418

1519
## Configuration
1620
### Authenticator config
17-
#### config via Keycloak UI
21+
#### config via Keycloak UI / API
1822
- login_form_user_attribute
1923
- login_form_generate_label
2024
- login_form_attribute_label
@@ -28,16 +32,31 @@ Keycloak default login form with user attribute validation.
2832
#### Using bundled default keycloak theme
2933
#### Extending own theme
3034

31-
## docker
32-
### example in docker-compose
35+
-------------------------------------
36+
### Development
37+
#### build the project
3338
```shell
34-
$ docker-compose up --build --force-recreate
39+
$ mvn package
3540
```
36-
http://localhost:8081/auth/realms/dev-realm/account
37-
41+
#### run with docker-compose
42+
```shell
43+
$ docker-compose up --build
44+
```
45+
http://localhost:8081/auth/realms/dev-realm/account
46+
##### debug in docker with IntelliJ
47+
`.github/debug-in-docker.run.xml`
3848

39-
### init container
49+
#### automation tests
50+
##### build test docker image
51+
```shell
52+
$ docker-compose build
4053
```
41-
kilmajster/keycloak-username-password-attribute-authenticator:latest
54+
##### running tests with chrome
55+
```shell
56+
$ mvn test -P automation-tests
57+
```
58+
##### running tests in docker
59+
```shell
60+
$ mvn test -P automation-tests -D headless=true
4261
```
4362

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
- 8081:8080
1212
- 8787:8787
1313
volumes:
14-
- ./src/main/resources/dev-realm.json:/tmp/dev-realm.json
14+
- ./src/test/resources/dev-realm.json:/tmp/dev-realm.json
1515
environment:
1616
DEBUG: 'true'
1717
DEBUG_PORT: '*:8787'

src/main/docker/dev.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
FROM quay.io/keycloak/keycloak:latest
22

3-
ADD target/keycloak-username-password-attribute-authenticator-*.jar /opt/jboss/keycloak/standalone/deployments
3+
ADD target/keycloak-username-password-attribute-authenticator-SNAPSHOT.jar /opt/jboss/keycloak/standalone/deployments
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
FROM busybox
22

3-
COPY target/keycloak-username-password-attribute-authenticator-*.jar /opt/jboss/keycloak/standalone/deployments/
3+
ARG VERSION
4+
5+
COPY target/keycloak-username-password-attribute-authenticator-${VERSION}.jar /opt/jboss/keycloak/standalone/deployments/

src/main/resources/theme/base-with-attribute/login/login.ftl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@
4141
<#else>
4242
${msg("login_form_attribute_label_default")}
4343
</#if>
44-
</label>
44+
</label>
4545

46-
<input tabindex="3" id="login_form_user_attribute" class="${properties.kcInputClass!}" name="login_form_user_attribute" type="text" autocomplete="off"
47-
aria-invalid="<#if messagesPerField.existsError('username','password')>true</#if>"
46+
<input tabindex="3" id="login_form_user_attribute" class="${properties.kcInputClass!}"
47+
name="login_form_user_attribute" type="text" autocomplete="off"
48+
aria-invalid="<#if messagesPerField.existsError('login_form_user_attribute')>true</#if>"
4849
/>
4950
</div>
5051
<!-- keycloak-user-attribute-authenticator custom code block end -->

src/test/java/io.github.kilmajster.keycloak/UsernamePasswordAttributeFormAT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ public class UsernamePasswordAttributeFormAT extends BaseKeycloakInDockerAT {
2121

2222
@Test
2323
public void shouldLogIntoAccountConsole() {
24-
final String url = getKeycloakBaseUrl(keycloak.getFirstMappedPort());
24+
final String keycloakBaseUrl = getKeycloakBaseUrl(keycloak);
2525

26-
go_to_keycloak_account_page(url);
26+
go_to_keycloak_account_page(keycloakBaseUrl);
2727
click_sign_in_button();
2828
verify_login_form_is_displayed_with_user_attribute_label("Test attr");
2929
log_into_account_console();

0 commit comments

Comments
 (0)