Skip to content

Commit 66c0faf

Browse files
committed
Add SPIFFE support
1 parent 1700c5e commit 66c0faf

File tree

15 files changed

+180
-42
lines changed

15 files changed

+180
-42
lines changed

.github/workflows/package.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build-and-release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
submodules: true
16+
fetch-depth: 0
17+
18+
- name: Initialize submodules
19+
run: |
20+
git submodule update --init --recursive
21+
22+
- name: Set up JDK 17
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: '17'
26+
distribution: 'temurin'
27+
cache: maven
28+
29+
- name: Build with Maven
30+
run: mvn clean install
31+
32+
- name: Create release directory
33+
run: mkdir -p release
34+
35+
- name: Copy JAR files
36+
run: |
37+
cp oauth-common/target/kafka-oauth-common-*.jar release/
38+
cp oauth-server/target/kafka-oauth-server-*.jar release/
39+
cp oauth-server-plain/target/kafka-oauth-server-plain-*.jar release/
40+
cp oauth-keycloak-authorizer/target/kafka-oauth-keycloak-authorizer-*.jar release/
41+
cp oauth-client/target/kafka-oauth-client-*.jar release/
42+
cp oauth-common/target/lib/nimbus-jose-jwt-*.jar release/
43+
cp oauth-server/target/lib/json-path-*.jar release/
44+
cp oauth-server/target/lib/json-smart-*.jar release/
45+
cp oauth-server/target/lib/accessors-smart-*.jar release/
46+
cp spiffe-principal-builder/target/k3a-spiffe-principal-builder-*.jar release/
47+
48+
- name: Create zip file
49+
run: |
50+
cd release
51+
zip -r ../oauth.zip ./*
52+
53+
- name: Create tar.gz file
54+
run: |
55+
cd release
56+
tar -czf ../oauth.tar.gz ./*
57+
58+
- name: Create Release
59+
uses: softprops/action-gh-release@v1
60+
with:
61+
files: |
62+
oauth.zip
63+
oauth.tar.gz
64+
generate_release_notes: true
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@ velocity.log
2727
**/.DS_Store
2828

2929
# Kafka log from test suite
30-
testsuite/kafka.log
30+
testsuite/kafka.log
31+
32+
# Ignore overriding of versions
33+
**/pom.xml
34+
**/pom.xml.versionsBackup

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "spiffe-principal-builder"]
2+
path = spiffe-principal-builder
3+
url = https://github.com/statnett/k3a-spiffe-principal-builder.git

examples/consumer/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>io.strimzi</groupId>
88
<artifactId>oauth</artifactId>
99
<relativePath>../../pom.xml</relativePath>
10-
<version>1.0.0-SNAPSHOT</version>
10+
<version>0.16.2</version>
1111
</parent>
1212

1313
<artifactId>kafka-oauth-examples-consumer</artifactId>

examples/producer/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>io.strimzi</groupId>
88
<artifactId>oauth</artifactId>
99
<relativePath>../../pom.xml</relativePath>
10-
<version>1.0.0-SNAPSHOT</version>
10+
<version>0.16.2</version>
1111
</parent>
1212

1313
<artifactId>kafka-oauth-examples-producer</artifactId>

oauth-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.strimzi</groupId>
88
<artifactId>oauth</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
9+
<version>0.16.2</version>
1010
</parent>
1111

1212
<artifactId>kafka-oauth-client</artifactId>

oauth-common/pom.xml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.strimzi</groupId>
88
<artifactId>oauth</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
9+
<version>0.16.2</version>
1010
</parent>
1111

1212
<artifactId>kafka-oauth-common</artifactId>
@@ -65,6 +65,27 @@
6565

6666
<build>
6767
<plugins>
68+
<plugin>
69+
<groupId>org.apache.maven.plugins</groupId>
70+
<artifactId>maven-surefire-plugin</artifactId>
71+
<configuration>
72+
<skipTests>true</skipTests>
73+
</configuration>
74+
</plugin>
75+
<plugin>
76+
<groupId>org.apache.maven.plugins</groupId>
77+
<artifactId>maven-javadoc-plugin</artifactId>
78+
<executions>
79+
<execution>
80+
<goals>
81+
<goal>jar</goal>
82+
</goals>
83+
<configuration>
84+
<failOnError>false</failOnError>
85+
</configuration>
86+
</execution>
87+
</executions>
88+
</plugin>
6889
<plugin>
6990
<groupId>org.apache.maven.plugins</groupId>
7091
<artifactId>maven-dependency-plugin</artifactId>

oauth-common/src/main/java/io/strimzi/kafka/oauth/common/PrincipalExtractor.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,26 +115,12 @@ private String extractUsername(Extractor extractor, JsonNode json) {
115115
if (extractor.getAttributeName() != null) {
116116
String result = getClaimFromJWT(json, extractor.getAttributeName());
117117
if (result != null && !result.isEmpty()) {
118-
// HACK(cypres): Make the username compatible with Kubernetes names
119-
result = result.toLowerCase(Locale.ROOT)
120-
.replace("@", "-at-")
121-
.replaceAll("[^a-z0-9.-]", "-");
122-
if (result.length() > 253) {
123-
result = result.substring(0, 253);
124-
}
125118
return result;
126119
}
127120
} else {
128121
JsonNode queryResult = extractor.getJSONPathQuery().apply(json);
129122
String result = queryResult == null ? null : queryResult.asText().trim();
130123
if (result != null && !result.isEmpty()) {
131-
// HACK(cypres): Make the username compatible with Kubernetes names
132-
result = result.toLowerCase(Locale.ROOT)
133-
.replace("@", "-at-")
134-
.replaceAll("[^a-z0-9.-]", "-");
135-
if (result.length() > 253) {
136-
result = result.substring(0, 253);
137-
}
138124
return result;
139125
}
140126
}

oauth-keycloak-authorizer/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.strimzi</groupId>
88
<artifactId>oauth</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
9+
<version>0.16.2</version>
1010
</parent>
1111

1212
<artifactId>kafka-oauth-keycloak-authorizer</artifactId>

oauth-server-plain/pom.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.strimzi</groupId>
88
<artifactId>oauth</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
9+
<version>0.16.2</version>
1010
</parent>
1111

1212
<artifactId>kafka-oauth-server-plain</artifactId>
@@ -58,6 +58,13 @@
5858
<target>${maven.compiler.target}</target>
5959
</configuration>
6060
</plugin>
61+
<plugin>
62+
<groupId>org.apache.maven.plugins</groupId>
63+
<artifactId>maven-surefire-plugin</artifactId>
64+
<configuration>
65+
<skipTests>true</skipTests>
66+
</configuration>
67+
</plugin>
6168
<plugin>
6269
<groupId>org.apache.maven.plugins</groupId>
6370
<artifactId>maven-dependency-plugin</artifactId>

0 commit comments

Comments
 (0)