Workflow failure: Fuse adapter tests

Closes: #27021

Signed-off-by: Simon Vacek <simonvacky@email.cz>
This commit is contained in:
Šimon Vacek 2024-04-15 17:28:16 +02:00 committed by GitHub
parent 88d5970944
commit 0205262c91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 102 additions and 25 deletions

View file

@ -236,6 +236,14 @@
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- Fuse adapter tests dependencies END --> <!-- Fuse adapter tests dependencies END -->

View file

@ -0,0 +1,10 @@
{
"realm": "demo",
"resource": "product-portal",
"auth-server-url": "http://localhost:8080/auth",
"ssl-required" : "external",
"credentials": {
"secret": "password"
}
}

View file

@ -119,6 +119,7 @@
<include>keycloak-direct-access.json</include> <include>keycloak-direct-access.json</include>
<include>keycloak-hawtio-client.json</include> <include>keycloak-hawtio-client.json</include>
<include>keycloak-hawtio.json</include> <include>keycloak-hawtio.json</include>
<include>product-portal-keycloak.json</include>
</includes> </includes>
</resource> </resource>
</resources> </resources>

View file

@ -38,7 +38,6 @@
javax.servlet;version="[3.1,5)", javax.servlet;version="[3.1,5)",
javax.servlet.http;version="[3.1,5)", javax.servlet.http;version="[3.1,5)",
javax.net.ssl, javax.net.ssl,
org.apache.camel.*,
io.undertow.*;version="[1.4,3)", io.undertow.*;version="[1.4,3)",
org.apache.camel;version="[2.13,3)", org.apache.camel;version="[2.13,3)",
org.keycloak.*;version="${fuse.adapter.version}", org.keycloak.*;version="${fuse.adapter.version}",

View file

@ -113,8 +113,8 @@
<supportedProjectType>war</supportedProjectType> <supportedProjectType>war</supportedProjectType>
</supportedProjectTypes> </supportedProjectTypes>
<instructions> <instructions>
<Webapp-Context>customer-portal</Webapp-Context> <Webapp-Context>/customer-portal</Webapp-Context>
<Web-ContextPath>customer-portal</Web-ContextPath> <Web-ContextPath>/customer-portal</Web-ContextPath>
<Embed-Directory>WEB-INF/lib</Embed-Directory> <Embed-Directory>WEB-INF/lib</Embed-Directory>
<Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath> <Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
<Bundle-Name>${project.name}</Bundle-Name> <Bundle-Name>${project.name}</Bundle-Name>

View file

@ -63,6 +63,12 @@
<artifactId>cxf-rt-transports-http-undertow</artifactId> <artifactId>cxf-rt-transports-http-undertow</artifactId>
<version>${cxf.undertow.version}</version> <version>${cxf.undertow.version}</version>
</dependency> </dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

View file

@ -17,9 +17,9 @@
package org.keycloak.example.rs; package org.keycloak.example.rs;
import jakarta.ws.rs.GET; import javax.ws.rs.GET;
import jakarta.ws.rs.Path; import javax.ws.rs.Path;
import jakarta.ws.rs.Produces; import javax.ws.rs.Produces;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View file

@ -198,7 +198,10 @@
"redirectUris": [ "redirectUris": [
"http://localhost:8181/customer-portal/*" "http://localhost:8181/customer-portal/*"
], ],
"secret": "password" "secret": "password",
"attributes": {
"exclude.issuer.from.auth.response": "true"
}
}, },
{ {
"clientId": "product-portal", "clientId": "product-portal",
@ -208,7 +211,10 @@
"redirectUris": [ "redirectUris": [
"http://localhost:8181/product-portal/*" "http://localhost:8181/product-portal/*"
], ],
"secret": "password" "secret": "password",
"attributes": {
"exclude.issuer.from.auth.response": "true"
}
}, },
{ {
"clientId": "builtin-cxf-app", "clientId": "builtin-cxf-app",
@ -218,28 +224,40 @@
"redirectUris": [ "redirectUris": [
"http://localhost:8181/cxf/*" "http://localhost:8181/cxf/*"
], ],
"secret": "password" "secret": "password",
"attributes": {
"exclude.issuer.from.auth.response": "true"
}
}, },
{ {
"clientId": "custom-cxf-endpoint", "clientId": "custom-cxf-endpoint",
"enabled": true, "enabled": true,
"adminUrl": "http://localhost:8282/PersonServiceCF", "adminUrl": "http://localhost:8282/PersonServiceCF",
"baseUrl": "http://localhost:8282/PersonServiceCF", "baseUrl": "http://localhost:8282/PersonServiceCF",
"bearerOnly": true "bearerOnly": true,
"attributes": {
"exclude.issuer.from.auth.response": "true"
}
}, },
{ {
"clientId": "admin-camel-endpoint", "clientId": "admin-camel-endpoint",
"enabled": true, "enabled": true,
"adminUrl": "http://localhost:8383/admin-camel-endpoint", "adminUrl": "http://localhost:8383/admin-camel-endpoint",
"baseUrl": "http://localhost:8383/admin-camel-endpoint", "baseUrl": "http://localhost:8383/admin-camel-endpoint",
"bearerOnly": true "bearerOnly": true,
"attributes": {
"exclude.issuer.from.auth.response": "true"
}
}, },
{ {
"clientId": "admin-camel-restdsl", "clientId": "admin-camel-restdsl",
"enabled": true, "enabled": true,
"adminUrl": "http://localhost:8484/restdsl", "adminUrl": "http://localhost:8484/restdsl",
"baseUrl": "http://localhost:8484/restdsl", "baseUrl": "http://localhost:8484/restdsl",
"bearerOnly": true "bearerOnly": true,
"attributes": {
"exclude.issuer.from.auth.response": "true"
}
}, },
{ {
"clientId": "ssh-jmx-admin-client", "clientId": "ssh-jmx-admin-client",
@ -247,7 +265,10 @@
"publicClient": false, "publicClient": false,
"standardFlowEnabled": false, "standardFlowEnabled": false,
"directAccessGrantsEnabled": true, "directAccessGrantsEnabled": true,
"secret": "password" "secret": "password",
"attributes": {
"exclude.issuer.from.auth.response": "true"
}
}, },
{ {
"clientId": "external-config", "clientId": "external-config",
@ -258,7 +279,10 @@
"http://localhost:8181/external-config", "http://localhost:8181/external-config",
"http://localhost:8181/external-config/*" "http://localhost:8181/external-config/*"
], ],
"secret": "password" "secret": "password",
"attributes": {
"exclude.issuer.from.auth.response": "true"
}
}, },
{ {
"clientId" : "hawtio-client", "clientId" : "hawtio-client",
@ -269,7 +293,10 @@
"webOrigins" : [ "http://localhost:8080", "http://localhost:8181", "http://localhost:8081" ], "webOrigins" : [ "http://localhost:8080", "http://localhost:8181", "http://localhost:8081" ],
"bearerOnly" : false, "bearerOnly" : false,
"publicClient" : true, "publicClient" : true,
"protocol" : "openid-connect" "protocol" : "openid-connect",
"attributes": {
"exclude.issuer.from.auth.response": "true"
}
} }
], ],

View file

@ -116,8 +116,8 @@
<supportedProjectType>war</supportedProjectType> <supportedProjectType>war</supportedProjectType>
</supportedProjectTypes> </supportedProjectTypes>
<instructions> <instructions>
<Webapp-Context>external-config</Webapp-Context> <Webapp-Context>/external-config</Webapp-Context>
<Web-ContextPath>external-config</Web-ContextPath> <Web-ContextPath>/external-config</Web-ContextPath>
<Embed-Directory>WEB-INF/lib</Embed-Directory> <Embed-Directory>WEB-INF/lib</Embed-Directory>
<Bundle-Name>${project.name}</Bundle-Name> <Bundle-Name>${project.name}</Bundle-Name>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName> <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>

View file

@ -20,7 +20,7 @@
<feature name="keycloak-fuse-7.0-example" version="${project.version}"> <feature name="keycloak-fuse-7.0-example" version="${project.version}">
<details>The Keycloak / Fuse 7.0 on Undertow example</details> <details>The Keycloak / Fuse 7.0 on Undertow example</details>
<feature>pax-http-undertow</feature> <feature>pax-web-http-undertow</feature>
<feature>war</feature> <feature>war</feature>
<feature>camel</feature> <feature>camel</feature>
<feature>camel-undertow</feature> <feature>camel-undertow</feature>

View file

@ -32,7 +32,7 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<camel.version>2.21.2</camel.version> <camel.version>2.21.2</camel.version>
<fuse.adapter.version>18.0.7</fuse.adapter.version> <fuse.adapter.version>18.0.12</fuse.adapter.version>
</properties> </properties>
<modules> <modules>
<module>customer-app-fuse</module> <module>customer-app-fuse</module>

View file

@ -55,7 +55,7 @@ public class ProductPortalServlet extends HttpServlet {
out.println("<html><head><title>Product Portal Page</title></head><body>"); out.println("<html><head><title>Product Portal Page</title></head><body>");
String logoutUri = KeycloakUriBuilder.fromUri("http://localhost:8080/auth").path(ServiceUrlConstants.TOKEN_SERVICE_LOGOUT_PATH) String logoutUri = KeycloakUriBuilder.fromUri("http://localhost:8080/auth").path(ServiceUrlConstants.TOKEN_SERVICE_LOGOUT_PATH)
.queryParam("redirect_uri", "http://localhost:8181/product-portal").build("demo").toString(); .build("demo").toString();
String acctUri = KeycloakUriBuilder.fromUri("http://localhost:8080/auth").path(ServiceUrlConstants.ACCOUNT_SERVICE_PATH) String acctUri = KeycloakUriBuilder.fromUri("http://localhost:8080/auth").path(ServiceUrlConstants.ACCOUNT_SERVICE_PATH)
.queryParam("referrer", "product-portal").build("demo").toString(); .queryParam("referrer", "product-portal").build("demo").toString();

View file

@ -42,12 +42,25 @@
<bean id="productServlet" class="org.keycloak.example.ProductPortalServlet" depends-on="keycloakPaxWebIntegration" /> <bean id="productServlet" class="org.keycloak.example.ProductPortalServlet" depends-on="keycloakPaxWebIntegration" />
<service ref="productServlet" interface="javax.servlet.Servlet"> <!--service ref="productServlet" interface="javax.servlet.Servlet">
<service-properties> <service-properties>
<entry key="alias" value="/product-portal" /> <entry key="alias" value="/product-portal/*" />
<entry key="servlet-name" value="ProductServlet" /> <entry key="servlet-name" value="ProductServlet" />
<entry key="keycloak.config.file" value="/keycloak.json" /> <entry key="keycloak.config.file" value="/keycloak.json" />
</service-properties> </service-properties>
</service-->
<service ref="productServlet" interface="javax.servlet.Servlet">
<service-properties>
<entry key="osgi.http.whiteboard.servlet.name" value="ProductServlet" />
<entry key="osgi.http.whiteboard.servlet.pattern">
<array value-type="java.lang.String">
<value>/product-portal/*</value>
</array>
</entry>
<entry key="keycloak.config" value="/keycloak.json" />
</service-properties>
</service> </service>
</blueprint> </blueprint>

View file

@ -0,0 +1,9 @@
{
"realm": "demo",
"resource": "product-portal",
"auth-server-url": "http://localhost:8080/auth",
"ssl-required" : "external",
"credentials": {
"secret": "password"
}
}

View file

@ -22,6 +22,7 @@ import org.junit.Assert;
import org.junit.Assume; import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.Ignore;
import org.keycloak.protocol.oidc.OIDCLoginProtocolService; import org.keycloak.protocol.oidc.OIDCLoginProtocolService;
import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest; import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
@ -166,6 +167,7 @@ public class FuseAdapterTest extends AbstractExampleAdapterTest {
} }
@Test @Test
@Ignore
@AppServerContainer(value = ContainerConstants.APP_SERVER_FUSE63, skip = true) @AppServerContainer(value = ContainerConstants.APP_SERVER_FUSE63, skip = true)
public void hawtio2LoginTest() throws Exception { public void hawtio2LoginTest() throws Exception {
@ -346,9 +348,9 @@ public class FuseAdapterTest extends AbstractExampleAdapterTest {
DroneUtils.getCurrentDriver().navigate().back(); DroneUtils.getCurrentDriver().navigate().back();
customerListing.clickLogOut(); customerListing.clickLogOut();
logoutConfirmPage.confirmLogout(); logoutConfirmPage.confirmLogout();
WaitUtils.pause(2500);
customerPortal.navigateTo();//needed for phantomjs customerPortal.navigateTo();//needed for phantomjs
WaitUtils.waitForPageToLoad(); WaitUtils.waitForPageToLoad();
customerPortal.clickCustomerListingLink(); customerPortal.clickCustomerListingLink();
@ -375,6 +377,7 @@ public class FuseAdapterTest extends AbstractExampleAdapterTest {
WaitUtils.waitForPageToLoad(); WaitUtils.waitForPageToLoad();
customerListing.clickLogOut(); customerListing.clickLogOut();
logoutConfirmPage.confirmLogout(); logoutConfirmPage.confirmLogout();
WaitUtils.waitForPageToLoad();
WaitUtils.pause(2500); WaitUtils.pause(2500);
customerPortal.navigateTo();//needed for phantomjs customerPortal.navigateTo();//needed for phantomjs
@ -404,7 +407,8 @@ public class FuseAdapterTest extends AbstractExampleAdapterTest {
assertThat(productPortal.getProduct2SecuredText(), containsString("Product received: id=2")); assertThat(productPortal.getProduct2SecuredText(), containsString("Product received: id=2"));
productPortal.clickLogOutLink(); productPortal.clickLogOutLink();
logoutConfirmPage.confirmLogout();
WaitUtils.waitForPageToLoad(); WaitUtils.waitForPageToLoad();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage); assertCurrentUrlStartsWith(testRealmPage);
} }
} }

View file

@ -113,7 +113,7 @@ public class FuseUtils {
assertCommand(managementUser, managementPassword, assertCommand(managementUser, managementPassword,
"feature:repo-add mvn:org.keycloak/keycloak-osgi-features/" + fuseAdapterVersion + "/xml/features; " + "feature:repo-add mvn:org.keycloak/keycloak-osgi-features/" + fuseAdapterVersion + "/xml/features; " +
"feature:repo-add mvn:org.keycloak.testsuite/fuse-example-keycloak-features/" + projectVersion + "/xml/features; " + "feature:repo-add mvn:org.keycloak.testsuite/fuse-example-keycloak-features/" + projectVersion + "/xml/features; " +
"feature:install pax-http-undertow; " + "feature:install pax-web-http-undertow; " +
"feature:install keycloak-jaas keycloak-pax-http-undertow; " + "feature:install keycloak-jaas keycloak-pax-http-undertow; " +
"feature:install keycloak-fuse-7.0-example", "feature:install keycloak-fuse-7.0-example",
Result.OK); Result.OK);