-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from pjgg/feat/upgrade_keycloak
Upgrade keycloak to version 18.0.0
- Loading branch information
Showing
29 changed files
with
657 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
examples/keycloak/src/test/java/io/quarkus/qe/LegacyKeycloakIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package io.quarkus.qe; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.keycloak.authorization.client.AuthzClient; | ||
|
||
import io.quarkus.test.bootstrap.KeycloakService; | ||
import io.quarkus.test.bootstrap.RestService; | ||
import io.quarkus.test.scenarios.QuarkusScenario; | ||
import io.quarkus.test.services.Container; | ||
import io.quarkus.test.services.QuarkusApplication; | ||
|
||
@QuarkusScenario | ||
public class LegacyKeycloakIT { | ||
|
||
static final String REALM_DEFAULT = "test-realm"; | ||
static final String CLIENT_ID_DEFAULT = "test-application-client"; | ||
static final String CLIENT_SECRET_DEFAULT = "test-application-client-secret"; | ||
static final String NORMAL_USER = "test-normal-user"; | ||
|
||
@Container(image = "quay.io/keycloak/keycloak:14.0.0", expectedLog = "Admin console listening", port = 8080) | ||
static KeycloakService keycloak = new KeycloakService("/keycloak-realm.json", REALM_DEFAULT, "/auth/realms/"); | ||
|
||
private AuthzClient authzClient; | ||
|
||
@QuarkusApplication | ||
static final RestService app = new RestService() | ||
.withProperty("quarkus.oidc.auth-server-url", () -> keycloak.getRealmUrl()) | ||
.withProperty("quarkus.oidc.client-id", CLIENT_ID_DEFAULT) | ||
.withProperty("quarkus.oidc.credentials.secret", CLIENT_SECRET_DEFAULT); | ||
|
||
@BeforeEach | ||
public void setup() { | ||
authzClient = keycloak.createAuthzClient(CLIENT_ID_DEFAULT, CLIENT_SECRET_DEFAULT); | ||
} | ||
|
||
@Test | ||
public void checkUserResourceByNormalUser() { | ||
app.given() | ||
.auth().oauth2(getTokenByTestNormalUser()) | ||
.get("/user") | ||
.then() | ||
.statusCode(200) | ||
.body(equalTo("Hello, user test-normal-user")); | ||
} | ||
|
||
private String getTokenByTestNormalUser() { | ||
return authzClient.obtainAccessToken(NORMAL_USER, NORMAL_USER).getToken(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
examples/keycloak/src/test/java/io/quarkus/qe/OpenShiftUsingExtensionLegacyKeycloakIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.quarkus.qe; | ||
|
||
import io.quarkus.test.scenarios.OpenShiftDeploymentStrategy; | ||
import io.quarkus.test.scenarios.OpenShiftScenario; | ||
|
||
@OpenShiftScenario(deployment = OpenShiftDeploymentStrategy.UsingOpenShiftExtension) | ||
public class OpenShiftUsingExtensionLegacyKeycloakIT extends LegacyKeycloakIT { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.