diff --git a/examples/fuse/customer-app-fuse/src/main/webapp/customers/cxf-rs.jsp b/examples/fuse/customer-app-fuse/src/main/webapp/customers/cxf-rs.jsp index b9e2f319b8..c8d3fd1fb1 100755 --- a/examples/fuse/customer-app-fuse/src/main/webapp/customers/cxf-rs.jsp +++ b/examples/fuse/customer-app-fuse/src/main/webapp/customers/cxf-rs.jsp @@ -4,6 +4,8 @@ <%@ page import="org.keycloak.constants.ServiceUrlConstants" %> <%@ page import="org.keycloak.example.CxfRsClient" %> <%@ page import="org.keycloak.representations.IDToken" %> +<%@ page import="org.keycloak.common.util.UriUtils"%> +<%@ page import="org.keycloak.KeycloakSecurityContext"%> <%@ page session="false" %> @@ -16,6 +18,7 @@ String acctUri = KeycloakUriBuilder.fromUri("http://localhost:8080/auth").path(ServiceUrlConstants.ACCOUNT_SERVICE_PATH) .queryParam("referrer", "customer-portal").build("demo").toString(); IDToken idToken = CxfRsClient.getIDToken(request); + KeycloakSecurityContext kSession = (KeycloakSecurityContext) request.getAttribute(KeycloakSecurityContext.class.getName()); %>

Goto: products | logout | manage acct

@@ -28,6 +31,7 @@ Servlet User Principal <%=request.getUserPrincipal().getName()%>

First: <%=idToken.getGivenName()%>

Last: <%=idToken.getFamilyName()%>

Customer Listing

+

curl -H "Authorization: Bearer <%=kSession.getTokenString()%>" <%=UriUtils.getOrigin(request.getRequestURL().toString()) + "/cxf/customerservice/customers"%>

<% java.util.List list = null; try { diff --git a/examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 4c9d6cf9ff..ba2c111771 100644 --- a/examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -36,34 +36,4 @@ - - - - - - user - - - - - - - - - - - - - - - - - - - - - - diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/cxf-customerservice-keycloak.json b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/cxf-customerservice-keycloak.json new file mode 100644 index 0000000000..d0e4ad4d32 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/cxf-customerservice-keycloak.json @@ -0,0 +1,10 @@ +{ + "realm": "demo", + "resource": "builtin-cxf-app", + "auth-server-url": "http://localhost:8080/auth", + "ssl-required" : "external", + "bearer-only": true, + "credentials": { + "secret": "password" + } +} diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config-auth.cli b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config-auth.cli index 7e38734522..b8ac3643f8 100644 --- a/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config-auth.cli +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config-auth.cli @@ -1,3 +1,12 @@ +config:edit --factory --alias cxf org.ops4j.pax.web.context +config:property-set bundle.symbolicName org.apache.cxf.cxf-rt-transports-http +config:property-set context.id default +config:property-set context.param.keycloak.config.resolver org.keycloak.adapters.osgi.HierarchicalPathBasedKeycloakConfigResolver +config:property-set login.config.authMethod KEYCLOAK +config:property-set security.cxf.url /cxf/customerservice/* +config:property-set security.cxf.roles "admin, user" +config:update + config:edit org.apache.karaf.shell config:property-set sshRealm keycloak config:update diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config.cli b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config.cli index b1e19c0f6d..53968ecc46 100644 --- a/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config.cli +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config.cli @@ -1,11 +1,7 @@ config:edit org.ops4j.pax.url.mvn config:property-set org.ops4j.pax.url.mvn.localRepository ${maven.repo.local} config:property-set org.ops4j.pax.url.mvn.settings ${maven.local.settings} -config:property-append org.ops4j.pax.url.mvn.repositories ${repositories} -config:update - -config:edit org.ops4j.pax.web -config:property-set org.ops4j.pax.web.config.file '${karaf.etc}/undertow.xml' +config:property-append org.ops4j.pax.url.mvn.repositories "${repositories}" config:update config:edit jmx.acl.org.apache.karaf.security.jmx diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/pom.xml b/testsuite/integration-arquillian/servers/app-server/karaf/pom.xml index d2aeb5d0b8..efa903deaa 100644 --- a/testsuite/integration-arquillian/servers/app-server/karaf/pom.xml +++ b/testsuite/integration-arquillian/servers/app-server/karaf/pom.xml @@ -139,6 +139,7 @@ users.properties keycloak-bearer.json + cxf-customerservice-keycloak.json keycloak-direct-access.json keycloak-hawtio-client.json keycloak-hawtio.json @@ -189,7 +190,7 @@ - +