Skip to content

Commit

Permalink
Quickstarts - Wildfly upgrade and README cleanup
Browse files Browse the repository at this point in the history
closes #505

Signed-off-by: mposolda <mposolda@gmail.com>
  • Loading branch information
mposolda authored and pedroigor committed Nov 14, 2023
1 parent 715613f commit 7578786
Show file tree
Hide file tree
Showing 17 changed files with 84 additions and 54 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ First clone the Keycloak repository:
Each quickstart provides its own documentation with the steps you need to follow in order to build, test, and run the example.
Look at the `README.md` file at the root of a quickstart for more details.

### Chrome driver version

Some automated tests rely on the chrome browser present on your laptop. Also you need to have correct version of chrome driver according
to the version of the chrome browser used. In case of the issues, see [Chrome page](https://googlechromelabs.github.io/chrome-for-testing/) and download
correct chrome driver version for your Chrome browser. Then add system property `webdriver.chrome.driver` when running the tests according to chrome version
and add whole path to the chrome driver. For instance something like `-Dwebdriver.chrome.driver=/somedir/chromedriver-linux64-119.0.6045.105/chromedriver`.

## Help and Documentation

* [Documentation](https://www.keycloak.org/documentation.html)
Expand Down
6 changes: 3 additions & 3 deletions extension/action-token-authenticator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ a configuration of a single custom SPI implemented in this example:
is used in step 5 to verify that the invocation comes from the correct app.

NOTE: In production environment, you don't need to use the "confidential" parameters sent in the server startup command. It might be better
to use configuration properties file for it, or even use the Keycloak Valve capabilities. See the Keycloak documentation for more details about provider
options and for the details about how to use the valve.
to use configuration properties file for it, or even use the Keycloak Vault capabilities. See the Keycloak documentation for more details about provider
options and for the details about how to use the vault.

The custom authenticator is configured in admin console within the flow that uses it:

Expand Down Expand Up @@ -102,7 +102,7 @@ You can download latest Wildfly server. If you run the mvn command as described
We also need to deploy simple WAR application to it and start the server. In Linux, the commands to do all of that could be for example like this:

```
export WILDFY_VERSION=wildfly-28.0.0.Beta1
export WILDFY_VERSION=wildfly-28.0.1.Final
cp -r target/$WILDFY_VERSION /tmp/
cp target/deployments/wildfly_action-token-responder-example_action-token-responder-example.war /tmp/$WILDFY_VERSION/standalone/deployments/action-token-responder-example.war
cd /tmp/$WILDFY_VERSION/bin
Expand Down
4 changes: 2 additions & 2 deletions extension/action-token-required-action/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ a configuration of two custom SPIs implemented in this example:

NOTE: In production environment, you don't need to use the "confidential" parameters sent in the server startup command, which in this case
applies especially for the `hmac-secret` configuration parameter. It might be better to use configuration properties file for it, or even use
the Keycloak Valve capabilities. See the Keycloak documentation for more details about provider options and for the details about how to use the valve.
the Keycloak Vault capabilities. See the Keycloak documentation for more details about provider options and for the details about how to use the vault.

Note that you need to deploy the responder application into WildFly. A sample responder
application is part of the tests, so you first need to run the tests in order to have the WAR archive
Expand Down Expand Up @@ -101,7 +101,7 @@ You can download latest Wildfly server. If you run the mvn command as described
We also need to deploy simple WAR application to it and start the server. In Linux, the commands to do all of that could be for example like this:

```
export WILDFY_VERSION=wildfly-28.0.0.Beta1
export WILDFY_VERSION=wildfly-28.0.1.Final
cp -r target/$WILDFY_VERSION /tmp/
cp target/deployments/wildfly_action-token-responder-example_action-token-responder-example.war /tmp/$WILDFY_VERSION/standalone/deployments/action-token-responder-example.war
cd /tmp/$WILDFY_VERSION/bin
Expand Down
8 changes: 4 additions & 4 deletions extension/event-listener-sysout/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ System Requirements

You need to have <span>Keycloak</span> running. It is recommended to use Keycloak 22 or later.

All you need to build this project is Java 11 (Java SDK 11) or later and Maven 3.6.3 or later.
All you need to build this project is Java 17 (Java SDK 17) or later and Maven 3.6.3 or later.

Build and Deploy the Quickstart
-------------------------------

To build the provider, run the following maven command:

````
mvn -Pextension clean install
mvn -Pextension clean install -DskipTests=true
````

To install the provider, copy the target/event-listener-sysout.jar JAR file to the `providers` directory of the server distribution.
Expand All @@ -57,8 +57,8 @@ Integration test of the Quickstart
Your <span>Keycloak</span> should be listening on `http://localhost:8180` and should have excluded events configured (at least `CODE_TO_TOKEN).
See in the previous section how the startup command for the server should look like.

2. You need to have Chrome browser installed and updated to the latest version.
3. Run `mvn clean install -Djakarta`
2. You need to have Chrome browser installed and updated to the latest version. See [README](../../README.md#chrome-driver-version) for additional details.
3. Run `mvn clean install -Dextension`

Undeploy the quickstart
-----------------------
Expand Down
8 changes: 4 additions & 4 deletions extension/event-store-mem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ System Requirements

You need to have <span>Keycloak</span> running. It is recommended to use Keycloak 22 or later.

All you need to build this project is Java 11 (Java SDK 11) or later and Maven 3.6.3 or later.
All you need to build this project is Java 17 (Java SDK 17) or later and Maven 3.6.3 or later.


Build and Deploy the Quickstart
Expand All @@ -43,7 +43,7 @@ Build and Deploy the Quickstart
To build the provider, run the following maven command:

````
mvn -Pextension clean install
mvn -Pextension clean install -DskipTests=true
````

To install the provider, copy the target/event-store-mem.jar JAR file to the `providers` directory of the server distribution.
Expand Down Expand Up @@ -73,8 +73,8 @@ Integration test of the Quickstart
Your <span>Keycloak</span> should be listening on `http://localhost:8180` and should have set `in-mem` as the default `eventsStore` provider.
See in the previous section how the startup command for the server should look like.

2. You need to have Chrome browser installed and updated to the latest version.
3. Run `mvn clean install -Djakarta`
2. You need to have Chrome browser installed and updated to the latest version. See [README](../../README.md#chrome-driver-version) for additional details.
3. Run `mvn clean install -Dextension`


Undeploy the quickstart
Expand Down
8 changes: 4 additions & 4 deletions extension/extend-account-console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ System Requirements

You need to have <span>Keycloak</span> running. It is recommended to use Keycloak 22 or later.

All you need to build this project is Java 11 (Java SDK 11) or later and Maven 3.6.3 or later.
All you need to build this project is Java 17 (Java SDK 17) or later and Maven 3.6.3 or later.

If you want to do the JSX example, you will need to install npm on your system.

Expand All @@ -38,7 +38,7 @@ Configuration in <span>Keycloak</span>
To build the provider, run the following maven command:

````
mvn -Pextension clean install
mvn -Pextension clean install -DskipTests=true
````

To install the provider, copy the `target/keycloak-man-theme.jar` JAR file to the `providers` directory of the server distribution.
Expand Down Expand Up @@ -67,5 +67,5 @@ Integration test of the Quickstart
./kc.sh start-dev --http-port=8180
```

2. You need to have Chrome browser installed and updated to the latest version.
3. Run `mvn clean install -Djakarta`
2. You need to have Chrome browser installed and updated to the latest version. See [README](../../README.md#chrome-driver-version) for additional details.
3. Run `mvn clean install -Dextension`
8 changes: 4 additions & 4 deletions extension/user-storage-jpa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ System Requirements

You need to have <span>Keycloak</span> running. It is recommended to use Keycloak 22 or later.

All you need to build this project is Java 11 (Java SDK 11) or later and Maven 3.6.3 or later.
All you need to build this project is Java 17 (Java SDK 17) or later and Maven 3.6.3 or later.

Build and Deploy the Quickstart
-------------------------------
Expand All @@ -36,7 +36,7 @@ you make sure the persistence unit will be using the correct datasource.
To build the provider, run the following maven command:

````
mvn -Pextension clean install
mvn -Pextension clean install -DskipTests=true
````

To install the provider, copy the target/user-storage-jpa-example.jar JAR file to the `providers` directory of the server distribution.
Expand All @@ -61,8 +61,8 @@ Integration test of the Quickstart
./kc.sh start-dev --http-port=8180
```

2. You need to have Chrome browser installed and updated to the latest version.
3. Run `mvn clean install -Djakarta`
2. You need to have Chrome browser installed and updated to the latest version. See [README](../../README.md#chrome-driver-version) for additional details.
3. Run `mvn clean install -Dextension`

More Information
----------------
Expand Down
8 changes: 4 additions & 4 deletions extension/user-storage-simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ System Requirements

You need to have <span>Keycloak</span> running. It is recommended to use Keycloak 22 or later.

All you need to build this project is Java 11 (Java SDK 11) or later and Maven 3.6.3 or later.
All you need to build this project is Java 17 (Java SDK 17) or later and Maven 3.6.3 or later.


Build and Deploy the Quickstart
Expand All @@ -42,7 +42,7 @@ Build and Deploy the Quickstart
To build the provider, run the following maven command:

````
mvn -Pextension clean install
mvn -Pextension clean install -DskipTests=true
````

To install the provider, copy the target/user-storage-properties-example.jar JAR file to the `providers` directory of the server distribution.
Expand Down Expand Up @@ -76,8 +76,8 @@ Integration test of the Quickstart
./kc.sh start-dev --http-port=8180
```

2. You need to have Chrome browser installed and updated to the latest version.
3. Run `mvn clean install -Djakarta`
2. You need to have Chrome browser installed and updated to the latest version. See [README](../../README.md#chrome-driver-version) for additional details.
3. Run `mvn clean install -Dextension`

More Information
----------------
Expand Down
10 changes: 5 additions & 5 deletions jakarta/jaxrs-resource-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ Access the Quickstart

There are 3 endpoints exposed by the service:

* http://localhost:8080/service/public - requires no authentication
* http://localhost:8080/service/secured - can be invoked by users with the `user` role
* http://localhost:8080/service/admin - can be invoked by users with the `admin` role
* http://localhost:8080/jakarta-jaxrs-resource-server/public - requires no authentication
* http://localhost:8080/jakarta-jaxrs-resource-server/secured - can be invoked by users with the `user` role
* http://localhost:8080/jakarta-jaxrs-resource-server/admin - can be invoked by users with the `admin` role

You can open the public endpoint directly in the browser to test the service. The two other endpoints are protected and require
invoking them with a bearer token.
Expand All @@ -89,7 +89,7 @@ You should be able to obtain tokens for any of these users:
| alice | alice | user |
| admin | admin | admin |

To obtain the bearer token, run the following command:
To obtain the bearer token, run for instance the following command when on Linux (please make sure to have `curl` and `jq` packages available in your linux distribution):

```shell
export access_token=$(\
Expand All @@ -102,7 +102,7 @@ curl -X POST http://localhost:8180/realms/quickstart/protocol/openid-connect/tok

You can use the same command to obtain tokens on behalf of user `admin`, just make sure to change both `username` and `password` request parameters.

After running the command above, you can now access the `http://localhost:8080/service/secured` endpoint
After running the command above, you can now access the `http://localhost:8080/jakarta-jaxrs-resource-server/secured` endpoint
because the user `alice` has the `user` role.

```shell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"realm": "quickstart",
"auth-server-url": "http://localhost:8180",
"ssl-required": "external",
"resource": "service-jaxrs",
"resource": "jakarta-jaxrs-resource-server",
"bearer-only": true
}
9 changes: 5 additions & 4 deletions jakarta/jaxrs-resource-server/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<web-app
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">
<security-constraint>
<web-resource-collection>
<web-resource-name>secured</web-resource-name>
Expand Down
9 changes: 5 additions & 4 deletions jakarta/servlet-authz-client/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<web-app
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">

<security-constraint>
<web-resource-collection>
Expand Down
4 changes: 4 additions & 0 deletions jakarta/servlet-saml-service-provider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ In order to deploy the example application, you need a Wildfly Server up and run

Make sure the server is accessible from `localhost` and listening on port `8080`.

Once you verified that Wildfly server works, it is needed to install SAML adapter into it. You can follow the [SAML Adapter documentation](https://www.keycloak.org/docs/latest/securing_apps/index.html#_saml_jboss_adapter)
for the details. Just make sure that you download Jakarta version of the SAML adapter.
It can be downloaded from the following URL (replace $KC_VERSION with requested Keycloak version) https://repo1.maven.org/maven2/org/keycloak/keycloak-saml-wildfly-adapter-jakarta-dist/$KC_VERSION/keycloak-saml-wildfly-adapter-jakarta-dist-$KC_VERSION.zip .

Build and Deploy the Quickstart
-------------------------------

Expand Down
25 changes: 21 additions & 4 deletions js/spa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Log in as the admin user to access the Keycloak Administration Console. Username
Import the [realm configuration file](config/realm-import.json) to create a new realm called `quickstart`.
For more details, see the Keycloak documentation about how to [create a new realm](https://www.keycloak.org/docs/latest/server_admin/index.html#_create-realm).

Alternatively, you can create the realm using the following command:
Alternatively, you can create the realm using the following command (it might require first to run `npm install`):

```shell
npm run create-realm
Expand Down Expand Up @@ -88,16 +88,33 @@ Once authenticated, you are redirected to the application and you can perform th
Running tests
--------------------

Make sure Keycloak is [running](#starting-and-configuring-the-keycloak-server).
Make sure Keycloak is [running](#starting-and-configuring-the-keycloak-server). At the same time, the `npm` should be stopped, so there is nothing listening on http://localhost:8080 .

1. Open a terminal and navigate to the root directory of this quickstart.
1. The test assumes that `quickstart` realm does not yet exists. If you already imported it as mentioned in previous steps, it may be needed to remove it first.
It can be done by login in admin console, then going to URL like http://localhost:8180/admin/master/console/#/quickstart/realm-settings and then click `Delete` at the `Action` menu on the left top corner.

Alternatively, it can be done by command:
```shell
npm run delete-realm
```

2. Open a terminal and navigate to the root directory of this quickstart.

2. Run the following command to build and run tests:
3. Run the following command to build and run tests:

````
npm test
````

#### Test troubleshooting

If there is error message like `Executable doesn't exist at /home/yournick/.cache/ms-playwright/chromium-1060/chrome-linux/chrome`, it may be needed to first install playwright with this command:

```shell
npx playwright install
```


References
--------------------

Expand Down
12 changes: 6 additions & 6 deletions nodejs/resource-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Log in as the admin user to access the Keycloak Administration Console. Username
Import the [realm configuration file](config/realm-import.json) to create a new realm called `quickstart`.
For more details, see the Keycloak documentation about how to [create a new realm](https://www.keycloak.org/docs/latest/server_admin/index.html#_create-realm).

Alternatively, you can create the realm using the following command:
Alternatively, you can create the realm using the following command (it might require first to run `npm install`)::

```shell
npm run create-realm
Expand All @@ -75,9 +75,9 @@ Access the Quickstart

There are 3 endpoints exposed by the service:

* http://localhost:8080/public - requires no authentication
* http://localhost:8080/secured - can be invoked by users with the `user` role
* http://localhost:8080/admin - can be invoked by users with the `admin` role
* http://localhost:3000/public - requires no authentication
* http://localhost:3000/secured - can be invoked by users with the `user` role
* http://localhost:3000/admin - can be invoked by users with the `admin` role

You can open the public endpoint directly in the browser to test the service. The two other endpoints are protected and require
invoking them with a bearer token.
Expand All @@ -93,7 +93,7 @@ You should be able to obtain tokens for any of these users:
| alice | alice | user |
| admin | admin | admin |

To obtain the bearer token, run the following command:
To obtain the bearer token, run for instance the following command when on Linux (please make sure to have `curl` and `jq` packages available in your linux distribution):

```shell
export access_token=$(\
Expand Down Expand Up @@ -123,7 +123,7 @@ As a result, you will see the following response from the service:
Running tests
--------------------

Make sure Keycloak is [running](#starting-and-configuring-the-keycloak-server).
Make sure Keycloak is [running](#starting-and-configuring-the-keycloak-server). Also make sure that node server is still listening on http://localhost:3000 .

1. Open a terminal and navigate to the root directory of this quickstart.

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<version.jee.jaxb.api>2.3.1</version.jee.jaxb.api>

<arquillian-managed>true</arquillian-managed>
<version.wildfly.maven.plugin>1.2.2.Final</version.wildfly.maven.plugin>
<version.wildfly.maven.plugin>4.1.1.Final</version.wildfly.maven.plugin>
<jboss-cli.executable>./jboss-cli.sh</jboss-cli.executable>
<keycloak.management.port>10090</keycloak.management.port>
<selenium-bom.version>3.11.0</selenium-bom.version>
Expand Down Expand Up @@ -173,7 +173,7 @@
</property>
</activation>
<properties>
<version.wildfly>28.0.0.Beta1</version.wildfly>
<version.wildfly>28.0.1.Final</version.wildfly>
<version.jakarta.ws.rs-api>3.1.0</version.jakarta.ws.rs-api>
<arquillian-graphene.version>2.5.4</arquillian-graphene.version>
<version.wildfly.arquillian.container>4.0.0.Alpha6</version.wildfly.arquillian.container>
Expand Down Expand Up @@ -370,7 +370,7 @@
</property>
</activation>
<properties>
<version.wildfly>28.0.0.Beta1</version.wildfly>
<version.wildfly>28.0.1.Final</version.wildfly>
<version.jakarta.ws.rs-api>3.1.0</version.jakarta.ws.rs-api>
<arquillian-graphene.version>2.5.4</arquillian-graphene.version>
<arquillian-bom.version>1.7.0.Alpha14</arquillian-bom.version>
Expand Down
Loading

0 comments on commit 7578786

Please sign in to comment.