{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \");\n+ out.flush();\n+ out.close();\n+ }\n+\n+ private String sendWsReq(HttpServletRequest req, String productId, boolean secured) {\n+ Product simpleClient = null;\n+// try {\n+ JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();\n+ factory.setServiceClass(Product.class);\n+ factory.setAddress(\"http://localhost:8282/ProductServiceCF\");\n+\n+ simpleClient = (Product)factory.create();\n+/* } catch (Exception ex) {\n+ ex.printStackTrace();\n+ String error = \"Cannot create WS client: \" + ex;\n+ return error;\n+ }*/\n+ java.lang.String _getProduct_productIdVal = productId;\n+ javax.xml.ws.Holder _getProduct_productId = new javax.xml.ws.Holder(_getProduct_productIdVal);\n+ javax.xml.ws.Holder _getProduct_name = new javax.xml.ws.Holder();\n+\n+ // Attach Authorization header\n+ if (secured) {\n+ Client clientProxy = ClientProxy.getClient(simpleClient);\n+\n+ KeycloakSecurityContext session = (KeycloakSecurityContext) req.getAttribute(KeycloakSecurityContext.class.getName());\n+ Map> headers = new HashMap>();\n+ headers.put(\"Authorization\", Arrays.asList(\"Bearer \" + session.getTokenString()));\n+\n+ clientProxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);\n+ }\n+\n+ try {\n+ simpleClient.getProduct(_getProduct_productId, _getProduct_name);\n+ return String.format(\"Product received: id=%s, name=%s\", _getProduct_productId.value, _getProduct_name.value);\n+ } catch (UnknownProductFault upf) {\n+ return \"UnknownProductFault has occurred. Details: \" + upf.toString();\n+ } catch (WebServiceException wse) {\n+ String error = \"Can't receive product. Reason: \" + wse.getMessage();\n+ if (wse.getCause() != null) {\n+ Throwable cause = wse.getCause();\n+ error = error + \" Details: \" + cause.getClass().getName() + \": \" + cause.getMessage();\n+ }\n+ return error;\n+ }\n+ }\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/product-app-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml","diff":"+\n+\n+\n+\n+\n+ \n+ \n+ \n+ user\n+ \n+ \n+ \n+ \n+ \n+\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+\n+ \n+\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+\n+\n\\ No newline at end of file\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/product-app-fuse7-undertow/src/main/resources/WEB-INF/keycloak.json","diff":"+{\n+ \"realm\": \"demo\",\n+ \"resource\": \"product-portal\",\n+ \"auth-server-url\": \"http://localhost:8080/auth\",\n+ \"ssl-required\" : \"external\",\n+ \"credentials\": {\n+ \"secret\": \"password\"\n+ }\n+}\n"}],"string":"[\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"examples/fuse/pom.xml\",\n \"new_path\": \"examples/fuse/pom.xml\",\n \"diff\": \"\\ncustomer-app-fuse\\nproduct-app-fuse\\n+ product-app-fuse7-undertow\\ncxf-jaxrs\\ncxf-jaxws\\ncamel\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/product-app-fuse7-undertow/pom.xml\",\n \"diff\": \"+\\n+\\n+\\n+\\n+ \\n+ keycloak-examples-fuse-parent\\n+ org.keycloak\\n+ 4.0.0.Beta3-SNAPSHOT\\n+ \\n+\\n+ 4.0.0\\n+ org.keycloak.example.demo\\n+ product-portal-fuse-example-fuse7-undertow\\n+ bundle\\n+\\n+ Product Portal - Secured in Karaf/Fuse 7.0 on Undertow\\n+ \\n+\\n+ \\n+ \\n+ \\n+ \\n+ javax.wsdl,\\n+ javax.xml.bind,\\n+ javax.xml.bind.annotation,\\n+ javax.xml.namespace,\\n+ javax.xml.ws,\\n+ META-INF.cxf;version=\\\"[2.7,3.3)\\\",\\n+ org.apache.cxf.transport.http;version=\\\"[2.7,3.3)\\\",\\n+ org.apache.cxf.*;version=\\\"[2.7,3.3)\\\",\\n+ org.keycloak.*;version=\\\"${project.version}\\\",\\n+ org.keycloak.adapters.authentication;version=\\\"${project.version}\\\";resolution:=optional,\\n+ *;resolution:=optional\\n+ \\n+ \\n+ org.keycloak.example.*\\n+ \\n+ \\n+\\n+ \\n+ \\n+ org.jboss.spec.javax.servlet\\n+ jboss-servlet-api_3.0_spec\\n+ \\n+ \\n+ org.keycloak\\n+ keycloak-core\\n+ \\n+\\n+ \\n+ \\n+ org.keycloak.example.demo\\n+ cxf-jaxws-example\\n+ \\n+ \\n+\\n+ \\n+ install\\n+\\n+ \\n+ \\n+ org.apache.felix\\n+ maven-bundle-plugin\\n+ true\\n+ \\n+ \\n+ ${project.name}\\n+ ${project.groupId}.${project.artifactId}\\n+ ${keycloak.osgi.import}\\n+ ${keycloak.osgi.private}\\n+ ${keycloak.osgi.export}\\n+ \\n+ \\n+ \\n+\\n+ \\n+ \\n+\\n+\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/product-app-fuse7-undertow/src/main/java/org/keycloak/example/ProductPortalServlet.java\",\n \"diff\": \"+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.example;\\n+\\n+import org.apache.cxf.endpoint.Client;\\n+import org.apache.cxf.frontend.ClientProxy;\\n+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;\\n+import org.apache.cxf.message.Message;\\n+import org.keycloak.KeycloakSecurityContext;\\n+import org.keycloak.common.util.KeycloakUriBuilder;\\n+import org.keycloak.constants.ServiceUrlConstants;\\n+import org.keycloak.example.ws.Product;\\n+import org.keycloak.example.ws.UnknownProductFault;\\n+\\n+import javax.servlet.ServletException;\\n+import javax.servlet.http.HttpServlet;\\n+import javax.servlet.http.HttpServletRequest;\\n+import javax.servlet.http.HttpServletResponse;\\n+import javax.xml.ws.WebServiceException;\\n+import java.io.IOException;\\n+import java.io.PrintWriter;\\n+import java.util.Arrays;\\n+import java.util.HashMap;\\n+import java.util.List;\\n+import java.util.Map;\\n+\\n+/**\\n+ * Servlet for receiving informations about products from backend JAXWS service\\n+ *\\n+ * @author Marek Posolda\\n+ */\\n+public class ProductPortalServlet extends HttpServlet {\\n+\\n+ @Override\\n+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\\n+ resp.setContentType(\\\"text/html\\\");\\n+\\n+ // Send jaxws request\\n+ PrintWriter out = resp.getWriter();\\n+ out.println(\\\"Product Portal Page\\\");\\n+\\n+ String logoutUri = KeycloakUriBuilder.fromUri(\\\"http://localhost:8080/auth\\\").path(ServiceUrlConstants.TOKEN_SERVICE_LOGOUT_PATH)\\n+ .queryParam(\\\"redirect_uri\\\", \\\"http://localhost:8181/product-portal\\\").build(\\\"demo\\\").toString();\\n+ String acctUri = KeycloakUriBuilder.fromUri(\\\"http://localhost:8080/auth\\\").path(ServiceUrlConstants.ACCOUNT_SERVICE_PATH)\\n+ .queryParam(\\\"referrer\\\", \\\"product-portal\\\").build(\\\"demo\\\").toString();\\n+\\n+ out.println(\\\"

Goto: customers | logout | manage acct

\\\");\\n+ out.println(\\\"Servlet User Principal \\\" + req.getUserPrincipal() + \\\" made this request.\\\");\\n+\\n+ String unsecuredWsClientResponse = sendWsReq(req, \\\"1\\\", false);\\n+ String securedWsClientResponse = sendWsReq(req, \\\"1\\\", true);\\n+ String securedWsClient2Response = sendWsReq(req, \\\"2\\\", true);\\n+\\n+ out.println(\\\"

Product with ID 1 - unsecured request (it should end with failure): \\\" + unsecuredWsClientResponse + \\\"


\\\");\\n+ out.println(\\\"

Product with ID 1 - secured request: \\\" + securedWsClientResponse + \\\"


\\\");\\n+ out.println(\\\"

Product with ID 2 - secured request: \\\" + securedWsClient2Response + \\\"


\\\");\\n+ out.println(\\\"\\\");\\n+ out.flush();\\n+ out.close();\\n+ }\\n+\\n+ private String sendWsReq(HttpServletRequest req, String productId, boolean secured) {\\n+ Product simpleClient = null;\\n+// try {\\n+ JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();\\n+ factory.setServiceClass(Product.class);\\n+ factory.setAddress(\\\"http://localhost:8282/ProductServiceCF\\\");\\n+\\n+ simpleClient = (Product)factory.create();\\n+/* } catch (Exception ex) {\\n+ ex.printStackTrace();\\n+ String error = \\\"Cannot create WS client: \\\" + ex;\\n+ return error;\\n+ }*/\\n+ java.lang.String _getProduct_productIdVal = productId;\\n+ javax.xml.ws.Holder _getProduct_productId = new javax.xml.ws.Holder(_getProduct_productIdVal);\\n+ javax.xml.ws.Holder _getProduct_name = new javax.xml.ws.Holder();\\n+\\n+ // Attach Authorization header\\n+ if (secured) {\\n+ Client clientProxy = ClientProxy.getClient(simpleClient);\\n+\\n+ KeycloakSecurityContext session = (KeycloakSecurityContext) req.getAttribute(KeycloakSecurityContext.class.getName());\\n+ Map> headers = new HashMap>();\\n+ headers.put(\\\"Authorization\\\", Arrays.asList(\\\"Bearer \\\" + session.getTokenString()));\\n+\\n+ clientProxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);\\n+ }\\n+\\n+ try {\\n+ simpleClient.getProduct(_getProduct_productId, _getProduct_name);\\n+ return String.format(\\\"Product received: id=%s, name=%s\\\", _getProduct_productId.value, _getProduct_name.value);\\n+ } catch (UnknownProductFault upf) {\\n+ return \\\"UnknownProductFault has occurred. Details: \\\" + upf.toString();\\n+ } catch (WebServiceException wse) {\\n+ String error = \\\"Can't receive product. Reason: \\\" + wse.getMessage();\\n+ if (wse.getCause() != null) {\\n+ Throwable cause = wse.getCause();\\n+ error = error + \\\" Details: \\\" + cause.getClass().getName() + \\\": \\\" + cause.getMessage();\\n+ }\\n+ return error;\\n+ }\\n+ }\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/product-app-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml\",\n \"diff\": \"+\\n+\\n+\\n+\\n+\\n+ \\n+ \\n+ \\n+ user\\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n+ \\n+\\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n+\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/product-app-fuse7-undertow/src/main/resources/WEB-INF/keycloak.json\",\n \"diff\": \"+{\\n+ \\\"realm\\\": \\\"demo\\\",\\n+ \\\"resource\\\": \\\"product-portal\\\",\\n+ \\\"auth-server-url\\\": \\\"http://localhost:8080/auth\\\",\\n+ \\\"ssl-required\\\" : \\\"external\\\",\\n+ \\\"credentials\\\": {\\n+ \\\"secret\\\": \\\"password\\\"\\n+ }\\n+}\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-7282 Pax Web Whiteboard Extender (Product portal app)"}}},{"rowIdx":2929,"cells":{"author":{"kind":"number","value":339185,"string":"339,185"},"date":{"kind":"string","value":"18.05.2018 15:14:04"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"b2df872ad4b528a244be917949951eecfa1d0c30"},"message":{"kind":"string","value":"KEYCLOAK-7280 CXF/Undertow integration"},"mods":{"kind":"list like","value":[{"change_type":"MODIFY","old_path":"adapters/oidc/fuse7/undertow/pom.xml","new_path":"adapters/oidc/fuse7/undertow/pom.xml","diff":"org.ops4j.pax.web.*;version=\"[3.0,8)\",\njavax.servlet.*;version=\"[2.5,4)\";resolution:=optional,\norg.apache.cxf.transport.http;resolution:=optional;version=\"[3,4)\",\n+ org.apache.cxf.transport.http_undertow;resolution:=optional;version=\"[3,4)\",\norg.apache.cxf.transport.servlet;resolution:=optional;version=\"[3,4)\",\nio.undertow.*,\n*;resolution:=optional\n\norg.apache.cxf\ncxf-rt-transports-http-undertow\n- 3.1.11.fuse-000199-redhat-1\n+ ${cxf.version}\nprovided\n\n"},{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/undertow/src/main/java/org/keycloak/adapters/osgi/undertow/CxfKeycloakAuthHandler.java","diff":"+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.keycloak.adapters.osgi.undertow;\n+\n+import org.keycloak.adapters.AdapterDeploymentContext;\n+import org.keycloak.adapters.KeycloakConfigResolver;\n+import org.keycloak.adapters.KeycloakDeployment;\n+import org.keycloak.adapters.KeycloakDeploymentBuilder;\n+import org.keycloak.adapters.NodesRegistrationManagement;\n+import org.keycloak.adapters.spi.InMemorySessionIdMapper;\n+import org.keycloak.adapters.spi.SessionIdMapper;\n+import org.keycloak.adapters.undertow.UndertowAuthenticationMechanism;\n+import org.keycloak.adapters.undertow.UndertowUserSessionManagement;\n+import org.keycloak.representations.adapters.config.AdapterConfig;\n+import io.undertow.security.api.AuthenticationMechanism;\n+import io.undertow.security.api.AuthenticationMode;\n+import io.undertow.security.handlers.AuthenticationCallHandler;\n+import io.undertow.security.handlers.AuthenticationConstraintHandler;\n+import io.undertow.security.handlers.AuthenticationMechanismsHandler;\n+import io.undertow.security.handlers.SecurityInitialHandler;\n+import io.undertow.security.idm.Account;\n+import io.undertow.security.idm.Credential;\n+import io.undertow.security.idm.IdentityManager;\n+import io.undertow.server.HttpHandler;\n+import io.undertow.server.HttpServerExchange;\n+import java.util.Collections;\n+import java.util.List;\n+import java.util.concurrent.atomic.AtomicReference;\n+import java.util.logging.Level;\n+import java.util.logging.Logger;\n+import java.util.regex.Pattern;\n+import org.apache.cxf.transport.http_undertow.CXFUndertowHttpHandler;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public class CxfKeycloakAuthHandler implements CXFUndertowHttpHandler {\n+\n+ private static final Logger LOG = Logger.getLogger(CxfKeycloakAuthHandler.class.getName());\n+\n+ private static final IdentityManager IDENTITY_MANAGER = new IdentityManager() {\n+ @Override\n+ public Account verify(Account account) {\n+ return account;\n+ }\n+\n+ @Override\n+ public Account verify(String id, Credential credential) {\n+ throw new IllegalStateException(\"Should never be called in Keycloak flow\");\n+ }\n+\n+ @Override\n+ public Account verify(Credential credential) {\n+ throw new IllegalStateException(\"Should never be called in Keycloak flow\");\n+ }\n+ };\n+\n+ private final UndertowUserSessionManagement userSessionManagement = new UndertowUserSessionManagement();\n+\n+ protected final NodesRegistrationManagement nodesRegistrationManagement = new NodesRegistrationManagement();\n+\n+ protected final SessionIdMapper idMapper = new InMemorySessionIdMapper();\n+\n+ private final AtomicReference securityHandler = new AtomicReference<>();\n+\n+ private Pattern skipPattern;\n+\n+ private int confidentialPort = 8443;\n+\n+ private HttpHandler next;\n+\n+ private KeycloakConfigResolver configResolver;\n+\n+ private AdapterConfig adapterConfig;\n+\n+ @Override\n+ public void handleRequest(HttpServerExchange exchange) throws Exception {\n+ if (shouldSkip(exchange.getRequestPath())) {\n+ next.handleRequest(exchange);\n+ } else {\n+ getSecurityHandler().handleRequest(exchange);\n+ }\n+ }\n+\n+ private HttpHandler getSecurityHandler() {\n+ if (this.securityHandler.get() == null) {\n+ HttpHandler handler = this.next;\n+\n+ handler = new AuthenticationCallHandler(handler);\n+ handler = new AuthenticationConstraintHandler(handler);\n+\n+ AdapterDeploymentContext deploymentContext = buildDeploymentContext();\n+\n+ final List mechanisms\n+ = Collections.singletonList(\n+ new UndertowAuthenticationMechanism(deploymentContext, userSessionManagement, nodesRegistrationManagement, confidentialPort, null));\n+ handler = new AuthenticationMechanismsHandler(handler, mechanisms);\n+\n+ this.securityHandler.compareAndSet(null, new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, IDENTITY_MANAGER, \"KEYCLOAK\", handler));\n+ }\n+\n+ return this.securityHandler.get();\n+ }\n+\n+ private AdapterDeploymentContext buildDeploymentContext() {\n+ if (configResolver != null) {\n+ LOG.log(Level.INFO, \"Using {0} to resolve Keycloak configuration on a per-request basis.\", configResolver.getClass());\n+ return new AdapterDeploymentContext(configResolver);\n+ } else if (adapterConfig != null) {\n+ KeycloakDeployment kd = KeycloakDeploymentBuilder.build(adapterConfig);\n+ return new AdapterDeploymentContext(kd);\n+ }\n+\n+ LOG.warning(\"Adapter is unconfigured, Keycloak will deny every request\");\n+ return new AdapterDeploymentContext();\n+ }\n+\n+ @Override\n+ public void setNext(HttpHandler nextHandler) {\n+ this.next = nextHandler;\n+ }\n+\n+ private boolean shouldSkip(String requestPath) {\n+ return skipPattern != null && skipPattern.matcher(requestPath).matches();\n+ }\n+\n+ public KeycloakConfigResolver getConfigResolver() {\n+ return configResolver;\n+ }\n+\n+ public void setConfigResolver(KeycloakConfigResolver configResolver) {\n+ this.configResolver = configResolver;\n+ }\n+\n+ public int getConfidentialPort() {\n+ return confidentialPort;\n+ }\n+\n+ public void setConfidentialPort(int confidentialPort) {\n+ this.confidentialPort = confidentialPort;\n+ }\n+\n+ public AdapterConfig getAdapterConfig() {\n+ return adapterConfig;\n+ }\n+\n+ public void setAdapterConfig(AdapterConfig adapterConfig) {\n+ this.adapterConfig = adapterConfig;\n+ }\n+\n+ public String getSkipPattern() {\n+ return skipPattern.pattern();\n+ }\n+\n+ public void setSkipPattern(String skipPattern) {\n+ this.skipPattern = Pattern.compile(skipPattern, Pattern.DOTALL);\n+ }\n+\n+}\n"}],"string":"[\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"adapters/oidc/fuse7/undertow/pom.xml\",\n \"new_path\": \"adapters/oidc/fuse7/undertow/pom.xml\",\n \"diff\": \"org.ops4j.pax.web.*;version=\\\"[3.0,8)\\\",\\njavax.servlet.*;version=\\\"[2.5,4)\\\";resolution:=optional,\\norg.apache.cxf.transport.http;resolution:=optional;version=\\\"[3,4)\\\",\\n+ org.apache.cxf.transport.http_undertow;resolution:=optional;version=\\\"[3,4)\\\",\\norg.apache.cxf.transport.servlet;resolution:=optional;version=\\\"[3,4)\\\",\\nio.undertow.*,\\n*;resolution:=optional\\n\\norg.apache.cxf\\ncxf-rt-transports-http-undertow\\n- 3.1.11.fuse-000199-redhat-1\\n+ ${cxf.version}\\nprovided\\n\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/undertow/src/main/java/org/keycloak/adapters/osgi/undertow/CxfKeycloakAuthHandler.java\",\n \"diff\": \"+/*\\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+package org.keycloak.adapters.osgi.undertow;\\n+\\n+import org.keycloak.adapters.AdapterDeploymentContext;\\n+import org.keycloak.adapters.KeycloakConfigResolver;\\n+import org.keycloak.adapters.KeycloakDeployment;\\n+import org.keycloak.adapters.KeycloakDeploymentBuilder;\\n+import org.keycloak.adapters.NodesRegistrationManagement;\\n+import org.keycloak.adapters.spi.InMemorySessionIdMapper;\\n+import org.keycloak.adapters.spi.SessionIdMapper;\\n+import org.keycloak.adapters.undertow.UndertowAuthenticationMechanism;\\n+import org.keycloak.adapters.undertow.UndertowUserSessionManagement;\\n+import org.keycloak.representations.adapters.config.AdapterConfig;\\n+import io.undertow.security.api.AuthenticationMechanism;\\n+import io.undertow.security.api.AuthenticationMode;\\n+import io.undertow.security.handlers.AuthenticationCallHandler;\\n+import io.undertow.security.handlers.AuthenticationConstraintHandler;\\n+import io.undertow.security.handlers.AuthenticationMechanismsHandler;\\n+import io.undertow.security.handlers.SecurityInitialHandler;\\n+import io.undertow.security.idm.Account;\\n+import io.undertow.security.idm.Credential;\\n+import io.undertow.security.idm.IdentityManager;\\n+import io.undertow.server.HttpHandler;\\n+import io.undertow.server.HttpServerExchange;\\n+import java.util.Collections;\\n+import java.util.List;\\n+import java.util.concurrent.atomic.AtomicReference;\\n+import java.util.logging.Level;\\n+import java.util.logging.Logger;\\n+import java.util.regex.Pattern;\\n+import org.apache.cxf.transport.http_undertow.CXFUndertowHttpHandler;\\n+\\n+/**\\n+ *\\n+ * @author hmlnarik\\n+ */\\n+public class CxfKeycloakAuthHandler implements CXFUndertowHttpHandler {\\n+\\n+ private static final Logger LOG = Logger.getLogger(CxfKeycloakAuthHandler.class.getName());\\n+\\n+ private static final IdentityManager IDENTITY_MANAGER = new IdentityManager() {\\n+ @Override\\n+ public Account verify(Account account) {\\n+ return account;\\n+ }\\n+\\n+ @Override\\n+ public Account verify(String id, Credential credential) {\\n+ throw new IllegalStateException(\\\"Should never be called in Keycloak flow\\\");\\n+ }\\n+\\n+ @Override\\n+ public Account verify(Credential credential) {\\n+ throw new IllegalStateException(\\\"Should never be called in Keycloak flow\\\");\\n+ }\\n+ };\\n+\\n+ private final UndertowUserSessionManagement userSessionManagement = new UndertowUserSessionManagement();\\n+\\n+ protected final NodesRegistrationManagement nodesRegistrationManagement = new NodesRegistrationManagement();\\n+\\n+ protected final SessionIdMapper idMapper = new InMemorySessionIdMapper();\\n+\\n+ private final AtomicReference securityHandler = new AtomicReference<>();\\n+\\n+ private Pattern skipPattern;\\n+\\n+ private int confidentialPort = 8443;\\n+\\n+ private HttpHandler next;\\n+\\n+ private KeycloakConfigResolver configResolver;\\n+\\n+ private AdapterConfig adapterConfig;\\n+\\n+ @Override\\n+ public void handleRequest(HttpServerExchange exchange) throws Exception {\\n+ if (shouldSkip(exchange.getRequestPath())) {\\n+ next.handleRequest(exchange);\\n+ } else {\\n+ getSecurityHandler().handleRequest(exchange);\\n+ }\\n+ }\\n+\\n+ private HttpHandler getSecurityHandler() {\\n+ if (this.securityHandler.get() == null) {\\n+ HttpHandler handler = this.next;\\n+\\n+ handler = new AuthenticationCallHandler(handler);\\n+ handler = new AuthenticationConstraintHandler(handler);\\n+\\n+ AdapterDeploymentContext deploymentContext = buildDeploymentContext();\\n+\\n+ final List mechanisms\\n+ = Collections.singletonList(\\n+ new UndertowAuthenticationMechanism(deploymentContext, userSessionManagement, nodesRegistrationManagement, confidentialPort, null));\\n+ handler = new AuthenticationMechanismsHandler(handler, mechanisms);\\n+\\n+ this.securityHandler.compareAndSet(null, new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, IDENTITY_MANAGER, \\\"KEYCLOAK\\\", handler));\\n+ }\\n+\\n+ return this.securityHandler.get();\\n+ }\\n+\\n+ private AdapterDeploymentContext buildDeploymentContext() {\\n+ if (configResolver != null) {\\n+ LOG.log(Level.INFO, \\\"Using {0} to resolve Keycloak configuration on a per-request basis.\\\", configResolver.getClass());\\n+ return new AdapterDeploymentContext(configResolver);\\n+ } else if (adapterConfig != null) {\\n+ KeycloakDeployment kd = KeycloakDeploymentBuilder.build(adapterConfig);\\n+ return new AdapterDeploymentContext(kd);\\n+ }\\n+\\n+ LOG.warning(\\\"Adapter is unconfigured, Keycloak will deny every request\\\");\\n+ return new AdapterDeploymentContext();\\n+ }\\n+\\n+ @Override\\n+ public void setNext(HttpHandler nextHandler) {\\n+ this.next = nextHandler;\\n+ }\\n+\\n+ private boolean shouldSkip(String requestPath) {\\n+ return skipPattern != null && skipPattern.matcher(requestPath).matches();\\n+ }\\n+\\n+ public KeycloakConfigResolver getConfigResolver() {\\n+ return configResolver;\\n+ }\\n+\\n+ public void setConfigResolver(KeycloakConfigResolver configResolver) {\\n+ this.configResolver = configResolver;\\n+ }\\n+\\n+ public int getConfidentialPort() {\\n+ return confidentialPort;\\n+ }\\n+\\n+ public void setConfidentialPort(int confidentialPort) {\\n+ this.confidentialPort = confidentialPort;\\n+ }\\n+\\n+ public AdapterConfig getAdapterConfig() {\\n+ return adapterConfig;\\n+ }\\n+\\n+ public void setAdapterConfig(AdapterConfig adapterConfig) {\\n+ this.adapterConfig = adapterConfig;\\n+ }\\n+\\n+ public String getSkipPattern() {\\n+ return skipPattern.pattern();\\n+ }\\n+\\n+ public void setSkipPattern(String skipPattern) {\\n+ this.skipPattern = Pattern.compile(skipPattern, Pattern.DOTALL);\\n+ }\\n+\\n+}\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-7278 KEYCLOAK-7280 CXF/Undertow integration"}}},{"rowIdx":2930,"cells":{"author":{"kind":"number","value":339185,"string":"339,185"},"date":{"kind":"string","value":"19.05.2018 18:36:27"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"78e963688c10431b46881992271582ee73e21b2d"},"message":{"kind":"string","value":"CXF JAX-RS example"},"mods":{"kind":"list like","value":[{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxrs-fuse7-undertow/pom.xml","diff":"+\n+\n+\n+\n+ \n+ keycloak-examples-fuse-parent\n+ org.keycloak\n+ 4.0.0.Beta3-SNAPSHOT\n+ \n+\n+ 4.0.0\n+ org.keycloak.example.demo\n+ cxf-jaxrs-example-fuse7-undertow\n+ bundle\n+ CXF JAXRS Example - Secured in Karaf/Fuse 7.0 on Undertow\n+\n+ \n+ \n+ \n+ \n+ javax.ws.rs;version=\"[2,3)\",\n+ META-INF.cxf;version=\"[2.7,3.3)\",\n+ META-INF.cxf.osgi;version=\"[2.7,3.3)\";resolution:=optional,\n+ org.apache.cxf.transport.http;version=\"[2.7,3.3)\",\n+ org.apache.cxf.*;version=\"[2.7,3.3)\",\n+ com.fasterxml.jackson.jaxrs.json;version=\"${jackson.version}\",\n+ org.keycloak.*;version=\"${project.version}\",\n+ *;resolution:=optional\n+ \n+ \n+ org.keycloak.example.rs.*\n+ \n+ \n+\n+ \n+ \n+ org.apache.cxf\n+ cxf-rt-frontend-jaxrs\n+ ${cxf.version}\n+ \n+ \n+ org.apache.cxf\n+ cxf-rt-transports-http\n+ ${cxf.version}\n+ \n+ \n+ org.apache.cxf\n+ cxf-rt-transports-http-undertow\n+ ${cxf.version}\n+ \n+ \n+\n+ \n+ install\n+\n+ \n+ \n+ org.apache.felix\n+ maven-bundle-plugin\n+ true\n+ \n+ \n+ ${project.name}\n+ ${project.groupId}.${project.artifactId}\n+ ${keycloak.osgi.import}\n+ ${keycloak.osgi.private}\n+ ${keycloak.osgi.export}\n+ \n+ \n+ \n+\n+ \n+ \n+\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/java/org/keycloak/example/rs/CxfCustomerService.java","diff":"+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.example.rs;\n+\n+import javax.ws.rs.GET;\n+import javax.ws.rs.Path;\n+import javax.ws.rs.Produces;\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+/**\n+ * @author Bill Burke\n+ * @version $Revision: 1 $\n+ */\n+@Path(\"/customers\")\n+public class CxfCustomerService {\n+\n+ @GET\n+ @Produces(\"application/json\")\n+ public List getCustomers() {\n+ ArrayList rtn = new ArrayList();\n+ rtn.add(\"Bill Burke\");\n+ rtn.add(\"Stian Thorgersen\");\n+ rtn.add(\"Stan Silvert\");\n+ rtn.add(\"Gabriel Cardoso\");\n+ rtn.add(\"Viliam Rockai\");\n+ rtn.add(\"Marek Posolda\");\n+ rtn.add(\"Boleslaw Dawidowicz\");\n+ return rtn;\n+ }\n+}\n"},{"change_type":"ADD","old_path":"examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/META-INF/cxf/bus-extensions.txt","new_path":"examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/META-INF/cxf/bus-extensions.txt","diff":""},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml","diff":"+\n+\n+\n+\n+\n+ \n+\n+ \n+\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+\n+\n+ \n+ \n+ \n+ \n+ user\n+ \n+ \n+ \n+ \n+ \n+\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+\n+ \n+ \n+ \n+ \n+ \n+ \n+\n+\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/WEB-INF/keycloak.json","diff":"+{\n+ \"realm\": \"demo\",\n+ \"resource\": \"builtin-cxf-app\",\n+ \"auth-server-url\": \"http://localhost:8080/auth\",\n+ \"ssl-required\" : \"external\",\n+ \"credentials\": {\n+ \"secret\": \"password\"\n+ }\n+}\n"},{"change_type":"MODIFY","old_path":"examples/fuse/pom.xml","new_path":"examples/fuse/pom.xml","diff":"product-app-fuse\nproduct-app-fuse7-undertow\ncxf-jaxrs\n+ cxf-jaxrs-fuse7-undertow\ncxf-jaxws\ncamel\nfeatures\n"}],"string":"[\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxrs-fuse7-undertow/pom.xml\",\n \"diff\": \"+\\n+\\n+\\n+\\n+ \\n+ keycloak-examples-fuse-parent\\n+ org.keycloak\\n+ 4.0.0.Beta3-SNAPSHOT\\n+ \\n+\\n+ 4.0.0\\n+ org.keycloak.example.demo\\n+ cxf-jaxrs-example-fuse7-undertow\\n+ bundle\\n+ CXF JAXRS Example - Secured in Karaf/Fuse 7.0 on Undertow\\n+\\n+ \\n+ \\n+ \\n+ \\n+ javax.ws.rs;version=\\\"[2,3)\\\",\\n+ META-INF.cxf;version=\\\"[2.7,3.3)\\\",\\n+ META-INF.cxf.osgi;version=\\\"[2.7,3.3)\\\";resolution:=optional,\\n+ org.apache.cxf.transport.http;version=\\\"[2.7,3.3)\\\",\\n+ org.apache.cxf.*;version=\\\"[2.7,3.3)\\\",\\n+ com.fasterxml.jackson.jaxrs.json;version=\\\"${jackson.version}\\\",\\n+ org.keycloak.*;version=\\\"${project.version}\\\",\\n+ *;resolution:=optional\\n+ \\n+ \\n+ org.keycloak.example.rs.*\\n+ \\n+ \\n+\\n+ \\n+ \\n+ org.apache.cxf\\n+ cxf-rt-frontend-jaxrs\\n+ ${cxf.version}\\n+ \\n+ \\n+ org.apache.cxf\\n+ cxf-rt-transports-http\\n+ ${cxf.version}\\n+ \\n+ \\n+ org.apache.cxf\\n+ cxf-rt-transports-http-undertow\\n+ ${cxf.version}\\n+ \\n+ \\n+\\n+ \\n+ install\\n+\\n+ \\n+ \\n+ org.apache.felix\\n+ maven-bundle-plugin\\n+ true\\n+ \\n+ \\n+ ${project.name}\\n+ ${project.groupId}.${project.artifactId}\\n+ ${keycloak.osgi.import}\\n+ ${keycloak.osgi.private}\\n+ ${keycloak.osgi.export}\\n+ \\n+ \\n+ \\n+\\n+ \\n+ \\n+\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/java/org/keycloak/example/rs/CxfCustomerService.java\",\n \"diff\": \"+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.example.rs;\\n+\\n+import javax.ws.rs.GET;\\n+import javax.ws.rs.Path;\\n+import javax.ws.rs.Produces;\\n+import java.util.ArrayList;\\n+import java.util.List;\\n+\\n+/**\\n+ * @author Bill Burke\\n+ * @version $Revision: 1 $\\n+ */\\n+@Path(\\\"/customers\\\")\\n+public class CxfCustomerService {\\n+\\n+ @GET\\n+ @Produces(\\\"application/json\\\")\\n+ public List getCustomers() {\\n+ ArrayList rtn = new ArrayList();\\n+ rtn.add(\\\"Bill Burke\\\");\\n+ rtn.add(\\\"Stian Thorgersen\\\");\\n+ rtn.add(\\\"Stan Silvert\\\");\\n+ rtn.add(\\\"Gabriel Cardoso\\\");\\n+ rtn.add(\\\"Viliam Rockai\\\");\\n+ rtn.add(\\\"Marek Posolda\\\");\\n+ rtn.add(\\\"Boleslaw Dawidowicz\\\");\\n+ return rtn;\\n+ }\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": \"examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/META-INF/cxf/bus-extensions.txt\",\n \"new_path\": \"examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/META-INF/cxf/bus-extensions.txt\",\n \"diff\": \"\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml\",\n \"diff\": \"+\\n+\\n+\\n+\\n+\\n+ \\n+\\n+ \\n+\\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n+\\n+ \\n+ \\n+ \\n+ \\n+ user\\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n+\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxrs-fuse7-undertow/src/main/resources/WEB-INF/keycloak.json\",\n \"diff\": \"+{\\n+ \\\"realm\\\": \\\"demo\\\",\\n+ \\\"resource\\\": \\\"builtin-cxf-app\\\",\\n+ \\\"auth-server-url\\\": \\\"http://localhost:8080/auth\\\",\\n+ \\\"ssl-required\\\" : \\\"external\\\",\\n+ \\\"credentials\\\": {\\n+ \\\"secret\\\": \\\"password\\\"\\n+ }\\n+}\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"examples/fuse/pom.xml\",\n \"new_path\": \"examples/fuse/pom.xml\",\n \"diff\": \"product-app-fuse\\nproduct-app-fuse7-undertow\\ncxf-jaxrs\\n+ cxf-jaxrs-fuse7-undertow\\ncxf-jaxws\\ncamel\\nfeatures\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-7278 CXF JAX-RS example"}}},{"rowIdx":2931,"cells":{"author":{"kind":"number","value":339185,"string":"339,185"},"date":{"kind":"string","value":"19.05.2018 18:21:30"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"d55b1d72599ed0f292cc33514e347ab0a9031cc8"},"message":{"kind":"string","value":"CXF JAX-WS example"},"mods":{"kind":"list like","value":[{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxws-fuse7-undertow/pom.xml","diff":"+\n+\n+\n+\n+ \n+ keycloak-examples-fuse-parent\n+ org.keycloak\n+ 4.0.0.Beta3-SNAPSHOT\n+ \n+\n+ 4.0.0\n+ org.keycloak.example.demo\n+ cxf-jaxws-example-fuse7-undertow\n+ bundle\n+ CXF JAXWS Example - Secured in Karaf/Fuse 7.0 on Undertow\n+ \n+\n+ \n+ \n+ \n+ \n+ javax.jws;resolution:=optional,\n+ javax.wsdl,\n+ javax.xml.bind,\n+ javax.xml.bind.annotation,\n+ javax.xml.namespace,\n+ javax.xml.ws,\n+ META-INF.cxf;version=\"[2.7,3.3)\",\n+ META-INF.cxf.osgi;version=\"[2.7,3.3)\";resolution:=optional,\n+ org.apache.cxf.transport.http_undertow;version=\"[2.7,3.3)\";resolution:=optional,\n+ org.apache.cxf.transport.http_undertow.blueprint;version=\"[2.7,3.3)\";resolution:=optional,\n+ org.keycloak.*;version=\"${project.version}\",\n+ *;resolution:=optional\n+ \n+ \n+ org.keycloak.example.ws.*\n+ \n+ \n+\n+ \n+ \n+ org.apache.geronimo.specs\n+ geronimo-ws-metadata_2.0_spec\n+ 1.1.2\n+ \n+ \n+ org.apache.geronimo.specs\n+ geronimo-jaxws_2.2_spec\n+ 1.0\n+ \n+ \n+ javax.xml.bind\n+ jaxb-api\n+ 2.2\n+ \n+ \n+\n+ \n+ install\n+\n+ \n+ \n+ org.apache.felix\n+ maven-bundle-plugin\n+ true\n+ \n+ \n+ ${project.name}\n+ ${project.groupId}.${project.artifactId}\n+ ${keycloak.osgi.import}\n+ ${keycloak.osgi.private}\n+ ${keycloak.osgi.export}\n+ \n+ \n+ \n+\n+ \n+ \n+\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/Product.java","diff":"+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.example.ws;\n+\n+import org.keycloak.example.ws.types.ObjectFactory;\n+\n+import javax.jws.WebMethod;\n+import javax.jws.WebParam;\n+import javax.jws.WebService;\n+import javax.xml.bind.annotation.XmlSeeAlso;\n+import javax.xml.ws.RequestWrapper;\n+import javax.xml.ws.ResponseWrapper;\n+\n+@WebService\n+@XmlSeeAlso({ObjectFactory.class})\n+public interface Product {\n+\n+ @RequestWrapper(localName = \"GetProduct\", className = \"GetProduct\")\n+ @ResponseWrapper(localName = \"GetProductResponse\", className = \"GetProductResponse\")\n+ @WebMethod(operationName = \"GetProduct\")\n+ public void getProduct(\n+ @WebParam(mode = WebParam.Mode.INOUT, name = \"productId\")\n+ javax.xml.ws.Holder productId,\n+ @WebParam(mode = WebParam.Mode.OUT, name = \"name\")\n+ javax.xml.ws.Holder name\n+ ) throws UnknownProductFault;\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/ProductImpl.java","diff":"+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.example.ws;\n+\n+import javax.jws.WebService;\n+import javax.xml.ws.Holder;\n+\n+@WebService(serviceName = \"ProductService\", endpointInterface = \"org.keycloak.example.ws.Product\")\n+public class ProductImpl implements Product {\n+\n+ public void getProduct(Holder productId, Holder name)\n+ throws UnknownProductFault\n+ {\n+ if (productId.value == null || productId.value.length() == 0) {\n+ org.keycloak.example.ws.types.UnknownProductFault fault = new org.keycloak.example.ws.types.UnknownProductFault();\n+ fault.setProductId(productId.value);\n+ throw new UnknownProductFault(null,fault);\n+ } else if (productId.value.trim().equals(\"1\")) {\n+ name.value = \"IPad\";\n+ } else if (productId.value.trim().equals(\"2\")) {\n+ name.value = \"IPhone\";\n+ } else {\n+ org.keycloak.example.ws.types.UnknownProductFault fault = new org.keycloak.example.ws.types.UnknownProductFault();\n+ fault.setProductId(productId.value);\n+ throw new UnknownProductFault(null,fault);\n+ }\n+ }\n+\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/UnknownProductFault.java","diff":"+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.example.ws;\n+\n+import javax.xml.ws.WebFault;\n+\n+@WebFault(name = \"UnknownProductFault\")\n+public class UnknownProductFault extends Exception {\n+\n+ private org.keycloak.example.ws.types.UnknownProductFault unknownProductFault;\n+\n+ public UnknownProductFault() {\n+ super();\n+ }\n+\n+ public UnknownProductFault(String message) {\n+ super(message);\n+ }\n+\n+ public UnknownProductFault(String message, Throwable cause) {\n+ super(message, cause);\n+ }\n+\n+ public UnknownProductFault(String message, org.keycloak.example.ws.types.UnknownProductFault unknownProductFault) {\n+ super(message);\n+ this.unknownProductFault = unknownProductFault;\n+ }\n+\n+ public UnknownProductFault(String message, org.keycloak.example.ws.types.UnknownProductFault unknownProductFault, Throwable cause) {\n+ super(message, cause);\n+ this.unknownProductFault = unknownProductFault;\n+ }\n+\n+ public org.keycloak.example.ws.types.UnknownProductFault getFaultInfo() {\n+ return this.unknownProductFault;\n+ }\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/types/GetProduct.java","diff":"+\n+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.example.ws.types;\n+\n+import javax.xml.bind.annotation.XmlAccessType;\n+import javax.xml.bind.annotation.XmlAccessorType;\n+import javax.xml.bind.annotation.XmlElement;\n+import javax.xml.bind.annotation.XmlRootElement;\n+import javax.xml.bind.annotation.XmlType;\n+\n+\n+/**\n+ *

Java class for anonymous complex type.\n+ *\n+ *

The following schema fragment specifies the expected content contained within this class.\n+ *\n+ *

\n+ * &lt;complexType>\n+ * &lt;complexContent>\n+ * &lt;restriction base=\"{http://www.w3.org/2001/XMLSchema}anyType\">\n+ * &lt;sequence>\n+ * &lt;element name=\"productId\" type=\"{http://www.w3.org/2001/XMLSchema}string\"/>\n+ * &lt;/sequence>\n+ * &lt;/restriction>\n+ * &lt;/complexContent>\n+ * &lt;/complexType>\n+ * 
\n+ *\n+ *\n+ */\n+@XmlAccessorType(XmlAccessType.FIELD)\n+@XmlType(name = \"\", propOrder = {\n+ \"productId\"\n+})\n+@XmlRootElement(name = \"GetProduct\")\n+public class GetProduct {\n+\n+ @XmlElement(required = true)\n+ protected String productId;\n+\n+ /**\n+ * Gets the value of the productId property.\n+ *\n+ * @return\n+ * possible object is\n+ * {@link String }\n+ *\n+ */\n+ public String getProductId() {\n+ return productId;\n+ }\n+\n+ /**\n+ * Sets the value of the productId property.\n+ *\n+ * @param value\n+ * allowed object is\n+ * {@link String }\n+ *\n+ */\n+ public void setProductId(String value) {\n+ this.productId = value;\n+ }\n+\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/types/GetProductResponse.java","diff":"+\n+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.example.ws.types;\n+\n+import javax.xml.bind.annotation.XmlAccessType;\n+import javax.xml.bind.annotation.XmlAccessorType;\n+import javax.xml.bind.annotation.XmlElement;\n+import javax.xml.bind.annotation.XmlRootElement;\n+import javax.xml.bind.annotation.XmlType;\n+\n+\n+/**\n+ *

Java class for anonymous complex type.\n+ *\n+ *

The following schema fragment specifies the expected content contained within this class.\n+ *\n+ *

\n+ * &lt;complexType>\n+ * &lt;complexContent>\n+ * &lt;restriction base=\"{http://www.w3.org/2001/XMLSchema}anyType\">\n+ * &lt;sequence>\n+ * &lt;element name=\"productId\" type=\"{http://www.w3.org/2001/XMLSchema}string\"/>*\n+ * &lt;element name=\"name\" type=\"{http://www.w3.org/2001/XMLSchema}string\"/>\n+ * &lt;/sequence>\n+ * &lt;/restriction>\n+ * &lt;/complexContent>\n+ * &lt;/complexType>\n+ * 
\n+ *\n+ *\n+ */\n+@XmlAccessorType(XmlAccessType.FIELD)\n+@XmlType(name = \"\", propOrder = {\n+ \"productId\",\n+ \"name\"\n+})\n+@XmlRootElement(name = \"GetProductResponse\")\n+public class GetProductResponse {\n+\n+ @XmlElement(required = true)\n+ protected String productId;\n+ @XmlElement(required = true)\n+ protected String name;\n+\n+ /**\n+ * Gets the value of the productId property.\n+ *\n+ * @return\n+ * possible object is\n+ * {@link String }\n+ *\n+ */\n+ public String getProductId() {\n+ return productId;\n+ }\n+\n+ /**\n+ * Sets the value of the productId property.\n+ *\n+ * @param value\n+ * allowed object is\n+ * {@link String }\n+ *\n+ */\n+ public void setProductId(String value) {\n+ this.productId = value;\n+ }\n+\n+ /**\n+ * Gets the value of the name property.\n+ *\n+ * @return\n+ * possible object is\n+ * {@link String }\n+ *\n+ */\n+ public String getName() {\n+ return name;\n+ }\n+\n+ /**\n+ * Sets the value of the name property.\n+ *\n+ * @param value\n+ * allowed object is\n+ * {@link String }\n+ *\n+ */\n+ public void setName(String value) {\n+ this.name = value;\n+ }\n+\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/types/ObjectFactory.java","diff":"+\n+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.example.ws.types;\n+\n+import javax.xml.bind.annotation.XmlRegistry;\n+\n+\n+/**\n+ * This object contains factory methods for each\n+ * Java content interface and Java element interface\n+ * generated in the org.apache.servicemix.samples.wsdl_first.types package.\n+ *

An ObjectFactory allows you to programatically\n+ * construct new instances of the Java representation\n+ * for XML content. The Java representation of XML\n+ * content can consist of schema derived interfaces\n+ * and classes representing the binding of schema\n+ * type definitions, element declarations and model\n+ * groups. Factory methods for each of these are\n+ * provided in this class.\n+ *\n+ */\n+@XmlRegistry\n+public class ObjectFactory {\n+\n+\n+ /**\n+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.apache.servicemix.samples.wsdl_first.types\n+ *\n+ */\n+ public ObjectFactory() {\n+ }\n+\n+ /**\n+ * Create an instance of {@link GetProductResponse }\n+ *\n+ */\n+ public GetProductResponse createGetProductResponse() {\n+ return new GetProductResponse();\n+ }\n+\n+ /**\n+ * Create an instance of {@link GetProduct }\n+ *\n+ */\n+ public GetProduct createGetProduct() {\n+ return new GetProduct();\n+ }\n+\n+ /**\n+ * Create an instance of {@link UnknownProductFault }\n+ *\n+ */\n+ public UnknownProductFault createUnknownProductFault() {\n+ return new UnknownProductFault();\n+ }\n+\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/types/UnknownProductFault.java","diff":"+\n+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.example.ws.types;\n+\n+import javax.xml.bind.annotation.XmlAccessType;\n+import javax.xml.bind.annotation.XmlAccessorType;\n+import javax.xml.bind.annotation.XmlElement;\n+import javax.xml.bind.annotation.XmlRootElement;\n+import javax.xml.bind.annotation.XmlType;\n+\n+\n+/**\n+ *

Java class for anonymous complex type.\n+ *\n+ *

The following schema fragment specifies the expected content contained within this class.\n+ *\n+ *

\n+ * &lt;complexType>\n+ * &lt;complexContent>\n+ * &lt;restriction base=\"{http://www.w3.org/2001/XMLSchema}anyType\">\n+ * &lt;sequence>\n+ * &lt;element name=\"productId\" type=\"{http://www.w3.org/2001/XMLSchema}string\"/>\n+ * &lt;/sequence>\n+ * &lt;/restriction>\n+ * &lt;/complexContent>\n+ * &lt;/complexType>\n+ * 
\n+ *\n+ *\n+ */\n+@XmlAccessorType(XmlAccessType.FIELD)\n+@XmlType(name = \"\", propOrder = {\n+ \"productId\"\n+})\n+@XmlRootElement(name = \"UnknownProductFault\")\n+public class UnknownProductFault {\n+\n+ @XmlElement(required = true)\n+ protected String productId;\n+\n+ /**\n+ * Gets the value of the productId property.\n+ *\n+ * @return\n+ * possible object is\n+ * {@link String }\n+ *\n+ */\n+ public String getProductId() {\n+ return productId;\n+ }\n+\n+ /**\n+ * Sets the value of the productId property.\n+ *\n+ * @param value\n+ * allowed object is\n+ * {@link String }\n+ *\n+ */\n+ public void setProductId(String value) {\n+ this.productId = value;\n+ }\n+\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/types/package-info.java","diff":"+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.example.ws.types;\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml","diff":"+\n+\n+\n+\n+\n+\n+ \n+ \n+ \n+\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+\n+ \n+\n+\n\\ No newline at end of file\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/resources/WEB-INF/keycloak.json","diff":"+{\n+ \"realm\": \"demo\",\n+ \"resource\": \"custom-cxf-endpoint\",\n+ \"bearer-only\": \"true\",\n+ \"auth-server-url\": \"http://localhost:8080/auth\",\n+ \"ssl-required\" : \"external\"\n+}\n"},{"change_type":"MODIFY","old_path":"examples/fuse/pom.xml","new_path":"examples/fuse/pom.xml","diff":"cxf-jaxrs\ncxf-jaxrs-fuse7-undertow\ncxf-jaxws\n+ cxf-jaxws-fuse7-undertow\ncamel\nfeatures\nexternal-config\n"}],"string":"[\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxws-fuse7-undertow/pom.xml\",\n \"diff\": \"+\\n+\\n+\\n+\\n+ \\n+ keycloak-examples-fuse-parent\\n+ org.keycloak\\n+ 4.0.0.Beta3-SNAPSHOT\\n+ \\n+\\n+ 4.0.0\\n+ org.keycloak.example.demo\\n+ cxf-jaxws-example-fuse7-undertow\\n+ bundle\\n+ CXF JAXWS Example - Secured in Karaf/Fuse 7.0 on Undertow\\n+ \\n+\\n+ \\n+ \\n+ \\n+ \\n+ javax.jws;resolution:=optional,\\n+ javax.wsdl,\\n+ javax.xml.bind,\\n+ javax.xml.bind.annotation,\\n+ javax.xml.namespace,\\n+ javax.xml.ws,\\n+ META-INF.cxf;version=\\\"[2.7,3.3)\\\",\\n+ META-INF.cxf.osgi;version=\\\"[2.7,3.3)\\\";resolution:=optional,\\n+ org.apache.cxf.transport.http_undertow;version=\\\"[2.7,3.3)\\\";resolution:=optional,\\n+ org.apache.cxf.transport.http_undertow.blueprint;version=\\\"[2.7,3.3)\\\";resolution:=optional,\\n+ org.keycloak.*;version=\\\"${project.version}\\\",\\n+ *;resolution:=optional\\n+ \\n+ \\n+ org.keycloak.example.ws.*\\n+ \\n+ \\n+\\n+ \\n+ \\n+ org.apache.geronimo.specs\\n+ geronimo-ws-metadata_2.0_spec\\n+ 1.1.2\\n+ \\n+ \\n+ org.apache.geronimo.specs\\n+ geronimo-jaxws_2.2_spec\\n+ 1.0\\n+ \\n+ \\n+ javax.xml.bind\\n+ jaxb-api\\n+ 2.2\\n+ \\n+ \\n+\\n+ \\n+ install\\n+\\n+ \\n+ \\n+ org.apache.felix\\n+ maven-bundle-plugin\\n+ true\\n+ \\n+ \\n+ ${project.name}\\n+ ${project.groupId}.${project.artifactId}\\n+ ${keycloak.osgi.import}\\n+ ${keycloak.osgi.private}\\n+ ${keycloak.osgi.export}\\n+ \\n+ \\n+ \\n+\\n+ \\n+ \\n+\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/Product.java\",\n \"diff\": \"+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.example.ws;\\n+\\n+import org.keycloak.example.ws.types.ObjectFactory;\\n+\\n+import javax.jws.WebMethod;\\n+import javax.jws.WebParam;\\n+import javax.jws.WebService;\\n+import javax.xml.bind.annotation.XmlSeeAlso;\\n+import javax.xml.ws.RequestWrapper;\\n+import javax.xml.ws.ResponseWrapper;\\n+\\n+@WebService\\n+@XmlSeeAlso({ObjectFactory.class})\\n+public interface Product {\\n+\\n+ @RequestWrapper(localName = \\\"GetProduct\\\", className = \\\"GetProduct\\\")\\n+ @ResponseWrapper(localName = \\\"GetProductResponse\\\", className = \\\"GetProductResponse\\\")\\n+ @WebMethod(operationName = \\\"GetProduct\\\")\\n+ public void getProduct(\\n+ @WebParam(mode = WebParam.Mode.INOUT, name = \\\"productId\\\")\\n+ javax.xml.ws.Holder productId,\\n+ @WebParam(mode = WebParam.Mode.OUT, name = \\\"name\\\")\\n+ javax.xml.ws.Holder name\\n+ ) throws UnknownProductFault;\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/ProductImpl.java\",\n \"diff\": \"+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.example.ws;\\n+\\n+import javax.jws.WebService;\\n+import javax.xml.ws.Holder;\\n+\\n+@WebService(serviceName = \\\"ProductService\\\", endpointInterface = \\\"org.keycloak.example.ws.Product\\\")\\n+public class ProductImpl implements Product {\\n+\\n+ public void getProduct(Holder productId, Holder name)\\n+ throws UnknownProductFault\\n+ {\\n+ if (productId.value == null || productId.value.length() == 0) {\\n+ org.keycloak.example.ws.types.UnknownProductFault fault = new org.keycloak.example.ws.types.UnknownProductFault();\\n+ fault.setProductId(productId.value);\\n+ throw new UnknownProductFault(null,fault);\\n+ } else if (productId.value.trim().equals(\\\"1\\\")) {\\n+ name.value = \\\"IPad\\\";\\n+ } else if (productId.value.trim().equals(\\\"2\\\")) {\\n+ name.value = \\\"IPhone\\\";\\n+ } else {\\n+ org.keycloak.example.ws.types.UnknownProductFault fault = new org.keycloak.example.ws.types.UnknownProductFault();\\n+ fault.setProductId(productId.value);\\n+ throw new UnknownProductFault(null,fault);\\n+ }\\n+ }\\n+\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/UnknownProductFault.java\",\n \"diff\": \"+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.example.ws;\\n+\\n+import javax.xml.ws.WebFault;\\n+\\n+@WebFault(name = \\\"UnknownProductFault\\\")\\n+public class UnknownProductFault extends Exception {\\n+\\n+ private org.keycloak.example.ws.types.UnknownProductFault unknownProductFault;\\n+\\n+ public UnknownProductFault() {\\n+ super();\\n+ }\\n+\\n+ public UnknownProductFault(String message) {\\n+ super(message);\\n+ }\\n+\\n+ public UnknownProductFault(String message, Throwable cause) {\\n+ super(message, cause);\\n+ }\\n+\\n+ public UnknownProductFault(String message, org.keycloak.example.ws.types.UnknownProductFault unknownProductFault) {\\n+ super(message);\\n+ this.unknownProductFault = unknownProductFault;\\n+ }\\n+\\n+ public UnknownProductFault(String message, org.keycloak.example.ws.types.UnknownProductFault unknownProductFault, Throwable cause) {\\n+ super(message, cause);\\n+ this.unknownProductFault = unknownProductFault;\\n+ }\\n+\\n+ public org.keycloak.example.ws.types.UnknownProductFault getFaultInfo() {\\n+ return this.unknownProductFault;\\n+ }\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/types/GetProduct.java\",\n \"diff\": \"+\\n+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.example.ws.types;\\n+\\n+import javax.xml.bind.annotation.XmlAccessType;\\n+import javax.xml.bind.annotation.XmlAccessorType;\\n+import javax.xml.bind.annotation.XmlElement;\\n+import javax.xml.bind.annotation.XmlRootElement;\\n+import javax.xml.bind.annotation.XmlType;\\n+\\n+\\n+/**\\n+ *

Java class for anonymous complex type.\\n+ *\\n+ *

The following schema fragment specifies the expected content contained within this class.\\n+ *\\n+ *

\\n+ * &lt;complexType>\\n+ * &lt;complexContent>\\n+ * &lt;restriction base=\\\"{http://www.w3.org/2001/XMLSchema}anyType\\\">\\n+ * &lt;sequence>\\n+ * &lt;element name=\\\"productId\\\" type=\\\"{http://www.w3.org/2001/XMLSchema}string\\\"/>\\n+ * &lt;/sequence>\\n+ * &lt;/restriction>\\n+ * &lt;/complexContent>\\n+ * &lt;/complexType>\\n+ * 
\\n+ *\\n+ *\\n+ */\\n+@XmlAccessorType(XmlAccessType.FIELD)\\n+@XmlType(name = \\\"\\\", propOrder = {\\n+ \\\"productId\\\"\\n+})\\n+@XmlRootElement(name = \\\"GetProduct\\\")\\n+public class GetProduct {\\n+\\n+ @XmlElement(required = true)\\n+ protected String productId;\\n+\\n+ /**\\n+ * Gets the value of the productId property.\\n+ *\\n+ * @return\\n+ * possible object is\\n+ * {@link String }\\n+ *\\n+ */\\n+ public String getProductId() {\\n+ return productId;\\n+ }\\n+\\n+ /**\\n+ * Sets the value of the productId property.\\n+ *\\n+ * @param value\\n+ * allowed object is\\n+ * {@link String }\\n+ *\\n+ */\\n+ public void setProductId(String value) {\\n+ this.productId = value;\\n+ }\\n+\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/types/GetProductResponse.java\",\n \"diff\": \"+\\n+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.example.ws.types;\\n+\\n+import javax.xml.bind.annotation.XmlAccessType;\\n+import javax.xml.bind.annotation.XmlAccessorType;\\n+import javax.xml.bind.annotation.XmlElement;\\n+import javax.xml.bind.annotation.XmlRootElement;\\n+import javax.xml.bind.annotation.XmlType;\\n+\\n+\\n+/**\\n+ *

Java class for anonymous complex type.\\n+ *\\n+ *

The following schema fragment specifies the expected content contained within this class.\\n+ *\\n+ *

\\n+ * &lt;complexType>\\n+ * &lt;complexContent>\\n+ * &lt;restriction base=\\\"{http://www.w3.org/2001/XMLSchema}anyType\\\">\\n+ * &lt;sequence>\\n+ * &lt;element name=\\\"productId\\\" type=\\\"{http://www.w3.org/2001/XMLSchema}string\\\"/>*\\n+ * &lt;element name=\\\"name\\\" type=\\\"{http://www.w3.org/2001/XMLSchema}string\\\"/>\\n+ * &lt;/sequence>\\n+ * &lt;/restriction>\\n+ * &lt;/complexContent>\\n+ * &lt;/complexType>\\n+ * 
\\n+ *\\n+ *\\n+ */\\n+@XmlAccessorType(XmlAccessType.FIELD)\\n+@XmlType(name = \\\"\\\", propOrder = {\\n+ \\\"productId\\\",\\n+ \\\"name\\\"\\n+})\\n+@XmlRootElement(name = \\\"GetProductResponse\\\")\\n+public class GetProductResponse {\\n+\\n+ @XmlElement(required = true)\\n+ protected String productId;\\n+ @XmlElement(required = true)\\n+ protected String name;\\n+\\n+ /**\\n+ * Gets the value of the productId property.\\n+ *\\n+ * @return\\n+ * possible object is\\n+ * {@link String }\\n+ *\\n+ */\\n+ public String getProductId() {\\n+ return productId;\\n+ }\\n+\\n+ /**\\n+ * Sets the value of the productId property.\\n+ *\\n+ * @param value\\n+ * allowed object is\\n+ * {@link String }\\n+ *\\n+ */\\n+ public void setProductId(String value) {\\n+ this.productId = value;\\n+ }\\n+\\n+ /**\\n+ * Gets the value of the name property.\\n+ *\\n+ * @return\\n+ * possible object is\\n+ * {@link String }\\n+ *\\n+ */\\n+ public String getName() {\\n+ return name;\\n+ }\\n+\\n+ /**\\n+ * Sets the value of the name property.\\n+ *\\n+ * @param value\\n+ * allowed object is\\n+ * {@link String }\\n+ *\\n+ */\\n+ public void setName(String value) {\\n+ this.name = value;\\n+ }\\n+\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/types/ObjectFactory.java\",\n \"diff\": \"+\\n+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.example.ws.types;\\n+\\n+import javax.xml.bind.annotation.XmlRegistry;\\n+\\n+\\n+/**\\n+ * This object contains factory methods for each\\n+ * Java content interface and Java element interface\\n+ * generated in the org.apache.servicemix.samples.wsdl_first.types package.\\n+ *

An ObjectFactory allows you to programatically\\n+ * construct new instances of the Java representation\\n+ * for XML content. The Java representation of XML\\n+ * content can consist of schema derived interfaces\\n+ * and classes representing the binding of schema\\n+ * type definitions, element declarations and model\\n+ * groups. Factory methods for each of these are\\n+ * provided in this class.\\n+ *\\n+ */\\n+@XmlRegistry\\n+public class ObjectFactory {\\n+\\n+\\n+ /**\\n+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.apache.servicemix.samples.wsdl_first.types\\n+ *\\n+ */\\n+ public ObjectFactory() {\\n+ }\\n+\\n+ /**\\n+ * Create an instance of {@link GetProductResponse }\\n+ *\\n+ */\\n+ public GetProductResponse createGetProductResponse() {\\n+ return new GetProductResponse();\\n+ }\\n+\\n+ /**\\n+ * Create an instance of {@link GetProduct }\\n+ *\\n+ */\\n+ public GetProduct createGetProduct() {\\n+ return new GetProduct();\\n+ }\\n+\\n+ /**\\n+ * Create an instance of {@link UnknownProductFault }\\n+ *\\n+ */\\n+ public UnknownProductFault createUnknownProductFault() {\\n+ return new UnknownProductFault();\\n+ }\\n+\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/types/UnknownProductFault.java\",\n \"diff\": \"+\\n+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.example.ws.types;\\n+\\n+import javax.xml.bind.annotation.XmlAccessType;\\n+import javax.xml.bind.annotation.XmlAccessorType;\\n+import javax.xml.bind.annotation.XmlElement;\\n+import javax.xml.bind.annotation.XmlRootElement;\\n+import javax.xml.bind.annotation.XmlType;\\n+\\n+\\n+/**\\n+ *

Java class for anonymous complex type.\\n+ *\\n+ *

The following schema fragment specifies the expected content contained within this class.\\n+ *\\n+ *

\\n+ * &lt;complexType>\\n+ * &lt;complexContent>\\n+ * &lt;restriction base=\\\"{http://www.w3.org/2001/XMLSchema}anyType\\\">\\n+ * &lt;sequence>\\n+ * &lt;element name=\\\"productId\\\" type=\\\"{http://www.w3.org/2001/XMLSchema}string\\\"/>\\n+ * &lt;/sequence>\\n+ * &lt;/restriction>\\n+ * &lt;/complexContent>\\n+ * &lt;/complexType>\\n+ * 
\\n+ *\\n+ *\\n+ */\\n+@XmlAccessorType(XmlAccessType.FIELD)\\n+@XmlType(name = \\\"\\\", propOrder = {\\n+ \\\"productId\\\"\\n+})\\n+@XmlRootElement(name = \\\"UnknownProductFault\\\")\\n+public class UnknownProductFault {\\n+\\n+ @XmlElement(required = true)\\n+ protected String productId;\\n+\\n+ /**\\n+ * Gets the value of the productId property.\\n+ *\\n+ * @return\\n+ * possible object is\\n+ * {@link String }\\n+ *\\n+ */\\n+ public String getProductId() {\\n+ return productId;\\n+ }\\n+\\n+ /**\\n+ * Sets the value of the productId property.\\n+ *\\n+ * @param value\\n+ * allowed object is\\n+ * {@link String }\\n+ *\\n+ */\\n+ public void setProductId(String value) {\\n+ this.productId = value;\\n+ }\\n+\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/java/org/keycloak/example/ws/types/package-info.java\",\n \"diff\": \"+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.example.ws.types;\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml\",\n \"diff\": \"+\\n+\\n+\\n+\\n+\\n+\\n+ \\n+ \\n+ \\n+\\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n+ \\n+\\n+\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/cxf-jaxws-fuse7-undertow/src/main/resources/WEB-INF/keycloak.json\",\n \"diff\": \"+{\\n+ \\\"realm\\\": \\\"demo\\\",\\n+ \\\"resource\\\": \\\"custom-cxf-endpoint\\\",\\n+ \\\"bearer-only\\\": \\\"true\\\",\\n+ \\\"auth-server-url\\\": \\\"http://localhost:8080/auth\\\",\\n+ \\\"ssl-required\\\" : \\\"external\\\"\\n+}\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"examples/fuse/pom.xml\",\n \"new_path\": \"examples/fuse/pom.xml\",\n \"diff\": \"cxf-jaxrs\\ncxf-jaxrs-fuse7-undertow\\ncxf-jaxws\\n+ cxf-jaxws-fuse7-undertow\\ncamel\\nfeatures\\nexternal-config\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-7280 CXF JAX-WS example"}}},{"rowIdx":2932,"cells":{"author":{"kind":"number","value":339185,"string":"339,185"},"date":{"kind":"string","value":"18.05.2018 15:04:31"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"cace03c3cc583c1541d8e540c998527adb94fea9"},"message":{"kind":"string","value":"Camel/Undertow integration"},"mods":{"kind":"list like","value":[{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/camel-undertow/pom.xml","diff":"+\n+\n+\n+\n+ \n+ keycloak-fuse7-integration-pom\n+ org.keycloak\n+ 4.0.0.Beta3-SNAPSHOT\n+ ../pom.xml\n+ \n+ 4.0.0\n+\n+ keycloak-camel-undertow\n+ Keycloak Fuse 7.0 Adapter - Camel + Undertow\n+ bundle\n+\n+ \n+ \n+ org.keycloak.adapters.camel.undertow;version=\"${project.version}\"\n+ \n+ \n+ org.keycloak.*;version=\"${project.version}\",\n+ org.apache.camel.*,\n+ org.apache.camel.component.undertow,\n+ io.undertow.*,\n+ *;resolution:=optional\n+ \n+ \n+\n+ \n+ \n+ org.jboss.logging\n+ jboss-logging\n+ provided\n+ \n+ \n+ org.osgi\n+ org.osgi.core\n+ provided\n+ \n+ \n+ org.osgi\n+ org.osgi.enterprise\n+ provided\n+ \n+ \n+ org.ops4j.pax.web\n+ pax-web-runtime\n+ provided\n+ \n+ \n+ org.ops4j.pax.web\n+ pax-web-spi\n+ provided\n+ \n+ \n+ org.ops4j.pax.web\n+ pax-web-api\n+ provided\n+ \n+ \n+ io.undertow\n+ undertow-servlet\n+ provided\n+ \n+ \n+ org.keycloak\n+ keycloak-undertow-adapter\n+ provided\n+ \n+ \n+ org.apache.camel\n+ camel-undertow\n+ 2.21.0\n+ \n+ \n+ org.apache.camel\n+ camel-core\n+ 2.21.0\n+ \n+ \n+\n+ \n+ \n+ \n+ org.apache.maven.plugins\n+ maven-compiler-plugin\n+ \n+ ${maven.compiler.source}\n+ ${maven.compiler.target}\n+ \n+ \n+\n+ \n+ \n+ maven-jar-plugin\n+ \n+ \n+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF\n+ \n+ \n+ \n+ \n+ org.apache.felix\n+ maven-bundle-plugin\n+ true\n+ \n+ \n+ bundle-manifest\n+ process-classes\n+ \n+ manifest\n+ \n+ \n+ \n+ \n+ \n+ ${project.name}\n+ ${project.groupId}.${project.artifactId}\n+ ${keycloak.osgi.import}\n+ ${keycloak.osgi.export}\n+ org.apache.camel.spi.ComponentResolver;component=undertow-keycloak\n+ \n+ \n+ \n+ \n+ \n+\n"},{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/camel-undertow/src/main/java/org/keycloak/adapters/camel/undertow/UndertowKeycloakComponent.java","diff":"+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.adapters.camel.undertow;\n+\n+import java.net.URI;\n+import java.net.URISyntaxException;\n+import java.util.HashMap;\n+import java.util.Locale;\n+import java.util.Map;\n+import org.apache.camel.CamelContext;\n+import org.apache.camel.Consumer;\n+import org.apache.camel.Processor;\n+import org.apache.camel.component.undertow.RestUndertowHttpBinding;\n+import org.apache.camel.component.undertow.UndertowComponent;\n+import org.apache.camel.component.undertow.UndertowEndpoint;\n+import org.apache.camel.spi.RestConfiguration;\n+import org.apache.camel.util.FileUtil;\n+import org.apache.camel.util.HostUtils;\n+import org.apache.camel.util.ObjectHelper;\n+import org.apache.camel.util.URISupport;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public class UndertowKeycloakComponent extends UndertowComponent {\n+\n+ public UndertowKeycloakComponent() {\n+ }\n+\n+ public UndertowKeycloakComponent(CamelContext context) {\n+ super(context);\n+ }\n+\n+ @Override\n+ protected UndertowEndpoint createEndpointInstance(URI endpointUri, UndertowComponent component) throws URISyntaxException {\n+ return new UndertowKeycloakEndpoint(endpointUri.toString(), component);\n+ }\n+\n+ // TODO: uncomment line below after backport of https://issues.apache.org/jira/browse/CAMEL-12514 into fuse\n+// @Override\n+ protected String getComponentName() {\n+ return \"undertow-keycloak\";\n+ }\n+\n+ // TODO: remove all below this line after backport of https://issues.apache.org/jira/browse/CAMEL-12514 into fuse\n+ @Override\n+ public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,\n+ String consumes, String produces, RestConfiguration configuration, Map parameters) throws Exception {\n+ return doCreateConsumer(camelContext, processor, verb, basePath, uriTemplate, consumes, produces, configuration, parameters, false);\n+ }\n+\n+ @Override\n+ public Consumer createApiConsumer(CamelContext camelContext, Processor processor, String contextPath,\n+ RestConfiguration configuration, Map parameters) throws Exception {\n+ // reuse the createConsumer method we already have. The api need to use GET and match on uri prefix\n+ return doCreateConsumer(camelContext, processor, \"GET\", contextPath, null, null, null, configuration, parameters, true);\n+ }\n+\n+ Consumer doCreateConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,\n+ String consumes, String produces, RestConfiguration configuration, Map parameters, boolean api) throws Exception {\n+ String path = basePath;\n+ if (uriTemplate != null) {\n+ // make sure to avoid double slashes\n+ if (uriTemplate.startsWith(\"/\")) {\n+ path = path + uriTemplate;\n+ } else {\n+ path = path + \"/\" + uriTemplate;\n+ }\n+ }\n+ path = FileUtil.stripLeadingSeparator(path);\n+ String scheme = \"http\";\n+ String host = \"\";\n+ int port = 0;\n+\n+ RestConfiguration config = configuration;\n+ if (config == null) {\n+ config = camelContext.getRestConfiguration(getComponentName(), true);\n+ }\n+ if (config.getScheme() != null) {\n+ scheme = config.getScheme();\n+ }\n+ if (config.getHost() != null) {\n+ host = config.getHost();\n+ }\n+ int num = config.getPort();\n+ if (num > 0) {\n+ port = num;\n+ }\n+\n+ // prefix path with context-path if configured in rest-dsl configuration\n+ String contextPath = config.getContextPath();\n+ if (ObjectHelper.isNotEmpty(contextPath)) {\n+ contextPath = FileUtil.stripTrailingSeparator(contextPath);\n+ contextPath = FileUtil.stripLeadingSeparator(contextPath);\n+ if (ObjectHelper.isNotEmpty(contextPath)) {\n+ path = contextPath + \"/\" + path;\n+ }\n+ }\n+\n+ // if no explicit hostname set then resolve the hostname\n+ if (ObjectHelper.isEmpty(host)) {\n+ if (config.getRestHostNameResolver() == RestConfiguration.RestHostNameResolver.allLocalIp) {\n+ host = \"0.0.0.0\";\n+ } else if (config.getRestHostNameResolver() == RestConfiguration.RestHostNameResolver.localHostName) {\n+ host = HostUtils.getLocalHostName();\n+ } else if (config.getRestHostNameResolver() == RestConfiguration.RestHostNameResolver.localIp) {\n+ host = HostUtils.getLocalIp();\n+ }\n+ }\n+\n+ Map map = new HashMap();\n+ // build query string, and append any endpoint configuration properties\n+ if (config.getComponent() == null || config.getComponent().equals(getComponentName())) {\n+ // setup endpoint options\n+ if (config.getEndpointProperties() != null && !config.getEndpointProperties().isEmpty()) {\n+ map.putAll(config.getEndpointProperties());\n+ }\n+ }\n+\n+ boolean explicitOptions = true;\n+ // must use upper case for restrict\n+ String restrict = verb.toUpperCase(Locale.US);\n+ // allow OPTIONS in rest-dsl to allow clients to call the API and have responses with ALLOW headers\n+ if (!restrict.contains(\"OPTIONS\")) {\n+ restrict += \",OPTIONS\";\n+ // this is not an explicit OPTIONS path in the rest-dsl\n+ explicitOptions = false;\n+ }\n+\n+ boolean cors = config.isEnableCORS();\n+ if (cors) {\n+ // allow HTTP Options as we want to handle CORS in rest-dsl\n+ map.put(\"optionsEnabled\", \"true\");\n+ } else if (explicitOptions) {\n+ // the rest-dsl is using OPTIONS\n+ map.put(\"optionsEnabled\", \"true\");\n+ }\n+\n+ String query = URISupport.createQueryString(map);\n+\n+ String url;\n+ if (api) {\n+ url = getComponentName() + \":%s://%s:%s/%s?matchOnUriPrefix=true&httpMethodRestrict=%s\";\n+ } else {\n+ url = getComponentName() + \":%s://%s:%s/%s?matchOnUriPrefix=false&httpMethodRestrict=%s\";\n+ }\n+\n+ // get the endpoint\n+ url = String.format(url, scheme, host, port, path, restrict);\n+\n+ if (!query.isEmpty()) {\n+ url = url + \"&\" + query;\n+ }\n+\n+ UndertowEndpoint endpoint = camelContext.getEndpoint(url, UndertowEndpoint.class);\n+ setProperties(camelContext, endpoint, parameters);\n+\n+ if (!map.containsKey(\"undertowHttpBinding\")) {\n+ // use the rest binding, if not using a custom http binding\n+ endpoint.setUndertowHttpBinding(new RestUndertowHttpBinding());\n+ }\n+\n+ // configure consumer properties\n+ Consumer consumer = endpoint.createConsumer(processor);\n+ if (config.getConsumerProperties() != null && !config.getConsumerProperties().isEmpty()) {\n+ setProperties(camelContext, consumer, config.getConsumerProperties());\n+ }\n+\n+ return consumer;\n+ }\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/camel-undertow/src/main/java/org/keycloak/adapters/camel/undertow/UndertowKeycloakConsumer.java","diff":"+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.adapters.camel.undertow;\n+\n+import org.keycloak.KeycloakPrincipal;\n+import org.keycloak.adapters.AdapterDeploymentContext;\n+import org.keycloak.adapters.AdapterTokenStore;\n+import org.keycloak.adapters.AuthenticatedActionsHandler;\n+import org.keycloak.adapters.KeycloakDeployment;\n+import org.keycloak.adapters.NodesRegistrationManagement;\n+import org.keycloak.adapters.PreAuthActionsHandler;\n+import org.keycloak.adapters.RequestAuthenticator;\n+import org.keycloak.adapters.spi.AuthChallenge;\n+import org.keycloak.adapters.spi.AuthOutcome;\n+import org.keycloak.adapters.spi.HttpFacade;\n+import org.keycloak.adapters.spi.InMemorySessionIdMapper;\n+import org.keycloak.adapters.spi.SessionIdMapper;\n+import org.keycloak.adapters.undertow.KeycloakUndertowAccount;\n+import org.keycloak.adapters.undertow.OIDCUndertowHttpFacade;\n+import org.keycloak.adapters.undertow.SessionManagementBridge;\n+import org.keycloak.adapters.undertow.UndertowCookieTokenStore;\n+import org.keycloak.adapters.undertow.UndertowRequestAuthenticator;\n+import org.keycloak.adapters.undertow.UndertowSessionTokenStore;\n+import org.keycloak.adapters.undertow.UndertowUserSessionManagement;\n+import org.keycloak.enums.TokenStore;\n+import io.undertow.security.api.SecurityContext;\n+import io.undertow.security.idm.Account;\n+import io.undertow.security.idm.Credential;\n+import io.undertow.security.idm.IdentityManager;\n+import io.undertow.security.impl.SecurityContextImpl;\n+import io.undertow.server.HttpServerExchange;\n+import io.undertow.server.session.InMemorySessionManager;\n+import io.undertow.server.session.SessionManager;\n+import io.undertow.util.AttachmentKey;\n+import io.undertow.util.StatusCodes;\n+import java.util.Collections;\n+import java.util.List;\n+import java.util.Optional;\n+import java.util.Set;\n+import java.util.logging.Level;\n+import java.util.logging.Logger;\n+import java.util.regex.Pattern;\n+import org.apache.camel.Processor;\n+import org.apache.camel.component.undertow.UndertowConsumer;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public class UndertowKeycloakConsumer extends UndertowConsumer {\n+\n+ private static final Logger LOG = Logger.getLogger(UndertowKeycloakConsumer.class.getName());\n+\n+ public static final AttachmentKey KEYCLOAK_PRINCIPAL_KEY = AttachmentKey.create(KeycloakPrincipal.class);\n+\n+ private static final IdentityManager IDENTITY_MANAGER = new IdentityManager() {\n+ @Override\n+ public Account verify(Account account) {\n+ return account;\n+ }\n+\n+ @Override\n+ public Account verify(String id, Credential credential) {\n+ throw new IllegalStateException(\"Should never be called in Keycloak flow\");\n+ }\n+\n+ @Override\n+ public Account verify(Credential credential) {\n+ throw new IllegalStateException(\"Should never be called in Keycloak flow\");\n+ }\n+ };\n+\n+ protected SessionIdMapper idMapper = new InMemorySessionIdMapper();\n+\n+ protected final NodesRegistrationManagement nodesRegistrationManagement = new NodesRegistrationManagement();\n+\n+ private final UndertowUserSessionManagement userSessionManagement = new UndertowUserSessionManagement();\n+\n+ protected final AdapterDeploymentContext deploymentContext;\n+\n+ protected final SessionManager sessionManager;\n+\n+ protected final List allowedRoles;\n+\n+ private final int confidentialPort;\n+\n+ private final Pattern skipPattern;\n+\n+ public UndertowKeycloakConsumer(UndertowKeycloakEndpoint endpoint, Processor processor,\n+ AdapterDeploymentContext deploymentContext, Pattern skipPattern, List allowedRoles, int confidentialPort) {\n+ super(endpoint, processor);\n+ this.sessionManager = new InMemorySessionManager(endpoint.getEndpointUri());\n+ this.deploymentContext = deploymentContext;\n+ this.skipPattern = skipPattern;\n+ this.confidentialPort = confidentialPort;\n+ this.allowedRoles = allowedRoles == null ? Collections.emptyList() : allowedRoles;\n+ }\n+\n+ public int getConfidentialPort() {\n+ return confidentialPort;\n+ }\n+\n+ @Override\n+ public void handleRequest(HttpServerExchange httpExchange) throws Exception {\n+ if (shouldSkip(httpExchange.getRequestPath())) {\n+ super.handleRequest(httpExchange);\n+ return;\n+ }\n+\n+ //perform only non-blocking operation on exchange\n+ if (httpExchange.isInIoThread()) {\n+ httpExchange.dispatch(this);\n+ return;\n+ }\n+\n+ OIDCUndertowHttpFacade facade = new OIDCUndertowHttpFacade(httpExchange);\n+ KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade);\n+\n+ if (deployment == null || !deployment.isConfigured()) {\n+ httpExchange.setStatusCode(StatusCodes.FORBIDDEN);\n+ LOG.fine(\"deployment not configured\");\n+ return;\n+ }\n+\n+ LOG.fine(\"executing PreAuthActionsHandler\");\n+ SessionManagementBridge bridge = new SessionManagementBridge(userSessionManagement, sessionManager);\n+ PreAuthActionsHandler preAuth = new PreAuthActionsHandler(bridge, deploymentContext, facade);\n+ if (preAuth.handleRequest()) return;\n+\n+ SecurityContext securityContext = httpExchange.getSecurityContext();\n+ if (securityContext == null) {\n+ securityContext = new SecurityContextImpl(httpExchange, IDENTITY_MANAGER);\n+ }\n+ AdapterTokenStore tokenStore = getTokenStore(httpExchange, facade, deployment, securityContext);\n+ tokenStore.checkCurrentToken();\n+\n+ LOG.fine(\"executing AuthenticatedActionsHandler\");\n+ RequestAuthenticator authenticator = new UndertowRequestAuthenticator(facade, deployment, confidentialPort, securityContext, httpExchange, tokenStore);\n+ AuthOutcome outcome = authenticator.authenticate();\n+\n+ if (outcome == AuthOutcome.AUTHENTICATED) {\n+ LOG.fine(\"AUTHENTICATED\");\n+ if (httpExchange.isResponseComplete()) {\n+ return;\n+ }\n+ AuthenticatedActionsHandler actions = new AuthenticatedActionsHandler(deployment, facade);\n+ if (actions.handledRequest()) {\n+ return;\n+ } else {\n+ final Account authenticatedAccount = securityContext.getAuthenticatedAccount();\n+ if (authenticatedAccount instanceof KeycloakUndertowAccount) {\n+ final KeycloakUndertowAccount kua = (KeycloakUndertowAccount) authenticatedAccount;\n+ httpExchange.putAttachment(KEYCLOAK_PRINCIPAL_KEY, (KeycloakPrincipal) kua.getPrincipal());\n+ }\n+\n+ Set roles = Optional\n+ .ofNullable(authenticatedAccount.getRoles())\n+ .orElse((Set) Collections.EMPTY_SET);\n+\n+ LOG.log(Level.FINE, \"Allowed roles: {0}, current roles: {1}\", new Object[] {allowedRoles, roles});\n+\n+ if (isRoleAllowed(roles, httpExchange)) {\n+ super.handleRequest(httpExchange);\n+ } else {\n+ httpExchange.setStatusCode(StatusCodes.FORBIDDEN);\n+ }\n+\n+ return;\n+ }\n+ }\n+\n+ AuthChallenge challenge = authenticator.getChallenge();\n+ if (challenge != null) {\n+ LOG.fine(\"challenge\");\n+ challenge.challenge(facade);\n+ return;\n+ }\n+\n+ httpExchange.setStatusCode(StatusCodes.FORBIDDEN);\n+ }\n+\n+ public boolean isRoleAllowed(Set roles, HttpServerExchange httpExchange) throws Exception {\n+ for (String role : allowedRoles) {\n+ if (roles.contains(role)) {\n+ return true;\n+ }\n+ }\n+\n+ return false;\n+ }\n+\n+ protected AdapterTokenStore getTokenStore(HttpServerExchange exchange, HttpFacade facade, KeycloakDeployment deployment, SecurityContext securityContext) {\n+ if (deployment.getTokenStore() == TokenStore.SESSION) {\n+ return new UndertowSessionTokenStore(exchange, deployment, userSessionManagement, securityContext);\n+ } else {\n+ return new UndertowCookieTokenStore(facade, deployment, securityContext);\n+ }\n+ }\n+\n+ private boolean shouldSkip(String requestPath) {\n+ return skipPattern != null && skipPattern.matcher(requestPath).matches();\n+ }\n+\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/camel-undertow/src/main/java/org/keycloak/adapters/camel/undertow/UndertowKeycloakEndpoint.java","diff":"+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.adapters.camel.undertow;\n+\n+import org.keycloak.KeycloakPrincipal;\n+import org.keycloak.adapters.AdapterDeploymentContext;\n+import org.keycloak.adapters.KeycloakConfigResolver;\n+import org.keycloak.adapters.KeycloakDeployment;\n+import org.keycloak.adapters.KeycloakDeploymentBuilder;\n+import org.keycloak.representations.adapters.config.AdapterConfig;\n+import io.undertow.server.HttpServerExchange;\n+import java.util.Arrays;\n+import java.util.Collections;\n+import java.util.List;\n+import java.util.logging.Level;\n+import java.util.logging.Logger;\n+import java.util.regex.Pattern;\n+import org.apache.camel.Consumer;\n+import org.apache.camel.Exchange;\n+import org.apache.camel.Processor;\n+import org.apache.camel.component.undertow.UndertowComponent;\n+import org.apache.camel.component.undertow.UndertowEndpoint;\n+import static org.keycloak.adapters.camel.undertow.UndertowKeycloakConsumer.KEYCLOAK_PRINCIPAL_KEY;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public class UndertowKeycloakEndpoint extends UndertowEndpoint {\n+\n+ private static final Logger LOG = Logger.getLogger(UndertowKeycloakEndpoint.class.getName());\n+\n+ private KeycloakConfigResolver configResolver;\n+\n+ private AdapterConfig adapterConfig;\n+\n+ private String skipPattern;\n+\n+ private List allowedRoles = Collections.emptyList();\n+\n+ private int confidentialPort = 8443;\n+\n+ public UndertowKeycloakEndpoint(String uri, UndertowComponent component) {\n+ super(uri, component);\n+ }\n+\n+ public AdapterConfig getAdapterConfig() {\n+ return adapterConfig;\n+ }\n+\n+ public void setAdapterConfig(AdapterConfig adapterConfig) {\n+ LOG.info(\"adapterConfig\");\n+ this.adapterConfig = adapterConfig;\n+ }\n+\n+ public String getSkipPattern() {\n+ return skipPattern;\n+ }\n+\n+ public void setSkipPattern(String skipPattern) {\n+ this.skipPattern = skipPattern;\n+ }\n+\n+ public List getAllowedRoles() {\n+ return allowedRoles;\n+ }\n+\n+ public void setAllowedRoles(List allowedRoles) {\n+ this.allowedRoles = allowedRoles;\n+ }\n+\n+ public void setAllowedRoles(String allowedRoles) {\n+ this.allowedRoles = allowedRoles == null ? null : Arrays.asList(allowedRoles.split(\"\\\\s*,\\\\s*\"));\n+ }\n+\n+ public int getConfidentialPort() {\n+ return confidentialPort;\n+ }\n+\n+ public void setConfidentialPort(int confidentialPort) {\n+ this.confidentialPort = confidentialPort;\n+ }\n+\n+ public KeycloakConfigResolver getConfigResolver() {\n+ return configResolver;\n+ }\n+\n+ public void setConfigResolver(KeycloakConfigResolver configResolver) {\n+ this.configResolver = configResolver;\n+ }\n+\n+ @Override\n+ public Consumer createConsumer(Processor processor) throws Exception {\n+ return new UndertowKeycloakConsumer(this, processor, getDeploymentContext(), getSkipPatternAsPattern(), computeAllowedRoles(), this.confidentialPort);\n+ }\n+\n+ public List computeAllowedRoles() {\n+ List res = this.allowedRoles == null ? Collections.emptyList() : this.allowedRoles;\n+ if (res.isEmpty()) {\n+ LOG.warning(\"No roles were configured, Keycloak will deny every request\");\n+ }\n+ LOG.log(Level.FINE, \"Allowed roles: {0}\", res);\n+ return res;\n+ }\n+\n+ @Override\n+ public Exchange createExchange(HttpServerExchange httpExchange) throws Exception {\n+ final Exchange res = super.createExchange(httpExchange);\n+\n+ KeycloakPrincipal principal = httpExchange.getAttachment(KEYCLOAK_PRINCIPAL_KEY);\n+ LOG.log(Level.FINE, \"principal: {0}\", principal);\n+ if (principal != null) {\n+ res.setProperty(KeycloakPrincipal.class.getName(), principal);\n+ }\n+\n+ return res;\n+ }\n+\n+ private AdapterDeploymentContext getDeploymentContext() {\n+ if (configResolver != null) {\n+ LOG.log(Level.INFO, \"Using {0} to resolve Keycloak configuration on a per-request basis.\", configResolver.getClass());\n+ return new AdapterDeploymentContext(configResolver);\n+ } else if (adapterConfig != null) {\n+ KeycloakDeployment kd = KeycloakDeploymentBuilder.build(adapterConfig);\n+ return new AdapterDeploymentContext(kd);\n+ }\n+\n+ LOG.warning(\"Adapter is unconfigured, Keycloak will deny every request\");\n+ return new AdapterDeploymentContext();\n+ }\n+\n+ private Pattern getSkipPatternAsPattern() {\n+ return skipPattern == null\n+ ? null\n+ : Pattern.compile(skipPattern, Pattern.DOTALL);\n+ }\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/camel-undertow/src/main/resources/META-INF/services/org/apache/camel/component/undertow-keycloak","diff":"+class=org.keycloak.adapters.camel.undertow.UndertowKeycloakComponent\n\\ No newline at end of file\n"},{"change_type":"MODIFY","old_path":"adapters/oidc/fuse7/pom.xml","new_path":"adapters/oidc/fuse7/pom.xml","diff":"\n\n+ camel-undertow\nundertow\n\n\n"},{"change_type":"MODIFY","old_path":"distribution/adapters/osgi/features/src/main/resources/features.xml","new_path":"distribution/adapters/osgi/features/src/main/resources/features.xml","diff":"mvn:org.keycloak/keycloak-undertow-adapter/${project.version}\nmvn:org.keycloak/keycloak-undertow-adapter-spi/${project.version}\nmvn:org.keycloak/keycloak-pax-web-undertow/${project.version}\n+ mvn:org.keycloak/keycloak-camel-undertow/${project.version}\n\n\n"}],"string":"[\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/camel-undertow/pom.xml\",\n \"diff\": \"+\\n+\\n+\\n+\\n+ \\n+ keycloak-fuse7-integration-pom\\n+ org.keycloak\\n+ 4.0.0.Beta3-SNAPSHOT\\n+ ../pom.xml\\n+ \\n+ 4.0.0\\n+\\n+ keycloak-camel-undertow\\n+ Keycloak Fuse 7.0 Adapter - Camel + Undertow\\n+ bundle\\n+\\n+ \\n+ \\n+ org.keycloak.adapters.camel.undertow;version=\\\"${project.version}\\\"\\n+ \\n+ \\n+ org.keycloak.*;version=\\\"${project.version}\\\",\\n+ org.apache.camel.*,\\n+ org.apache.camel.component.undertow,\\n+ io.undertow.*,\\n+ *;resolution:=optional\\n+ \\n+ \\n+\\n+ \\n+ \\n+ org.jboss.logging\\n+ jboss-logging\\n+ provided\\n+ \\n+ \\n+ org.osgi\\n+ org.osgi.core\\n+ provided\\n+ \\n+ \\n+ org.osgi\\n+ org.osgi.enterprise\\n+ provided\\n+ \\n+ \\n+ org.ops4j.pax.web\\n+ pax-web-runtime\\n+ provided\\n+ \\n+ \\n+ org.ops4j.pax.web\\n+ pax-web-spi\\n+ provided\\n+ \\n+ \\n+ org.ops4j.pax.web\\n+ pax-web-api\\n+ provided\\n+ \\n+ \\n+ io.undertow\\n+ undertow-servlet\\n+ provided\\n+ \\n+ \\n+ org.keycloak\\n+ keycloak-undertow-adapter\\n+ provided\\n+ \\n+ \\n+ org.apache.camel\\n+ camel-undertow\\n+ 2.21.0\\n+ \\n+ \\n+ org.apache.camel\\n+ camel-core\\n+ 2.21.0\\n+ \\n+ \\n+\\n+ \\n+ \\n+ \\n+ org.apache.maven.plugins\\n+ maven-compiler-plugin\\n+ \\n+ ${maven.compiler.source}\\n+ ${maven.compiler.target}\\n+ \\n+ \\n+\\n+ \\n+ \\n+ maven-jar-plugin\\n+ \\n+ \\n+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF\\n+ \\n+ \\n+ \\n+ \\n+ org.apache.felix\\n+ maven-bundle-plugin\\n+ true\\n+ \\n+ \\n+ bundle-manifest\\n+ process-classes\\n+ \\n+ manifest\\n+ \\n+ \\n+ \\n+ \\n+ \\n+ ${project.name}\\n+ ${project.groupId}.${project.artifactId}\\n+ ${keycloak.osgi.import}\\n+ ${keycloak.osgi.export}\\n+ org.apache.camel.spi.ComponentResolver;component=undertow-keycloak\\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/camel-undertow/src/main/java/org/keycloak/adapters/camel/undertow/UndertowKeycloakComponent.java\",\n \"diff\": \"+/*\\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.adapters.camel.undertow;\\n+\\n+import java.net.URI;\\n+import java.net.URISyntaxException;\\n+import java.util.HashMap;\\n+import java.util.Locale;\\n+import java.util.Map;\\n+import org.apache.camel.CamelContext;\\n+import org.apache.camel.Consumer;\\n+import org.apache.camel.Processor;\\n+import org.apache.camel.component.undertow.RestUndertowHttpBinding;\\n+import org.apache.camel.component.undertow.UndertowComponent;\\n+import org.apache.camel.component.undertow.UndertowEndpoint;\\n+import org.apache.camel.spi.RestConfiguration;\\n+import org.apache.camel.util.FileUtil;\\n+import org.apache.camel.util.HostUtils;\\n+import org.apache.camel.util.ObjectHelper;\\n+import org.apache.camel.util.URISupport;\\n+\\n+/**\\n+ *\\n+ * @author hmlnarik\\n+ */\\n+public class UndertowKeycloakComponent extends UndertowComponent {\\n+\\n+ public UndertowKeycloakComponent() {\\n+ }\\n+\\n+ public UndertowKeycloakComponent(CamelContext context) {\\n+ super(context);\\n+ }\\n+\\n+ @Override\\n+ protected UndertowEndpoint createEndpointInstance(URI endpointUri, UndertowComponent component) throws URISyntaxException {\\n+ return new UndertowKeycloakEndpoint(endpointUri.toString(), component);\\n+ }\\n+\\n+ // TODO: uncomment line below after backport of https://issues.apache.org/jira/browse/CAMEL-12514 into fuse\\n+// @Override\\n+ protected String getComponentName() {\\n+ return \\\"undertow-keycloak\\\";\\n+ }\\n+\\n+ // TODO: remove all below this line after backport of https://issues.apache.org/jira/browse/CAMEL-12514 into fuse\\n+ @Override\\n+ public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,\\n+ String consumes, String produces, RestConfiguration configuration, Map parameters) throws Exception {\\n+ return doCreateConsumer(camelContext, processor, verb, basePath, uriTemplate, consumes, produces, configuration, parameters, false);\\n+ }\\n+\\n+ @Override\\n+ public Consumer createApiConsumer(CamelContext camelContext, Processor processor, String contextPath,\\n+ RestConfiguration configuration, Map parameters) throws Exception {\\n+ // reuse the createConsumer method we already have. The api need to use GET and match on uri prefix\\n+ return doCreateConsumer(camelContext, processor, \\\"GET\\\", contextPath, null, null, null, configuration, parameters, true);\\n+ }\\n+\\n+ Consumer doCreateConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,\\n+ String consumes, String produces, RestConfiguration configuration, Map parameters, boolean api) throws Exception {\\n+ String path = basePath;\\n+ if (uriTemplate != null) {\\n+ // make sure to avoid double slashes\\n+ if (uriTemplate.startsWith(\\\"/\\\")) {\\n+ path = path + uriTemplate;\\n+ } else {\\n+ path = path + \\\"/\\\" + uriTemplate;\\n+ }\\n+ }\\n+ path = FileUtil.stripLeadingSeparator(path);\\n+ String scheme = \\\"http\\\";\\n+ String host = \\\"\\\";\\n+ int port = 0;\\n+\\n+ RestConfiguration config = configuration;\\n+ if (config == null) {\\n+ config = camelContext.getRestConfiguration(getComponentName(), true);\\n+ }\\n+ if (config.getScheme() != null) {\\n+ scheme = config.getScheme();\\n+ }\\n+ if (config.getHost() != null) {\\n+ host = config.getHost();\\n+ }\\n+ int num = config.getPort();\\n+ if (num > 0) {\\n+ port = num;\\n+ }\\n+\\n+ // prefix path with context-path if configured in rest-dsl configuration\\n+ String contextPath = config.getContextPath();\\n+ if (ObjectHelper.isNotEmpty(contextPath)) {\\n+ contextPath = FileUtil.stripTrailingSeparator(contextPath);\\n+ contextPath = FileUtil.stripLeadingSeparator(contextPath);\\n+ if (ObjectHelper.isNotEmpty(contextPath)) {\\n+ path = contextPath + \\\"/\\\" + path;\\n+ }\\n+ }\\n+\\n+ // if no explicit hostname set then resolve the hostname\\n+ if (ObjectHelper.isEmpty(host)) {\\n+ if (config.getRestHostNameResolver() == RestConfiguration.RestHostNameResolver.allLocalIp) {\\n+ host = \\\"0.0.0.0\\\";\\n+ } else if (config.getRestHostNameResolver() == RestConfiguration.RestHostNameResolver.localHostName) {\\n+ host = HostUtils.getLocalHostName();\\n+ } else if (config.getRestHostNameResolver() == RestConfiguration.RestHostNameResolver.localIp) {\\n+ host = HostUtils.getLocalIp();\\n+ }\\n+ }\\n+\\n+ Map map = new HashMap();\\n+ // build query string, and append any endpoint configuration properties\\n+ if (config.getComponent() == null || config.getComponent().equals(getComponentName())) {\\n+ // setup endpoint options\\n+ if (config.getEndpointProperties() != null && !config.getEndpointProperties().isEmpty()) {\\n+ map.putAll(config.getEndpointProperties());\\n+ }\\n+ }\\n+\\n+ boolean explicitOptions = true;\\n+ // must use upper case for restrict\\n+ String restrict = verb.toUpperCase(Locale.US);\\n+ // allow OPTIONS in rest-dsl to allow clients to call the API and have responses with ALLOW headers\\n+ if (!restrict.contains(\\\"OPTIONS\\\")) {\\n+ restrict += \\\",OPTIONS\\\";\\n+ // this is not an explicit OPTIONS path in the rest-dsl\\n+ explicitOptions = false;\\n+ }\\n+\\n+ boolean cors = config.isEnableCORS();\\n+ if (cors) {\\n+ // allow HTTP Options as we want to handle CORS in rest-dsl\\n+ map.put(\\\"optionsEnabled\\\", \\\"true\\\");\\n+ } else if (explicitOptions) {\\n+ // the rest-dsl is using OPTIONS\\n+ map.put(\\\"optionsEnabled\\\", \\\"true\\\");\\n+ }\\n+\\n+ String query = URISupport.createQueryString(map);\\n+\\n+ String url;\\n+ if (api) {\\n+ url = getComponentName() + \\\":%s://%s:%s/%s?matchOnUriPrefix=true&httpMethodRestrict=%s\\\";\\n+ } else {\\n+ url = getComponentName() + \\\":%s://%s:%s/%s?matchOnUriPrefix=false&httpMethodRestrict=%s\\\";\\n+ }\\n+\\n+ // get the endpoint\\n+ url = String.format(url, scheme, host, port, path, restrict);\\n+\\n+ if (!query.isEmpty()) {\\n+ url = url + \\\"&\\\" + query;\\n+ }\\n+\\n+ UndertowEndpoint endpoint = camelContext.getEndpoint(url, UndertowEndpoint.class);\\n+ setProperties(camelContext, endpoint, parameters);\\n+\\n+ if (!map.containsKey(\\\"undertowHttpBinding\\\")) {\\n+ // use the rest binding, if not using a custom http binding\\n+ endpoint.setUndertowHttpBinding(new RestUndertowHttpBinding());\\n+ }\\n+\\n+ // configure consumer properties\\n+ Consumer consumer = endpoint.createConsumer(processor);\\n+ if (config.getConsumerProperties() != null && !config.getConsumerProperties().isEmpty()) {\\n+ setProperties(camelContext, consumer, config.getConsumerProperties());\\n+ }\\n+\\n+ return consumer;\\n+ }\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/camel-undertow/src/main/java/org/keycloak/adapters/camel/undertow/UndertowKeycloakConsumer.java\",\n \"diff\": \"+/*\\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.adapters.camel.undertow;\\n+\\n+import org.keycloak.KeycloakPrincipal;\\n+import org.keycloak.adapters.AdapterDeploymentContext;\\n+import org.keycloak.adapters.AdapterTokenStore;\\n+import org.keycloak.adapters.AuthenticatedActionsHandler;\\n+import org.keycloak.adapters.KeycloakDeployment;\\n+import org.keycloak.adapters.NodesRegistrationManagement;\\n+import org.keycloak.adapters.PreAuthActionsHandler;\\n+import org.keycloak.adapters.RequestAuthenticator;\\n+import org.keycloak.adapters.spi.AuthChallenge;\\n+import org.keycloak.adapters.spi.AuthOutcome;\\n+import org.keycloak.adapters.spi.HttpFacade;\\n+import org.keycloak.adapters.spi.InMemorySessionIdMapper;\\n+import org.keycloak.adapters.spi.SessionIdMapper;\\n+import org.keycloak.adapters.undertow.KeycloakUndertowAccount;\\n+import org.keycloak.adapters.undertow.OIDCUndertowHttpFacade;\\n+import org.keycloak.adapters.undertow.SessionManagementBridge;\\n+import org.keycloak.adapters.undertow.UndertowCookieTokenStore;\\n+import org.keycloak.adapters.undertow.UndertowRequestAuthenticator;\\n+import org.keycloak.adapters.undertow.UndertowSessionTokenStore;\\n+import org.keycloak.adapters.undertow.UndertowUserSessionManagement;\\n+import org.keycloak.enums.TokenStore;\\n+import io.undertow.security.api.SecurityContext;\\n+import io.undertow.security.idm.Account;\\n+import io.undertow.security.idm.Credential;\\n+import io.undertow.security.idm.IdentityManager;\\n+import io.undertow.security.impl.SecurityContextImpl;\\n+import io.undertow.server.HttpServerExchange;\\n+import io.undertow.server.session.InMemorySessionManager;\\n+import io.undertow.server.session.SessionManager;\\n+import io.undertow.util.AttachmentKey;\\n+import io.undertow.util.StatusCodes;\\n+import java.util.Collections;\\n+import java.util.List;\\n+import java.util.Optional;\\n+import java.util.Set;\\n+import java.util.logging.Level;\\n+import java.util.logging.Logger;\\n+import java.util.regex.Pattern;\\n+import org.apache.camel.Processor;\\n+import org.apache.camel.component.undertow.UndertowConsumer;\\n+\\n+/**\\n+ *\\n+ * @author hmlnarik\\n+ */\\n+public class UndertowKeycloakConsumer extends UndertowConsumer {\\n+\\n+ private static final Logger LOG = Logger.getLogger(UndertowKeycloakConsumer.class.getName());\\n+\\n+ public static final AttachmentKey KEYCLOAK_PRINCIPAL_KEY = AttachmentKey.create(KeycloakPrincipal.class);\\n+\\n+ private static final IdentityManager IDENTITY_MANAGER = new IdentityManager() {\\n+ @Override\\n+ public Account verify(Account account) {\\n+ return account;\\n+ }\\n+\\n+ @Override\\n+ public Account verify(String id, Credential credential) {\\n+ throw new IllegalStateException(\\\"Should never be called in Keycloak flow\\\");\\n+ }\\n+\\n+ @Override\\n+ public Account verify(Credential credential) {\\n+ throw new IllegalStateException(\\\"Should never be called in Keycloak flow\\\");\\n+ }\\n+ };\\n+\\n+ protected SessionIdMapper idMapper = new InMemorySessionIdMapper();\\n+\\n+ protected final NodesRegistrationManagement nodesRegistrationManagement = new NodesRegistrationManagement();\\n+\\n+ private final UndertowUserSessionManagement userSessionManagement = new UndertowUserSessionManagement();\\n+\\n+ protected final AdapterDeploymentContext deploymentContext;\\n+\\n+ protected final SessionManager sessionManager;\\n+\\n+ protected final List allowedRoles;\\n+\\n+ private final int confidentialPort;\\n+\\n+ private final Pattern skipPattern;\\n+\\n+ public UndertowKeycloakConsumer(UndertowKeycloakEndpoint endpoint, Processor processor,\\n+ AdapterDeploymentContext deploymentContext, Pattern skipPattern, List allowedRoles, int confidentialPort) {\\n+ super(endpoint, processor);\\n+ this.sessionManager = new InMemorySessionManager(endpoint.getEndpointUri());\\n+ this.deploymentContext = deploymentContext;\\n+ this.skipPattern = skipPattern;\\n+ this.confidentialPort = confidentialPort;\\n+ this.allowedRoles = allowedRoles == null ? Collections.emptyList() : allowedRoles;\\n+ }\\n+\\n+ public int getConfidentialPort() {\\n+ return confidentialPort;\\n+ }\\n+\\n+ @Override\\n+ public void handleRequest(HttpServerExchange httpExchange) throws Exception {\\n+ if (shouldSkip(httpExchange.getRequestPath())) {\\n+ super.handleRequest(httpExchange);\\n+ return;\\n+ }\\n+\\n+ //perform only non-blocking operation on exchange\\n+ if (httpExchange.isInIoThread()) {\\n+ httpExchange.dispatch(this);\\n+ return;\\n+ }\\n+\\n+ OIDCUndertowHttpFacade facade = new OIDCUndertowHttpFacade(httpExchange);\\n+ KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade);\\n+\\n+ if (deployment == null || !deployment.isConfigured()) {\\n+ httpExchange.setStatusCode(StatusCodes.FORBIDDEN);\\n+ LOG.fine(\\\"deployment not configured\\\");\\n+ return;\\n+ }\\n+\\n+ LOG.fine(\\\"executing PreAuthActionsHandler\\\");\\n+ SessionManagementBridge bridge = new SessionManagementBridge(userSessionManagement, sessionManager);\\n+ PreAuthActionsHandler preAuth = new PreAuthActionsHandler(bridge, deploymentContext, facade);\\n+ if (preAuth.handleRequest()) return;\\n+\\n+ SecurityContext securityContext = httpExchange.getSecurityContext();\\n+ if (securityContext == null) {\\n+ securityContext = new SecurityContextImpl(httpExchange, IDENTITY_MANAGER);\\n+ }\\n+ AdapterTokenStore tokenStore = getTokenStore(httpExchange, facade, deployment, securityContext);\\n+ tokenStore.checkCurrentToken();\\n+\\n+ LOG.fine(\\\"executing AuthenticatedActionsHandler\\\");\\n+ RequestAuthenticator authenticator = new UndertowRequestAuthenticator(facade, deployment, confidentialPort, securityContext, httpExchange, tokenStore);\\n+ AuthOutcome outcome = authenticator.authenticate();\\n+\\n+ if (outcome == AuthOutcome.AUTHENTICATED) {\\n+ LOG.fine(\\\"AUTHENTICATED\\\");\\n+ if (httpExchange.isResponseComplete()) {\\n+ return;\\n+ }\\n+ AuthenticatedActionsHandler actions = new AuthenticatedActionsHandler(deployment, facade);\\n+ if (actions.handledRequest()) {\\n+ return;\\n+ } else {\\n+ final Account authenticatedAccount = securityContext.getAuthenticatedAccount();\\n+ if (authenticatedAccount instanceof KeycloakUndertowAccount) {\\n+ final KeycloakUndertowAccount kua = (KeycloakUndertowAccount) authenticatedAccount;\\n+ httpExchange.putAttachment(KEYCLOAK_PRINCIPAL_KEY, (KeycloakPrincipal) kua.getPrincipal());\\n+ }\\n+\\n+ Set roles = Optional\\n+ .ofNullable(authenticatedAccount.getRoles())\\n+ .orElse((Set) Collections.EMPTY_SET);\\n+\\n+ LOG.log(Level.FINE, \\\"Allowed roles: {0}, current roles: {1}\\\", new Object[] {allowedRoles, roles});\\n+\\n+ if (isRoleAllowed(roles, httpExchange)) {\\n+ super.handleRequest(httpExchange);\\n+ } else {\\n+ httpExchange.setStatusCode(StatusCodes.FORBIDDEN);\\n+ }\\n+\\n+ return;\\n+ }\\n+ }\\n+\\n+ AuthChallenge challenge = authenticator.getChallenge();\\n+ if (challenge != null) {\\n+ LOG.fine(\\\"challenge\\\");\\n+ challenge.challenge(facade);\\n+ return;\\n+ }\\n+\\n+ httpExchange.setStatusCode(StatusCodes.FORBIDDEN);\\n+ }\\n+\\n+ public boolean isRoleAllowed(Set roles, HttpServerExchange httpExchange) throws Exception {\\n+ for (String role : allowedRoles) {\\n+ if (roles.contains(role)) {\\n+ return true;\\n+ }\\n+ }\\n+\\n+ return false;\\n+ }\\n+\\n+ protected AdapterTokenStore getTokenStore(HttpServerExchange exchange, HttpFacade facade, KeycloakDeployment deployment, SecurityContext securityContext) {\\n+ if (deployment.getTokenStore() == TokenStore.SESSION) {\\n+ return new UndertowSessionTokenStore(exchange, deployment, userSessionManagement, securityContext);\\n+ } else {\\n+ return new UndertowCookieTokenStore(facade, deployment, securityContext);\\n+ }\\n+ }\\n+\\n+ private boolean shouldSkip(String requestPath) {\\n+ return skipPattern != null && skipPattern.matcher(requestPath).matches();\\n+ }\\n+\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/camel-undertow/src/main/java/org/keycloak/adapters/camel/undertow/UndertowKeycloakEndpoint.java\",\n \"diff\": \"+/*\\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.adapters.camel.undertow;\\n+\\n+import org.keycloak.KeycloakPrincipal;\\n+import org.keycloak.adapters.AdapterDeploymentContext;\\n+import org.keycloak.adapters.KeycloakConfigResolver;\\n+import org.keycloak.adapters.KeycloakDeployment;\\n+import org.keycloak.adapters.KeycloakDeploymentBuilder;\\n+import org.keycloak.representations.adapters.config.AdapterConfig;\\n+import io.undertow.server.HttpServerExchange;\\n+import java.util.Arrays;\\n+import java.util.Collections;\\n+import java.util.List;\\n+import java.util.logging.Level;\\n+import java.util.logging.Logger;\\n+import java.util.regex.Pattern;\\n+import org.apache.camel.Consumer;\\n+import org.apache.camel.Exchange;\\n+import org.apache.camel.Processor;\\n+import org.apache.camel.component.undertow.UndertowComponent;\\n+import org.apache.camel.component.undertow.UndertowEndpoint;\\n+import static org.keycloak.adapters.camel.undertow.UndertowKeycloakConsumer.KEYCLOAK_PRINCIPAL_KEY;\\n+\\n+/**\\n+ *\\n+ * @author hmlnarik\\n+ */\\n+public class UndertowKeycloakEndpoint extends UndertowEndpoint {\\n+\\n+ private static final Logger LOG = Logger.getLogger(UndertowKeycloakEndpoint.class.getName());\\n+\\n+ private KeycloakConfigResolver configResolver;\\n+\\n+ private AdapterConfig adapterConfig;\\n+\\n+ private String skipPattern;\\n+\\n+ private List allowedRoles = Collections.emptyList();\\n+\\n+ private int confidentialPort = 8443;\\n+\\n+ public UndertowKeycloakEndpoint(String uri, UndertowComponent component) {\\n+ super(uri, component);\\n+ }\\n+\\n+ public AdapterConfig getAdapterConfig() {\\n+ return adapterConfig;\\n+ }\\n+\\n+ public void setAdapterConfig(AdapterConfig adapterConfig) {\\n+ LOG.info(\\\"adapterConfig\\\");\\n+ this.adapterConfig = adapterConfig;\\n+ }\\n+\\n+ public String getSkipPattern() {\\n+ return skipPattern;\\n+ }\\n+\\n+ public void setSkipPattern(String skipPattern) {\\n+ this.skipPattern = skipPattern;\\n+ }\\n+\\n+ public List getAllowedRoles() {\\n+ return allowedRoles;\\n+ }\\n+\\n+ public void setAllowedRoles(List allowedRoles) {\\n+ this.allowedRoles = allowedRoles;\\n+ }\\n+\\n+ public void setAllowedRoles(String allowedRoles) {\\n+ this.allowedRoles = allowedRoles == null ? null : Arrays.asList(allowedRoles.split(\\\"\\\\\\\\s*,\\\\\\\\s*\\\"));\\n+ }\\n+\\n+ public int getConfidentialPort() {\\n+ return confidentialPort;\\n+ }\\n+\\n+ public void setConfidentialPort(int confidentialPort) {\\n+ this.confidentialPort = confidentialPort;\\n+ }\\n+\\n+ public KeycloakConfigResolver getConfigResolver() {\\n+ return configResolver;\\n+ }\\n+\\n+ public void setConfigResolver(KeycloakConfigResolver configResolver) {\\n+ this.configResolver = configResolver;\\n+ }\\n+\\n+ @Override\\n+ public Consumer createConsumer(Processor processor) throws Exception {\\n+ return new UndertowKeycloakConsumer(this, processor, getDeploymentContext(), getSkipPatternAsPattern(), computeAllowedRoles(), this.confidentialPort);\\n+ }\\n+\\n+ public List computeAllowedRoles() {\\n+ List res = this.allowedRoles == null ? Collections.emptyList() : this.allowedRoles;\\n+ if (res.isEmpty()) {\\n+ LOG.warning(\\\"No roles were configured, Keycloak will deny every request\\\");\\n+ }\\n+ LOG.log(Level.FINE, \\\"Allowed roles: {0}\\\", res);\\n+ return res;\\n+ }\\n+\\n+ @Override\\n+ public Exchange createExchange(HttpServerExchange httpExchange) throws Exception {\\n+ final Exchange res = super.createExchange(httpExchange);\\n+\\n+ KeycloakPrincipal principal = httpExchange.getAttachment(KEYCLOAK_PRINCIPAL_KEY);\\n+ LOG.log(Level.FINE, \\\"principal: {0}\\\", principal);\\n+ if (principal != null) {\\n+ res.setProperty(KeycloakPrincipal.class.getName(), principal);\\n+ }\\n+\\n+ return res;\\n+ }\\n+\\n+ private AdapterDeploymentContext getDeploymentContext() {\\n+ if (configResolver != null) {\\n+ LOG.log(Level.INFO, \\\"Using {0} to resolve Keycloak configuration on a per-request basis.\\\", configResolver.getClass());\\n+ return new AdapterDeploymentContext(configResolver);\\n+ } else if (adapterConfig != null) {\\n+ KeycloakDeployment kd = KeycloakDeploymentBuilder.build(adapterConfig);\\n+ return new AdapterDeploymentContext(kd);\\n+ }\\n+\\n+ LOG.warning(\\\"Adapter is unconfigured, Keycloak will deny every request\\\");\\n+ return new AdapterDeploymentContext();\\n+ }\\n+\\n+ private Pattern getSkipPatternAsPattern() {\\n+ return skipPattern == null\\n+ ? null\\n+ : Pattern.compile(skipPattern, Pattern.DOTALL);\\n+ }\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/camel-undertow/src/main/resources/META-INF/services/org/apache/camel/component/undertow-keycloak\",\n \"diff\": \"+class=org.keycloak.adapters.camel.undertow.UndertowKeycloakComponent\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"adapters/oidc/fuse7/pom.xml\",\n \"new_path\": \"adapters/oidc/fuse7/pom.xml\",\n \"diff\": \"\\n\\n+ camel-undertow\\nundertow\\n\\n\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"distribution/adapters/osgi/features/src/main/resources/features.xml\",\n \"new_path\": \"distribution/adapters/osgi/features/src/main/resources/features.xml\",\n \"diff\": \"mvn:org.keycloak/keycloak-undertow-adapter/${project.version}\\nmvn:org.keycloak/keycloak-undertow-adapter-spi/${project.version}\\nmvn:org.keycloak/keycloak-pax-web-undertow/${project.version}\\n+ mvn:org.keycloak/keycloak-camel-undertow/${project.version}\\n\\n\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-7279 Camel/Undertow integration"}}},{"rowIdx":2933,"cells":{"author":{"kind":"number","value":339185,"string":"339,185"},"date":{"kind":"string","value":"19.05.2018 18:39:38"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"adea41469549477757c88940940fde98a2e1be06"},"message":{"kind":"string","value":"Camel example"},"mods":{"kind":"list like","value":[{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/camel-fuse7-undertow/pom.xml","diff":"+\n+\n+\n+\n+ \n+ keycloak-examples-fuse-parent\n+ org.keycloak\n+ 4.0.0.Beta3-SNAPSHOT\n+ \n+\n+ 4.0.0\n+ org.keycloak.example.demo\n+ camel-endpoint-example-fuse7-undertow\n+ bundle\n+ Camel endpoint example - Secured in Karaf/Fuse 7.0 on Undertow\n+ \n+\n+ \n+\n+ \n+ \n+ \n+ javax.servlet;version=\"[3,4)\",\n+ javax.servlet.http;version=\"[3,4)\",\n+ javax.net.ssl,\n+ org.apache.camel.*,\n+ io.undertow.*,\n+ org.apache.camel;version=\"[2.13,3)\",\n+ org.keycloak.*;version=\"${project.version}\",\n+ org.osgi.service.blueprint,\n+ org.osgi.service.blueprint.container\n+ \n+ \n+ org.keycloak.example.*\n+ \n+ \n+\n+ \n+ \n+ org.jboss.spec.javax.servlet\n+ jboss-servlet-api_3.0_spec\n+ provided\n+ \n+ \n+ org.keycloak\n+ keycloak-core\n+ \n+ \n+ org.apache.camel\n+ camel-core\n+ ${camel.version}\n+ \n+ \n+ org.apache.camel\n+ camel-blueprint\n+ ${camel.version}\n+ \n+ \n+ org.apache.camel\n+ camel-undertow\n+ ${camel.version}\n+ \n+ \n+ io.undertow\n+ undertow-core\n+ \n+ \n+\n+ \n+ install\n+\n+ \n+ \n+ org.apache.felix\n+ maven-bundle-plugin\n+ true\n+ \n+ \n+ ${project.name}\n+ ${project.groupId}.${project.artifactId}\n+ ${keycloak.osgi.import}\n+ ${keycloak.osgi.private}\n+ ${keycloak.osgi.export}\n+ \n+ \n+ \n+\n+ \n+ \n+\n+\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/camel-fuse7-undertow/src/main/java/org/keycloak/example/CamelHelloProcessor.java","diff":"+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.example;\n+\n+import org.apache.camel.Exchange;\n+import org.apache.camel.Processor;\n+import org.keycloak.KeycloakPrincipal;\n+import org.keycloak.representations.AccessToken;\n+import javax.servlet.http.HttpServletRequest;\n+\n+/**\n+ * @author Marek Posolda\n+ */\n+public class CamelHelloProcessor implements Processor {\n+\n+ @Override\n+ public void process(Exchange exchange) throws Exception {\n+ // Fuse 7\n+ KeycloakPrincipal keycloakPrincipal = (KeycloakPrincipal) exchange.getProperty(KeycloakPrincipal.class.getName(), KeycloakPrincipal.class);\n+\n+ if (keycloakPrincipal == null) {\n+ // Fuse 6.3\n+ HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);\n+ keycloakPrincipal = (KeycloakPrincipal) req.getUserPrincipal();\n+ }\n+\n+ AccessToken accessToken = keycloakPrincipal.getKeycloakSecurityContext().getToken();\n+ String username = accessToken.getPreferredUsername();\n+ String fullName = accessToken.getName();\n+\n+ exchange.getOut().setBody(\"Hello \" + username + \"! Your full name is \" + fullName + \".\");\n+ }\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/camel-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml","diff":"+\n+\n+\n+\n+\n+ \n+ \n+ \n+\n+ \n+\n+ \n+\n+ \n+ \n+ \n+ \n+ \n+\n+ \n+ Hello rest service\n+ \n+ Just a hello\n+ \n+ \n+\n+ \n+\n+ \n+ \n+ \n+ \n+ \n+ (__This second sentence is returned from a Camel RestDSL endpoint__)\n+ \n+ \n+\n+\n+ \n+ \n+ \n+ \n+ \n+\n+ \n+\n+\n\\ No newline at end of file\n"},{"change_type":"ADD","old_path":null,"new_path":"examples/fuse/camel-fuse7-undertow/src/main/resources/WEB-INF/keycloak.json","diff":"+{\n+ \"realm\": \"demo\",\n+ \"resource\": \"admin-camel-endpoint\",\n+ \"bearer-only\": \"true\",\n+ \"auth-server-url\": \"http://localhost:8080/auth\",\n+ \"ssl-required\" : \"external\",\n+ \"credentials\": {\n+ \"secret\": \"password\"\n+ }\n+}\n"},{"change_type":"MODIFY","old_path":"examples/fuse/pom.xml","new_path":"examples/fuse/pom.xml","diff":"cxf-jaxws\ncxf-jaxws-fuse7-undertow\ncamel\n+ camel-fuse7-undertow\nfeatures\nexternal-config\n
\n"}],"string":"[\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/camel-fuse7-undertow/pom.xml\",\n \"diff\": \"+\\n+\\n+\\n+\\n+ \\n+ keycloak-examples-fuse-parent\\n+ org.keycloak\\n+ 4.0.0.Beta3-SNAPSHOT\\n+ \\n+\\n+ 4.0.0\\n+ org.keycloak.example.demo\\n+ camel-endpoint-example-fuse7-undertow\\n+ bundle\\n+ Camel endpoint example - Secured in Karaf/Fuse 7.0 on Undertow\\n+ \\n+\\n+ \\n+\\n+ \\n+ \\n+ \\n+ javax.servlet;version=\\\"[3,4)\\\",\\n+ javax.servlet.http;version=\\\"[3,4)\\\",\\n+ javax.net.ssl,\\n+ org.apache.camel.*,\\n+ io.undertow.*,\\n+ org.apache.camel;version=\\\"[2.13,3)\\\",\\n+ org.keycloak.*;version=\\\"${project.version}\\\",\\n+ org.osgi.service.blueprint,\\n+ org.osgi.service.blueprint.container\\n+ \\n+ \\n+ org.keycloak.example.*\\n+ \\n+ \\n+\\n+ \\n+ \\n+ org.jboss.spec.javax.servlet\\n+ jboss-servlet-api_3.0_spec\\n+ provided\\n+ \\n+ \\n+ org.keycloak\\n+ keycloak-core\\n+ \\n+ \\n+ org.apache.camel\\n+ camel-core\\n+ ${camel.version}\\n+ \\n+ \\n+ org.apache.camel\\n+ camel-blueprint\\n+ ${camel.version}\\n+ \\n+ \\n+ org.apache.camel\\n+ camel-undertow\\n+ ${camel.version}\\n+ \\n+ \\n+ io.undertow\\n+ undertow-core\\n+ \\n+ \\n+\\n+ \\n+ install\\n+\\n+ \\n+ \\n+ org.apache.felix\\n+ maven-bundle-plugin\\n+ true\\n+ \\n+ \\n+ ${project.name}\\n+ ${project.groupId}.${project.artifactId}\\n+ ${keycloak.osgi.import}\\n+ ${keycloak.osgi.private}\\n+ ${keycloak.osgi.export}\\n+ \\n+ \\n+ \\n+\\n+ \\n+ \\n+\\n+\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/camel-fuse7-undertow/src/main/java/org/keycloak/example/CamelHelloProcessor.java\",\n \"diff\": \"+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.example;\\n+\\n+import org.apache.camel.Exchange;\\n+import org.apache.camel.Processor;\\n+import org.keycloak.KeycloakPrincipal;\\n+import org.keycloak.representations.AccessToken;\\n+import javax.servlet.http.HttpServletRequest;\\n+\\n+/**\\n+ * @author Marek Posolda\\n+ */\\n+public class CamelHelloProcessor implements Processor {\\n+\\n+ @Override\\n+ public void process(Exchange exchange) throws Exception {\\n+ // Fuse 7\\n+ KeycloakPrincipal keycloakPrincipal = (KeycloakPrincipal) exchange.getProperty(KeycloakPrincipal.class.getName(), KeycloakPrincipal.class);\\n+\\n+ if (keycloakPrincipal == null) {\\n+ // Fuse 6.3\\n+ HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);\\n+ keycloakPrincipal = (KeycloakPrincipal) req.getUserPrincipal();\\n+ }\\n+\\n+ AccessToken accessToken = keycloakPrincipal.getKeycloakSecurityContext().getToken();\\n+ String username = accessToken.getPreferredUsername();\\n+ String fullName = accessToken.getName();\\n+\\n+ exchange.getOut().setBody(\\\"Hello \\\" + username + \\\"! Your full name is \\\" + fullName + \\\".\\\");\\n+ }\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/camel-fuse7-undertow/src/main/resources/OSGI-INF/blueprint/blueprint.xml\",\n \"diff\": \"+\\n+\\n+\\n+\\n+\\n+ \\n+ \\n+ \\n+\\n+ \\n+\\n+ \\n+\\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n+ \\n+ Hello rest service\\n+ \\n+ Just a hello\\n+ \\n+ \\n+\\n+ \\n+\\n+ \\n+ \\n+ \\n+ \\n+ \\n+ (__This second sentence is returned from a Camel RestDSL endpoint__)\\n+ \\n+ \\n+\\n+\\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n+ \\n+\\n+\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"examples/fuse/camel-fuse7-undertow/src/main/resources/WEB-INF/keycloak.json\",\n \"diff\": \"+{\\n+ \\\"realm\\\": \\\"demo\\\",\\n+ \\\"resource\\\": \\\"admin-camel-endpoint\\\",\\n+ \\\"bearer-only\\\": \\\"true\\\",\\n+ \\\"auth-server-url\\\": \\\"http://localhost:8080/auth\\\",\\n+ \\\"ssl-required\\\" : \\\"external\\\",\\n+ \\\"credentials\\\": {\\n+ \\\"secret\\\": \\\"password\\\"\\n+ }\\n+}\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"examples/fuse/pom.xml\",\n \"new_path\": \"examples/fuse/pom.xml\",\n \"diff\": \"cxf-jaxws\\ncxf-jaxws-fuse7-undertow\\ncamel\\n+ camel-fuse7-undertow\\nfeatures\\nexternal-config\\n\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-7279 Camel example"}}},{"rowIdx":2934,"cells":{"author":{"kind":"number","value":339185,"string":"339,185"},"date":{"kind":"string","value":"21.05.2018 14:28:26"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"3ab8ff2ea1775c4587f31febfc4106aaef9d5df1"},"message":{"kind":"string","value":"Features and distibution"},"mods":{"kind":"list like","value":[{"change_type":"MODIFY","old_path":"distribution/adapters/fuse-adapter-zip/pom.xml","new_path":"distribution/adapters/fuse-adapter-zip/pom.xml","diff":"\n\n\n+ \n+ org.keycloak\n+ keycloak-undertow-adapter\n+ \n+ \n+ *\n+ *\n+ \n+ \n+ \n+ \n+ org.keycloak\n+ keycloak-undertow-adapter-spi\n+ \n+ \n+ *\n+ *\n+ \n+ \n+ \n+ \n+ org.keycloak\n+ keycloak-pax-web-undertow\n+ ${project.version}\n+ \n+ \n+ *\n+ *\n+ \n+ \n+ \n+ \n+ org.keycloak\n+ keycloak-camel-undertow\n+ ${project.version}\n+ \n+ \n+ *\n+ *\n+ \n+ \n+ \n\n\n"},{"change_type":"MODIFY","old_path":"examples/fuse/demorealm.json","new_path":"examples/fuse/demorealm.json","diff":"{ \"type\" : \"password\",\n\"value\" : \"password\" }\n],\n- \"realmRoles\": [ \"user\" ],\n+ \"realmRoles\": [ \"user\", \"ssh\" ],\n\"clientRoles\": {\n\"account\": [ \"manage-account\" ]\n}\n{ \"type\" : \"password\",\n\"value\" : \"password\" }\n],\n- \"realmRoles\": [ \"user\" ],\n+ \"realmRoles\": [ \"user\", \"ssh\" ],\n\"clientRoles\": {\n\"account\": [ \"manage-account\" ]\n}\n{ \"type\" : \"password\",\n\"value\" : \"password\" }\n],\n- \"realmRoles\": [ \"user\" ],\n+ \"realmRoles\": [ \"user\", \"ssh\" ],\n\"clientRoles\": {\n\"account\": [ \"manage-account\" ]\n}\n{ \"type\" : \"password\",\n\"value\" : \"password\" }\n],\n- \"realmRoles\": [ \"user\",\"admin\" ],\n+ \"realmRoles\": [ \"user\",\"admin\", \"ssh\" ],\n\"clientRoles\": {\n\"realm-management\": [ \"realm-admin\" ],\n\"account\": [ \"manage-account\" ]\n{ \"type\" : \"password\",\n\"value\" : \"password\" }\n],\n- \"realmRoles\": [ \"user\", \"jmxAdmin\" ],\n+ \"realmRoles\": [ \"user\", \"jmxAdmin\", \"ssh\" ],\n\"clientRoles\": {\n\"account\": [ \"manage-account\" ],\n\"realm-management\": [ \"realm-admin\" ]\n\"value\" : \"password\"\n}\n],\n- \"realmRoles\" : [ \"viewer\" ],\n+ \"realmRoles\" : [ \"viewer\", \"ssh\" ],\n\"applicationRoles\": {\n\"account\" : [ \"view-profile\", \"manage-account\" ]\n}\n\"value\" : \"password\"\n}\n],\n+ \"realmRoles\" : [ \"ssh\" ],\n\"applicationRoles\": {\n\"account\" : [ \"view-profile\", \"manage-account\" ]\n}\n\"value\" : \"password\"\n}\n],\n- \"realmRoles\" : [ \"jmxAdmin\" ],\n+ \"realmRoles\" : [ \"jmxAdmin\", \"ssh\" ],\n\"applicationRoles\": {\n\"account\" : [ \"view-profile\", \"manage-account\" ],\n\"realm-management\" : [ \"realm-admin\" ]\n{\n\"name\": \"SuperUser\"\n},\n+ {\n+ \"name\": \"ssh\"\n+ },\n{\n\"name\": \"jmxAdmin\",\n\"description\": \"Admin role with all privileges to SSH and JMX access\",\n\"composite\": true,\n\"composites\": {\n- \"realm\": [ \"admin\", \"manager\", \"viewer\", \"Operator\", \"Maintainer\", \"Deployer\", \"Auditor\", \"Administrator\", \"SuperUser\" ]\n+ \"realm\": [ \"admin\", \"manager\", \"viewer\", \"Operator\", \"Maintainer\", \"Deployer\", \"Auditor\", \"Administrator\", \"SuperUser\", \"ssh\" ]\n}\n}\n]\n"},{"change_type":"MODIFY","old_path":"examples/fuse/features/src/main/resources/features.xml","new_path":"examples/fuse/features/src/main/resources/features.xml","diff":"~ limitations under the License.\n-->\n-\n+\n+\n+ \n+
The Keycloak / Fuse 7.0 on Undertow example
\n+ pax-http-undertow\n+ war\n+ camel\n+ camel-undertow\n+ cxf\n+ keycloak\n+ keycloak-pax-http-undertow\n+\n+ mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${jackson.version}\n+ mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${jackson.version}\n+ mvn:org.keycloak.example.demo/camel-endpoint-example-fuse7-undertow/${project.version}\n+ mvn:org.keycloak.example.demo/cxf-jaxrs-example-fuse7-undertow/${project.version}\n+ mvn:org.keycloak.example.demo/cxf-jaxws-example-fuse7-undertow/${project.version}\n+ mvn:org.keycloak.example.demo/customer-portal-fuse-example/${project.version}/war\n+ mvn:org.keycloak.example.demo/external-config/${project.version}/war\n+ mvn:org.keycloak.example.demo/product-portal-fuse-example-fuse7-undertow/${project.version}\n+
\n\n-
The keycloak fuse example
\n+
The Keycloak / Fuse 6.3 example
\nwar\ncamel\ncamel-jetty9\n"}],"string":"[\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"distribution/adapters/fuse-adapter-zip/pom.xml\",\n \"new_path\": \"distribution/adapters/fuse-adapter-zip/pom.xml\",\n \"diff\": \"\\n\\n\\n+ \\n+ org.keycloak\\n+ keycloak-undertow-adapter\\n+ \\n+ \\n+ *\\n+ *\\n+ \\n+ \\n+ \\n+ \\n+ org.keycloak\\n+ keycloak-undertow-adapter-spi\\n+ \\n+ \\n+ *\\n+ *\\n+ \\n+ \\n+ \\n+ \\n+ org.keycloak\\n+ keycloak-pax-web-undertow\\n+ ${project.version}\\n+ \\n+ \\n+ *\\n+ *\\n+ \\n+ \\n+ \\n+ \\n+ org.keycloak\\n+ keycloak-camel-undertow\\n+ ${project.version}\\n+ \\n+ \\n+ *\\n+ *\\n+ \\n+ \\n+ \\n\\n\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"examples/fuse/demorealm.json\",\n \"new_path\": \"examples/fuse/demorealm.json\",\n \"diff\": \"{ \\\"type\\\" : \\\"password\\\",\\n\\\"value\\\" : \\\"password\\\" }\\n],\\n- \\\"realmRoles\\\": [ \\\"user\\\" ],\\n+ \\\"realmRoles\\\": [ \\\"user\\\", \\\"ssh\\\" ],\\n\\\"clientRoles\\\": {\\n\\\"account\\\": [ \\\"manage-account\\\" ]\\n}\\n{ \\\"type\\\" : \\\"password\\\",\\n\\\"value\\\" : \\\"password\\\" }\\n],\\n- \\\"realmRoles\\\": [ \\\"user\\\" ],\\n+ \\\"realmRoles\\\": [ \\\"user\\\", \\\"ssh\\\" ],\\n\\\"clientRoles\\\": {\\n\\\"account\\\": [ \\\"manage-account\\\" ]\\n}\\n{ \\\"type\\\" : \\\"password\\\",\\n\\\"value\\\" : \\\"password\\\" }\\n],\\n- \\\"realmRoles\\\": [ \\\"user\\\" ],\\n+ \\\"realmRoles\\\": [ \\\"user\\\", \\\"ssh\\\" ],\\n\\\"clientRoles\\\": {\\n\\\"account\\\": [ \\\"manage-account\\\" ]\\n}\\n{ \\\"type\\\" : \\\"password\\\",\\n\\\"value\\\" : \\\"password\\\" }\\n],\\n- \\\"realmRoles\\\": [ \\\"user\\\",\\\"admin\\\" ],\\n+ \\\"realmRoles\\\": [ \\\"user\\\",\\\"admin\\\", \\\"ssh\\\" ],\\n\\\"clientRoles\\\": {\\n\\\"realm-management\\\": [ \\\"realm-admin\\\" ],\\n\\\"account\\\": [ \\\"manage-account\\\" ]\\n{ \\\"type\\\" : \\\"password\\\",\\n\\\"value\\\" : \\\"password\\\" }\\n],\\n- \\\"realmRoles\\\": [ \\\"user\\\", \\\"jmxAdmin\\\" ],\\n+ \\\"realmRoles\\\": [ \\\"user\\\", \\\"jmxAdmin\\\", \\\"ssh\\\" ],\\n\\\"clientRoles\\\": {\\n\\\"account\\\": [ \\\"manage-account\\\" ],\\n\\\"realm-management\\\": [ \\\"realm-admin\\\" ]\\n\\\"value\\\" : \\\"password\\\"\\n}\\n],\\n- \\\"realmRoles\\\" : [ \\\"viewer\\\" ],\\n+ \\\"realmRoles\\\" : [ \\\"viewer\\\", \\\"ssh\\\" ],\\n\\\"applicationRoles\\\": {\\n\\\"account\\\" : [ \\\"view-profile\\\", \\\"manage-account\\\" ]\\n}\\n\\\"value\\\" : \\\"password\\\"\\n}\\n],\\n+ \\\"realmRoles\\\" : [ \\\"ssh\\\" ],\\n\\\"applicationRoles\\\": {\\n\\\"account\\\" : [ \\\"view-profile\\\", \\\"manage-account\\\" ]\\n}\\n\\\"value\\\" : \\\"password\\\"\\n}\\n],\\n- \\\"realmRoles\\\" : [ \\\"jmxAdmin\\\" ],\\n+ \\\"realmRoles\\\" : [ \\\"jmxAdmin\\\", \\\"ssh\\\" ],\\n\\\"applicationRoles\\\": {\\n\\\"account\\\" : [ \\\"view-profile\\\", \\\"manage-account\\\" ],\\n\\\"realm-management\\\" : [ \\\"realm-admin\\\" ]\\n{\\n\\\"name\\\": \\\"SuperUser\\\"\\n},\\n+ {\\n+ \\\"name\\\": \\\"ssh\\\"\\n+ },\\n{\\n\\\"name\\\": \\\"jmxAdmin\\\",\\n\\\"description\\\": \\\"Admin role with all privileges to SSH and JMX access\\\",\\n\\\"composite\\\": true,\\n\\\"composites\\\": {\\n- \\\"realm\\\": [ \\\"admin\\\", \\\"manager\\\", \\\"viewer\\\", \\\"Operator\\\", \\\"Maintainer\\\", \\\"Deployer\\\", \\\"Auditor\\\", \\\"Administrator\\\", \\\"SuperUser\\\" ]\\n+ \\\"realm\\\": [ \\\"admin\\\", \\\"manager\\\", \\\"viewer\\\", \\\"Operator\\\", \\\"Maintainer\\\", \\\"Deployer\\\", \\\"Auditor\\\", \\\"Administrator\\\", \\\"SuperUser\\\", \\\"ssh\\\" ]\\n}\\n}\\n]\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"examples/fuse/features/src/main/resources/features.xml\",\n \"new_path\": \"examples/fuse/features/src/main/resources/features.xml\",\n \"diff\": \"~ limitations under the License.\\n-->\\n-\\n+\\n+\\n+ \\n+
The Keycloak / Fuse 7.0 on Undertow example
\\n+ pax-http-undertow\\n+ war\\n+ camel\\n+ camel-undertow\\n+ cxf\\n+ keycloak\\n+ keycloak-pax-http-undertow\\n+\\n+ mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${jackson.version}\\n+ mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${jackson.version}\\n+ mvn:org.keycloak.example.demo/camel-endpoint-example-fuse7-undertow/${project.version}\\n+ mvn:org.keycloak.example.demo/cxf-jaxrs-example-fuse7-undertow/${project.version}\\n+ mvn:org.keycloak.example.demo/cxf-jaxws-example-fuse7-undertow/${project.version}\\n+ mvn:org.keycloak.example.demo/customer-portal-fuse-example/${project.version}/war\\n+ mvn:org.keycloak.example.demo/external-config/${project.version}/war\\n+ mvn:org.keycloak.example.demo/product-portal-fuse-example-fuse7-undertow/${project.version}\\n+
\\n\\n-
The keycloak fuse example
\\n+
The Keycloak / Fuse 6.3 example
\\nwar\\ncamel\\ncamel-jetty9\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-5522 Features and distibution"}}},{"rowIdx":2935,"cells":{"author":{"kind":"number","value":339185,"string":"339,185"},"date":{"kind":"string","value":"21.05.2018 14:28:08"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"d70859ef1bbbc06ba8fe88486fe8bc4a71cfb9d6"},"message":{"kind":"string","value":"KEYCLOAK-7282 Jetty/Pax Web integration"},"mods":{"kind":"list like","value":[{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/jetty94/pom.xml","diff":"+\n+\n+\n+\n+ \n+ keycloak-fuse7-integration-pom\n+ org.keycloak\n+ 4.0.0.Beta3-SNAPSHOT\n+ ../pom.xml\n+ \n+ 4.0.0\n+\n+ keycloak-pax-web-jetty94\n+ Keycloak Fuse 7.0 Adapter - Jetty 9.4\n+ bundle\n+\n+ \n+ \n+ org.keycloak.adapters.osgi.jetty94.*;version=\"${project.version}\"\n+ \n+ \n+ !org.keycloak.adapters.osgi.jetty94,\n+ org.keycloak.*;version=\"${project.version}\",\n+ *;resolution:=optional\n+ \n+ org.ops4j.pax.web.pax-web-jetty\n+ \n+\n+ \n+ \n+ org.jboss.logging\n+ jboss-logging\n+ provided\n+ \n+ \n+ org.ops4j.pax.web\n+ pax-web-api\n+ provided\n+ \n+ \n+ org.ops4j.pax.web\n+ pax-web-spi\n+ provided\n+ \n+ \n+ org.osgi\n+ org.osgi.core\n+ provided\n+ \n+ \n+ org.osgi\n+ org.osgi.enterprise\n+ provided\n+ \n+\n+ \n+ org.keycloak\n+ keycloak-jetty94-adapter\n+ provided\n+ \n+ \n+ org.eclipse.jetty\n+ jetty-security\n+ ${jetty9.version}\n+ provided\n+ \n+ \n+\n+ \n+ \n+ \n+ org.apache.maven.plugins\n+ maven-compiler-plugin\n+ \n+ ${maven.compiler.source}\n+ ${maven.compiler.target}\n+ \n+ \n+\n+ \n+ \n+ maven-jar-plugin\n+ \n+ \n+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF\n+ \n+ \n+ \n+ \n+ org.apache.felix\n+ maven-bundle-plugin\n+ true\n+ \n+ \n+ bundle-manifest\n+ process-classes\n+ \n+ manifest\n+ \n+ \n+ \n+ \n+ \n+ ${project.name}\n+ ${project.groupId}.${project.artifactId}\n+ ${keycloak.osgi.import}\n+ ${keycloak.osgi.export}\n+ ${keycloak.osgi.fragment}\n+ \n+ \n+ \n+ \n+ \n+\n"},{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/jetty94/src/main/java/org/keycloak/adapters/osgi/jetty94/KeycloakAuthenticatorService.java","diff":"+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.adapters.osgi.jetty94;\n+\n+import org.ops4j.pax.web.service.AuthenticatorService;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public class KeycloakAuthenticatorService implements AuthenticatorService {\n+\n+ @Override\n+ public T getAuthenticatorService(String method, Class iface) {\n+ if (method == null || iface != org.eclipse.jetty.security.Authenticator.class) {\n+ return null;\n+ }\n+\n+ if (\"KEYCLOAK\".equalsIgnoreCase(method)) {\n+ return iface.cast(new org.keycloak.adapters.jetty.KeycloakJettyAuthenticator());\n+ }\n+\n+ return null;\n+ }\n+\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/jetty94/src/main/java/org/keycloak/adapters/osgi/jetty94/PaxWebIntegrationService.java","diff":"+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.adapters.osgi.jetty94;\n+\n+import org.eclipse.jetty.security.ConstraintMapping;\n+import org.eclipse.jetty.util.security.Constraint;\n+import org.jboss.logging.Logger;\n+import org.ops4j.pax.web.service.WebContainer;\n+import org.ops4j.pax.web.service.spi.model.SecurityConstraintMappingModel;\n+import org.osgi.framework.BundleContext;\n+import org.osgi.framework.ServiceReference;\n+import org.osgi.service.http.HttpContext;\n+import org.osgi.util.tracker.ServiceTracker;\n+import org.osgi.util.tracker.ServiceTrackerCustomizer;\n+\n+import java.net.URL;\n+import java.security.SecureRandom;\n+import java.util.ArrayList;\n+import java.util.Arrays;\n+import java.util.List;\n+\n+/**\n+ * Integration with pax-web, which allows to inject custom jetty-web.xml configuration from current bundle classpath into {@link WebContainer}\n+ * and allows to inject custom security constraint for securing resources by Keycloak.\n+ *\n+ *

It assumes that pax-web {@link WebContainer} is used as implementation of OSGI {@link org.osgi.service.http.HttpService}, which\n+ * is true in karaf/fuse environment

\n+ *\n+ * @author Marek Posolda\n+ */\n+public class PaxWebIntegrationService {\n+\n+ protected static final Logger log = Logger.getLogger(PaxWebIntegrationService.class);\n+\n+ private BundleContext bundleContext;\n+ private String jettyWebXmlLocation;\n+ private List constraintMappings;\n+\n+ private ServiceTracker webContainerTracker;\n+ private HttpContext httpContext;\n+\n+ public BundleContext getBundleContext() {\n+ return bundleContext;\n+ }\n+\n+ public void setBundleContext(BundleContext bundleContext) {\n+ this.bundleContext = bundleContext;\n+ }\n+\n+ public String getJettyWebXmlLocation() {\n+ return jettyWebXmlLocation;\n+ }\n+\n+ public void setJettyWebXmlLocation(String jettyWebXmlLocation) {\n+ this.jettyWebXmlLocation = jettyWebXmlLocation;\n+ }\n+\n+ public List getConstraintMappings() {\n+ return constraintMappings;\n+ }\n+\n+ public void setConstraintMappings(List constraintMappings) {\n+ this.constraintMappings = constraintMappings;\n+ }\n+\n+ protected ServiceTracker getWebContainerTracker() {\n+ return webContainerTracker;\n+ }\n+\n+ protected HttpContext getHttpContext() {\n+ return httpContext;\n+ }\n+\n+\n+ public void start() {\n+ ServiceTrackerCustomizer trackerCustomizer = new ServiceTrackerCustomizer() {\n+\n+ @Override\n+ public Object addingService(ServiceReference reference) {\n+ return addingWebContainerCallback(reference);\n+ }\n+\n+ @Override\n+ public void modifiedService(ServiceReference reference, Object service) {\n+ }\n+\n+ @Override\n+ public void removedService(ServiceReference reference, Object service) {\n+ removingWebContainerCallback(reference);\n+ }\n+ };\n+\n+ webContainerTracker = new ServiceTracker(bundleContext, WebContainer.class.getName(), trackerCustomizer);\n+ webContainerTracker.open();\n+ }\n+\n+ public void stop() {\n+ webContainerTracker.remove(webContainerTracker.getServiceReference());\n+ }\n+\n+ protected WebContainer addingWebContainerCallback(ServiceReference webContainerServiceReference) {\n+ WebContainer service = (WebContainer) bundleContext.getService(webContainerServiceReference);\n+ httpContext = service.createDefaultHttpContext();\n+\n+ addJettyWebXml(service);\n+\n+ if (constraintMappings == null) {\n+ throw new IllegalStateException(\"constraintMappings was null!\");\n+ }\n+ List handlers = new ArrayList<>();\n+ try {\n+ handlers.add(new JettyConstraintHandler());\n+ } catch (Throwable t) {\n+ // Ignore\n+ }\n+ try {\n+ handlers.add(new PaxWebConstraintHandler());\n+ } catch (Throwable t) {\n+ // Ignore\n+ }\n+ for (Object constraintMapping : constraintMappings) {\n+ boolean handled = false;\n+ for (ConstraintHandler handler : handlers) {\n+ handled |= handler.addConstraintMapping(httpContext, service, constraintMapping);\n+ }\n+ if (!handled) {\n+ log.warnv(\"Unable to add constraint mapping for constraint of type \" + constraintMapping.getClass().toString());\n+ }\n+ }\n+\n+ service.registerLoginConfig(\"BASIC\", \"does-not-matter\", null, null, httpContext);\n+\n+ return service;\n+ }\n+\n+ protected void addJettyWebXml(WebContainer service) {\n+ String jettyWebXmlLoc;\n+ if (this.jettyWebXmlLocation == null) {\n+ jettyWebXmlLoc = \"/WEB-INF/jetty-web.xml\";\n+ } else {\n+ jettyWebXmlLoc = this.jettyWebXmlLocation;\n+ }\n+\n+ URL jettyWebXml = bundleContext.getBundle().getResource(jettyWebXmlLoc);\n+ if (jettyWebXml != null) {\n+ log.debug(\"Found jetty-web XML configuration on bundle classpath on \" + jettyWebXmlLoc);\n+ service.registerJettyWebXml(jettyWebXml, httpContext);\n+ } else {\n+ log.debug(\"Not found jetty-web XML configuration on bundle classpath on \" + jettyWebXmlLoc);\n+ }\n+ }\n+\n+ protected void addConstraintMapping(WebContainer service, SecurityConstraintMappingModel constraintMapping) {\n+ String name = constraintMapping.getConstraintName();\n+ if (name == null) {\n+ name = \"Constraint-\" + new SecureRandom().nextInt(Integer.MAX_VALUE);\n+ }\n+ log.debug(\"Adding security constraint name=\" + name + \", url=\" + constraintMapping.getUrl() + \", dataConstraint=\" + constraintMapping.getDataConstraint() + \", canAuthenticate=\"\n+ + constraintMapping.isAuthentication() + \", roles=\" + constraintMapping.getRoles());\n+ service.registerConstraintMapping(name, constraintMapping.getUrl(), constraintMapping.getMapping(), constraintMapping.getDataConstraint(), constraintMapping.isAuthentication(), constraintMapping.getRoles(), httpContext);\n+ }\n+\n+ protected void addConstraintMapping(WebContainer service, ConstraintMapping constraintMapping) {\n+ Constraint constraint = constraintMapping.getConstraint();\n+ String[] roles = constraint.getRoles();\n+ // name property is unavailable on constraint object :/\n+\n+ String name = \"Constraint-\" + new SecureRandom().nextInt(Integer.MAX_VALUE);\n+\n+ int dataConstraint = constraint.getDataConstraint();\n+ String dataConstraintStr;\n+ switch (dataConstraint) {\n+ case Constraint.DC_UNSET: dataConstraintStr = null; break;\n+ case Constraint.DC_NONE: dataConstraintStr = \"NONE\"; break;\n+ case Constraint.DC_CONFIDENTIAL: dataConstraintStr = \"CONFIDENTIAL\"; break;\n+ case Constraint.DC_INTEGRAL: dataConstraintStr = \"INTEGRAL\"; break;\n+ default:\n+ log.warnv(\"Unknown data constraint: \" + dataConstraint);\n+ dataConstraintStr = \"CONFIDENTIAL\";\n+ }\n+ List rolesList = Arrays.asList(roles);\n+\n+ log.debug(\"Adding security constraint name=\" + name + \", url=\" + constraintMapping.getPathSpec() + \", dataConstraint=\" + dataConstraintStr + \", canAuthenticate=\"\n+ + constraint.getAuthenticate() + \", roles=\" + rolesList);\n+ service.registerConstraintMapping(name, constraintMapping.getPathSpec(), null, dataConstraintStr, constraint.getAuthenticate(), rolesList, httpContext);\n+ }\n+\n+ protected void removingWebContainerCallback(ServiceReference serviceReference) {\n+ WebContainer service = (WebContainer)bundleContext.getService(serviceReference);\n+ if (service != null) {\n+ service.unregisterLoginConfig(httpContext);\n+ service.unregisterConstraintMapping(httpContext);\n+ }\n+ }\n+\n+ private interface ConstraintHandler {\n+ boolean addConstraintMapping(HttpContext httpContext, WebContainer service, Object cm);\n+ }\n+\n+ private static class PaxWebConstraintHandler implements ConstraintHandler {\n+\n+ public boolean addConstraintMapping(HttpContext httpContext, WebContainer service, Object cm) {\n+ if (cm instanceof SecurityConstraintMappingModel) {\n+ SecurityConstraintMappingModel constraintMapping = (SecurityConstraintMappingModel) cm;\n+ String name = constraintMapping.getConstraintName();\n+ if (name == null) {\n+ name = \"Constraint-\" + new SecureRandom().nextInt(Integer.MAX_VALUE);\n+ }\n+ log.debug(\"Adding security constraint name=\" + name + \", url=\" + constraintMapping.getUrl() + \", dataConstraint=\" + constraintMapping.getDataConstraint() + \", canAuthenticate=\"\n+ + constraintMapping.isAuthentication() + \", roles=\" + constraintMapping.getRoles());\n+ service.registerConstraintMapping(name, constraintMapping.getUrl(), constraintMapping.getMapping(), constraintMapping.getDataConstraint(), constraintMapping.isAuthentication(), constraintMapping.getRoles(), httpContext);\n+ return true;\n+ }\n+ return false;\n+ }\n+\n+ }\n+\n+ private static class JettyConstraintHandler implements ConstraintHandler {\n+\n+ public boolean addConstraintMapping(HttpContext httpContext, WebContainer service, Object cm) {\n+ if (cm instanceof ConstraintMapping) {\n+ ConstraintMapping constraintMapping = (ConstraintMapping) cm;\n+ Constraint constraint = constraintMapping.getConstraint();\n+ String[] roles = constraint.getRoles();\n+ // name property is unavailable on constraint object :/\n+\n+ String name = \"Constraint-\" + new SecureRandom().nextInt(Integer.MAX_VALUE);\n+\n+ int dataConstraint = constraint.getDataConstraint();\n+ String dataConstraintStr;\n+ switch (dataConstraint) {\n+ case Constraint.DC_UNSET:\n+ dataConstraintStr = null;\n+ break;\n+ case Constraint.DC_NONE:\n+ dataConstraintStr = \"NONE\";\n+ break;\n+ case Constraint.DC_CONFIDENTIAL:\n+ dataConstraintStr = \"CONFIDENTIAL\";\n+ break;\n+ case Constraint.DC_INTEGRAL:\n+ dataConstraintStr = \"INTEGRAL\";\n+ break;\n+ default:\n+ log.warnv(\"Unknown data constraint: \" + dataConstraint);\n+ dataConstraintStr = \"CONFIDENTIAL\";\n+ }\n+ List rolesList = Arrays.asList(roles);\n+\n+ log.debug(\"Adding security constraint name=\" + name + \", url=\" + constraintMapping.getPathSpec() + \", dataConstraint=\" + dataConstraintStr + \", canAuthenticate=\"\n+ + constraint.getAuthenticate() + \", roles=\" + rolesList);\n+ service.registerConstraintMapping(name, constraintMapping.getPathSpec(), null, dataConstraintStr, constraint.getAuthenticate(), rolesList, httpContext);\n+ return true;\n+ }\n+ return false;\n+ }\n+\n+ }\n+}\n\\ No newline at end of file\n"},{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/jetty94/src/main/resources/META-INF/services/org.ops4j.pax.web.service.AuthenticatorService","diff":"+org.keycloak.adapters.osgi.jetty94.KeycloakAuthenticatorService\n\\ No newline at end of file\n"},{"change_type":"MODIFY","old_path":"adapters/oidc/fuse7/pom.xml","new_path":"adapters/oidc/fuse7/pom.xml","diff":"\ncamel-undertow\n+ jetty94\nundertow\n\n\n"},{"change_type":"MODIFY","old_path":"adapters/oidc/osgi-adapter/src/main/java/org/keycloak/adapters/osgi/PaxWebIntegrationService.java","new_path":"adapters/oidc/osgi-adapter/src/main/java/org/keycloak/adapters/osgi/PaxWebIntegrationService.java","diff":"@@ -34,7 +34,7 @@ import java.util.Arrays;\nimport java.util.List;\n/**\n- * Integration with pax-web, which allows to inject custom jetty-web.xml configuration from current bundle classpath into {@link WebContainer}\n+ * Integration with pax-web in Fuse 6.3, which allows to inject custom jetty-web.xml configuration from current bundle classpath into {@link WebContainer}\n* and allows to inject custom security constraint for securing resources by Keycloak.\n*\n*

It assumes that pax-web {@link WebContainer} is used as implementation of OSGI {@link org.osgi.service.http.HttpService}, which\n"},{"change_type":"MODIFY","old_path":"distribution/adapters/osgi/features/src/main/resources/features.xml","new_path":"distribution/adapters/osgi/features/src/main/resources/features.xml","diff":"mvn:org.keycloak/keycloak-jetty92-adapter/${project.version}\n\n+ \n+\n+\n\n\n

Keycloak Pax-Web adapter for Undertow
\n"}],"string":"[\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/jetty94/pom.xml\",\n \"diff\": \"+\\n+\\n+\\n+\\n+ \\n+ keycloak-fuse7-integration-pom\\n+ org.keycloak\\n+ 4.0.0.Beta3-SNAPSHOT\\n+ ../pom.xml\\n+ \\n+ 4.0.0\\n+\\n+ keycloak-pax-web-jetty94\\n+ Keycloak Fuse 7.0 Adapter - Jetty 9.4\\n+ bundle\\n+\\n+ \\n+ \\n+ org.keycloak.adapters.osgi.jetty94.*;version=\\\"${project.version}\\\"\\n+ \\n+ \\n+ !org.keycloak.adapters.osgi.jetty94,\\n+ org.keycloak.*;version=\\\"${project.version}\\\",\\n+ *;resolution:=optional\\n+ \\n+ org.ops4j.pax.web.pax-web-jetty\\n+ \\n+\\n+ \\n+ \\n+ org.jboss.logging\\n+ jboss-logging\\n+ provided\\n+ \\n+ \\n+ org.ops4j.pax.web\\n+ pax-web-api\\n+ provided\\n+ \\n+ \\n+ org.ops4j.pax.web\\n+ pax-web-spi\\n+ provided\\n+ \\n+ \\n+ org.osgi\\n+ org.osgi.core\\n+ provided\\n+ \\n+ \\n+ org.osgi\\n+ org.osgi.enterprise\\n+ provided\\n+ \\n+\\n+ \\n+ org.keycloak\\n+ keycloak-jetty94-adapter\\n+ provided\\n+ \\n+ \\n+ org.eclipse.jetty\\n+ jetty-security\\n+ ${jetty9.version}\\n+ provided\\n+ \\n+ \\n+\\n+ \\n+ \\n+ \\n+ org.apache.maven.plugins\\n+ maven-compiler-plugin\\n+ \\n+ ${maven.compiler.source}\\n+ ${maven.compiler.target}\\n+ \\n+ \\n+\\n+ \\n+ \\n+ maven-jar-plugin\\n+ \\n+ \\n+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF\\n+ \\n+ \\n+ \\n+ \\n+ org.apache.felix\\n+ maven-bundle-plugin\\n+ true\\n+ \\n+ \\n+ bundle-manifest\\n+ process-classes\\n+ \\n+ manifest\\n+ \\n+ \\n+ \\n+ \\n+ \\n+ ${project.name}\\n+ ${project.groupId}.${project.artifactId}\\n+ ${keycloak.osgi.import}\\n+ ${keycloak.osgi.export}\\n+ ${keycloak.osgi.fragment}\\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/jetty94/src/main/java/org/keycloak/adapters/osgi/jetty94/KeycloakAuthenticatorService.java\",\n \"diff\": \"+/*\\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.adapters.osgi.jetty94;\\n+\\n+import org.ops4j.pax.web.service.AuthenticatorService;\\n+\\n+/**\\n+ *\\n+ * @author hmlnarik\\n+ */\\n+public class KeycloakAuthenticatorService implements AuthenticatorService {\\n+\\n+ @Override\\n+ public T getAuthenticatorService(String method, Class iface) {\\n+ if (method == null || iface != org.eclipse.jetty.security.Authenticator.class) {\\n+ return null;\\n+ }\\n+\\n+ if (\\\"KEYCLOAK\\\".equalsIgnoreCase(method)) {\\n+ return iface.cast(new org.keycloak.adapters.jetty.KeycloakJettyAuthenticator());\\n+ }\\n+\\n+ return null;\\n+ }\\n+\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/jetty94/src/main/java/org/keycloak/adapters/osgi/jetty94/PaxWebIntegrationService.java\",\n \"diff\": \"+/*\\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.adapters.osgi.jetty94;\\n+\\n+import org.eclipse.jetty.security.ConstraintMapping;\\n+import org.eclipse.jetty.util.security.Constraint;\\n+import org.jboss.logging.Logger;\\n+import org.ops4j.pax.web.service.WebContainer;\\n+import org.ops4j.pax.web.service.spi.model.SecurityConstraintMappingModel;\\n+import org.osgi.framework.BundleContext;\\n+import org.osgi.framework.ServiceReference;\\n+import org.osgi.service.http.HttpContext;\\n+import org.osgi.util.tracker.ServiceTracker;\\n+import org.osgi.util.tracker.ServiceTrackerCustomizer;\\n+\\n+import java.net.URL;\\n+import java.security.SecureRandom;\\n+import java.util.ArrayList;\\n+import java.util.Arrays;\\n+import java.util.List;\\n+\\n+/**\\n+ * Integration with pax-web, which allows to inject custom jetty-web.xml configuration from current bundle classpath into {@link WebContainer}\\n+ * and allows to inject custom security constraint for securing resources by Keycloak.\\n+ *\\n+ *

It assumes that pax-web {@link WebContainer} is used as implementation of OSGI {@link org.osgi.service.http.HttpService}, which\\n+ * is true in karaf/fuse environment

\\n+ *\\n+ * @author Marek Posolda\\n+ */\\n+public class PaxWebIntegrationService {\\n+\\n+ protected static final Logger log = Logger.getLogger(PaxWebIntegrationService.class);\\n+\\n+ private BundleContext bundleContext;\\n+ private String jettyWebXmlLocation;\\n+ private List constraintMappings;\\n+\\n+ private ServiceTracker webContainerTracker;\\n+ private HttpContext httpContext;\\n+\\n+ public BundleContext getBundleContext() {\\n+ return bundleContext;\\n+ }\\n+\\n+ public void setBundleContext(BundleContext bundleContext) {\\n+ this.bundleContext = bundleContext;\\n+ }\\n+\\n+ public String getJettyWebXmlLocation() {\\n+ return jettyWebXmlLocation;\\n+ }\\n+\\n+ public void setJettyWebXmlLocation(String jettyWebXmlLocation) {\\n+ this.jettyWebXmlLocation = jettyWebXmlLocation;\\n+ }\\n+\\n+ public List getConstraintMappings() {\\n+ return constraintMappings;\\n+ }\\n+\\n+ public void setConstraintMappings(List constraintMappings) {\\n+ this.constraintMappings = constraintMappings;\\n+ }\\n+\\n+ protected ServiceTracker getWebContainerTracker() {\\n+ return webContainerTracker;\\n+ }\\n+\\n+ protected HttpContext getHttpContext() {\\n+ return httpContext;\\n+ }\\n+\\n+\\n+ public void start() {\\n+ ServiceTrackerCustomizer trackerCustomizer = new ServiceTrackerCustomizer() {\\n+\\n+ @Override\\n+ public Object addingService(ServiceReference reference) {\\n+ return addingWebContainerCallback(reference);\\n+ }\\n+\\n+ @Override\\n+ public void modifiedService(ServiceReference reference, Object service) {\\n+ }\\n+\\n+ @Override\\n+ public void removedService(ServiceReference reference, Object service) {\\n+ removingWebContainerCallback(reference);\\n+ }\\n+ };\\n+\\n+ webContainerTracker = new ServiceTracker(bundleContext, WebContainer.class.getName(), trackerCustomizer);\\n+ webContainerTracker.open();\\n+ }\\n+\\n+ public void stop() {\\n+ webContainerTracker.remove(webContainerTracker.getServiceReference());\\n+ }\\n+\\n+ protected WebContainer addingWebContainerCallback(ServiceReference webContainerServiceReference) {\\n+ WebContainer service = (WebContainer) bundleContext.getService(webContainerServiceReference);\\n+ httpContext = service.createDefaultHttpContext();\\n+\\n+ addJettyWebXml(service);\\n+\\n+ if (constraintMappings == null) {\\n+ throw new IllegalStateException(\\\"constraintMappings was null!\\\");\\n+ }\\n+ List handlers = new ArrayList<>();\\n+ try {\\n+ handlers.add(new JettyConstraintHandler());\\n+ } catch (Throwable t) {\\n+ // Ignore\\n+ }\\n+ try {\\n+ handlers.add(new PaxWebConstraintHandler());\\n+ } catch (Throwable t) {\\n+ // Ignore\\n+ }\\n+ for (Object constraintMapping : constraintMappings) {\\n+ boolean handled = false;\\n+ for (ConstraintHandler handler : handlers) {\\n+ handled |= handler.addConstraintMapping(httpContext, service, constraintMapping);\\n+ }\\n+ if (!handled) {\\n+ log.warnv(\\\"Unable to add constraint mapping for constraint of type \\\" + constraintMapping.getClass().toString());\\n+ }\\n+ }\\n+\\n+ service.registerLoginConfig(\\\"BASIC\\\", \\\"does-not-matter\\\", null, null, httpContext);\\n+\\n+ return service;\\n+ }\\n+\\n+ protected void addJettyWebXml(WebContainer service) {\\n+ String jettyWebXmlLoc;\\n+ if (this.jettyWebXmlLocation == null) {\\n+ jettyWebXmlLoc = \\\"/WEB-INF/jetty-web.xml\\\";\\n+ } else {\\n+ jettyWebXmlLoc = this.jettyWebXmlLocation;\\n+ }\\n+\\n+ URL jettyWebXml = bundleContext.getBundle().getResource(jettyWebXmlLoc);\\n+ if (jettyWebXml != null) {\\n+ log.debug(\\\"Found jetty-web XML configuration on bundle classpath on \\\" + jettyWebXmlLoc);\\n+ service.registerJettyWebXml(jettyWebXml, httpContext);\\n+ } else {\\n+ log.debug(\\\"Not found jetty-web XML configuration on bundle classpath on \\\" + jettyWebXmlLoc);\\n+ }\\n+ }\\n+\\n+ protected void addConstraintMapping(WebContainer service, SecurityConstraintMappingModel constraintMapping) {\\n+ String name = constraintMapping.getConstraintName();\\n+ if (name == null) {\\n+ name = \\\"Constraint-\\\" + new SecureRandom().nextInt(Integer.MAX_VALUE);\\n+ }\\n+ log.debug(\\\"Adding security constraint name=\\\" + name + \\\", url=\\\" + constraintMapping.getUrl() + \\\", dataConstraint=\\\" + constraintMapping.getDataConstraint() + \\\", canAuthenticate=\\\"\\n+ + constraintMapping.isAuthentication() + \\\", roles=\\\" + constraintMapping.getRoles());\\n+ service.registerConstraintMapping(name, constraintMapping.getUrl(), constraintMapping.getMapping(), constraintMapping.getDataConstraint(), constraintMapping.isAuthentication(), constraintMapping.getRoles(), httpContext);\\n+ }\\n+\\n+ protected void addConstraintMapping(WebContainer service, ConstraintMapping constraintMapping) {\\n+ Constraint constraint = constraintMapping.getConstraint();\\n+ String[] roles = constraint.getRoles();\\n+ // name property is unavailable on constraint object :/\\n+\\n+ String name = \\\"Constraint-\\\" + new SecureRandom().nextInt(Integer.MAX_VALUE);\\n+\\n+ int dataConstraint = constraint.getDataConstraint();\\n+ String dataConstraintStr;\\n+ switch (dataConstraint) {\\n+ case Constraint.DC_UNSET: dataConstraintStr = null; break;\\n+ case Constraint.DC_NONE: dataConstraintStr = \\\"NONE\\\"; break;\\n+ case Constraint.DC_CONFIDENTIAL: dataConstraintStr = \\\"CONFIDENTIAL\\\"; break;\\n+ case Constraint.DC_INTEGRAL: dataConstraintStr = \\\"INTEGRAL\\\"; break;\\n+ default:\\n+ log.warnv(\\\"Unknown data constraint: \\\" + dataConstraint);\\n+ dataConstraintStr = \\\"CONFIDENTIAL\\\";\\n+ }\\n+ List rolesList = Arrays.asList(roles);\\n+\\n+ log.debug(\\\"Adding security constraint name=\\\" + name + \\\", url=\\\" + constraintMapping.getPathSpec() + \\\", dataConstraint=\\\" + dataConstraintStr + \\\", canAuthenticate=\\\"\\n+ + constraint.getAuthenticate() + \\\", roles=\\\" + rolesList);\\n+ service.registerConstraintMapping(name, constraintMapping.getPathSpec(), null, dataConstraintStr, constraint.getAuthenticate(), rolesList, httpContext);\\n+ }\\n+\\n+ protected void removingWebContainerCallback(ServiceReference serviceReference) {\\n+ WebContainer service = (WebContainer)bundleContext.getService(serviceReference);\\n+ if (service != null) {\\n+ service.unregisterLoginConfig(httpContext);\\n+ service.unregisterConstraintMapping(httpContext);\\n+ }\\n+ }\\n+\\n+ private interface ConstraintHandler {\\n+ boolean addConstraintMapping(HttpContext httpContext, WebContainer service, Object cm);\\n+ }\\n+\\n+ private static class PaxWebConstraintHandler implements ConstraintHandler {\\n+\\n+ public boolean addConstraintMapping(HttpContext httpContext, WebContainer service, Object cm) {\\n+ if (cm instanceof SecurityConstraintMappingModel) {\\n+ SecurityConstraintMappingModel constraintMapping = (SecurityConstraintMappingModel) cm;\\n+ String name = constraintMapping.getConstraintName();\\n+ if (name == null) {\\n+ name = \\\"Constraint-\\\" + new SecureRandom().nextInt(Integer.MAX_VALUE);\\n+ }\\n+ log.debug(\\\"Adding security constraint name=\\\" + name + \\\", url=\\\" + constraintMapping.getUrl() + \\\", dataConstraint=\\\" + constraintMapping.getDataConstraint() + \\\", canAuthenticate=\\\"\\n+ + constraintMapping.isAuthentication() + \\\", roles=\\\" + constraintMapping.getRoles());\\n+ service.registerConstraintMapping(name, constraintMapping.getUrl(), constraintMapping.getMapping(), constraintMapping.getDataConstraint(), constraintMapping.isAuthentication(), constraintMapping.getRoles(), httpContext);\\n+ return true;\\n+ }\\n+ return false;\\n+ }\\n+\\n+ }\\n+\\n+ private static class JettyConstraintHandler implements ConstraintHandler {\\n+\\n+ public boolean addConstraintMapping(HttpContext httpContext, WebContainer service, Object cm) {\\n+ if (cm instanceof ConstraintMapping) {\\n+ ConstraintMapping constraintMapping = (ConstraintMapping) cm;\\n+ Constraint constraint = constraintMapping.getConstraint();\\n+ String[] roles = constraint.getRoles();\\n+ // name property is unavailable on constraint object :/\\n+\\n+ String name = \\\"Constraint-\\\" + new SecureRandom().nextInt(Integer.MAX_VALUE);\\n+\\n+ int dataConstraint = constraint.getDataConstraint();\\n+ String dataConstraintStr;\\n+ switch (dataConstraint) {\\n+ case Constraint.DC_UNSET:\\n+ dataConstraintStr = null;\\n+ break;\\n+ case Constraint.DC_NONE:\\n+ dataConstraintStr = \\\"NONE\\\";\\n+ break;\\n+ case Constraint.DC_CONFIDENTIAL:\\n+ dataConstraintStr = \\\"CONFIDENTIAL\\\";\\n+ break;\\n+ case Constraint.DC_INTEGRAL:\\n+ dataConstraintStr = \\\"INTEGRAL\\\";\\n+ break;\\n+ default:\\n+ log.warnv(\\\"Unknown data constraint: \\\" + dataConstraint);\\n+ dataConstraintStr = \\\"CONFIDENTIAL\\\";\\n+ }\\n+ List rolesList = Arrays.asList(roles);\\n+\\n+ log.debug(\\\"Adding security constraint name=\\\" + name + \\\", url=\\\" + constraintMapping.getPathSpec() + \\\", dataConstraint=\\\" + dataConstraintStr + \\\", canAuthenticate=\\\"\\n+ + constraint.getAuthenticate() + \\\", roles=\\\" + rolesList);\\n+ service.registerConstraintMapping(name, constraintMapping.getPathSpec(), null, dataConstraintStr, constraint.getAuthenticate(), rolesList, httpContext);\\n+ return true;\\n+ }\\n+ return false;\\n+ }\\n+\\n+ }\\n+}\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/jetty94/src/main/resources/META-INF/services/org.ops4j.pax.web.service.AuthenticatorService\",\n \"diff\": \"+org.keycloak.adapters.osgi.jetty94.KeycloakAuthenticatorService\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"adapters/oidc/fuse7/pom.xml\",\n \"new_path\": \"adapters/oidc/fuse7/pom.xml\",\n \"diff\": \"\\ncamel-undertow\\n+ jetty94\\nundertow\\n\\n\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"adapters/oidc/osgi-adapter/src/main/java/org/keycloak/adapters/osgi/PaxWebIntegrationService.java\",\n \"new_path\": \"adapters/oidc/osgi-adapter/src/main/java/org/keycloak/adapters/osgi/PaxWebIntegrationService.java\",\n \"diff\": \"@@ -34,7 +34,7 @@ import java.util.Arrays;\\nimport java.util.List;\\n/**\\n- * Integration with pax-web, which allows to inject custom jetty-web.xml configuration from current bundle classpath into {@link WebContainer}\\n+ * Integration with pax-web in Fuse 6.3, which allows to inject custom jetty-web.xml configuration from current bundle classpath into {@link WebContainer}\\n* and allows to inject custom security constraint for securing resources by Keycloak.\\n*\\n*

It assumes that pax-web {@link WebContainer} is used as implementation of OSGI {@link org.osgi.service.http.HttpService}, which\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"distribution/adapters/osgi/features/src/main/resources/features.xml\",\n \"new_path\": \"distribution/adapters/osgi/features/src/main/resources/features.xml\",\n \"diff\": \"mvn:org.keycloak/keycloak-jetty92-adapter/${project.version}\\n\\n+ \\n+\\n+\\n\\n\\n

Keycloak Pax-Web adapter for Undertow
\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-7277 KEYCLOAK-7282 Jetty/Pax Web integration"}}},{"rowIdx":2936,"cells":{"author":{"kind":"number","value":339185,"string":"339,185"},"date":{"kind":"string","value":"18.05.2018 12:47:01"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"1e438cdc452709bfdf3c895006563ef570d5c776"},"message":{"kind":"string","value":"KEYCLOAK-7282 Tomcat 8/Pax Web integration"},"mods":{"kind":"list like","value":[{"change_type":"MODIFY","old_path":"adapters/oidc/fuse7/pom.xml","new_path":"adapters/oidc/fuse7/pom.xml","diff":"\ncamel-undertow\njetty94\n+ tomcat8\nundertow\n\n\n"},{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/tomcat8/pom.xml","diff":"+\n+\n+\n+\n+ \n+ keycloak-fuse7-integration-pom\n+ org.keycloak\n+ 4.0.0.Beta3-SNAPSHOT\n+ ../pom.xml\n+ \n+ 4.0.0\n+\n+ keycloak-pax-web-tomcat8\n+ Keycloak Fuse 7.0 Adapter - Tomcat 8\n+ bundle\n+\n+ \n+ \n+ org.keycloak.adapters.osgi.tomcat.*;version=\"${project.version}\"\n+ \n+ \n+ !org.keycloak.adapters.osgi.tomcat,\n+ org.keycloak.*;version=\"${project.version}\",\n+ *;resolution:=optional\n+ \n+ org.ops4j.pax.web.pax-web-tomcat\n+ \n+\n+ \n+ \n+ org.jboss.logging\n+ jboss-logging\n+ provided\n+ \n+ \n+ org.ops4j.pax.web\n+ pax-web-api\n+ provided\n+ \n+\n+ \n+ org.keycloak\n+ keycloak-tomcat8-adapter\n+ provided\n+ \n+ \n+ org.apache.tomcat\n+ tomcat-catalina\n+ ${tomcat.version}\n+ provided\n+ \n+ \n+\n+ \n+ \n+ \n+ org.apache.maven.plugins\n+ maven-compiler-plugin\n+ \n+ ${maven.compiler.source}\n+ ${maven.compiler.target}\n+ \n+ \n+\n+ \n+ \n+ maven-jar-plugin\n+ \n+ \n+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF\n+ \n+ \n+ \n+ \n+ org.apache.felix\n+ maven-bundle-plugin\n+ true\n+ \n+ \n+ bundle-manifest\n+ process-classes\n+ \n+ manifest\n+ \n+ \n+ \n+ \n+ \n+ ${project.name}\n+ ${project.groupId}.${project.artifactId}\n+ ${keycloak.osgi.import}\n+ ${keycloak.osgi.export}\n+ ${keycloak.osgi.fragment}\n+ \n+ \n+ \n+ \n+ \n+\n"},{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/tomcat8/src/main/java/org/keycloak/adapters/osgi/tomcat/KeycloakAuthenticatorService.java","diff":"+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.adapters.osgi.tomcat;\n+\n+import org.ops4j.pax.web.service.AuthenticatorService;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public class KeycloakAuthenticatorService implements AuthenticatorService {\n+\n+ @Override\n+ public T getAuthenticatorService(String method, Class iface) {\n+ if (method == null || iface != org.apache.catalina.Valve.class) {\n+ return null;\n+ }\n+\n+ if (\"KEYCLOAK\".equalsIgnoreCase(method)) {\n+ return iface.cast(new org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve());\n+ }\n+\n+ return null;\n+ }\n+\n+}\n"},{"change_type":"ADD","old_path":null,"new_path":"adapters/oidc/fuse7/tomcat8/src/main/resources/META-INF/services/org.ops4j.pax.web.service.AuthenticatorService","diff":"+org.keycloak.adapters.osgi.tomcat.KeycloakAuthenticatorService\n\\ No newline at end of file\n"},{"change_type":"MODIFY","old_path":"distribution/adapters/osgi/features/src/main/resources/features.xml","new_path":"distribution/adapters/osgi/features/src/main/resources/features.xml","diff":"mvn:org.keycloak/keycloak-camel-undertow/${project.version}\n\n+ \n+\n+\n\n
The keycloak JAAS configuration
\nkeycloak-adapter-core\n"}],"string":"[\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"adapters/oidc/fuse7/pom.xml\",\n \"new_path\": \"adapters/oidc/fuse7/pom.xml\",\n \"diff\": \"\\ncamel-undertow\\njetty94\\n+ tomcat8\\nundertow\\n\\n\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/tomcat8/pom.xml\",\n \"diff\": \"+\\n+\\n+\\n+\\n+ \\n+ keycloak-fuse7-integration-pom\\n+ org.keycloak\\n+ 4.0.0.Beta3-SNAPSHOT\\n+ ../pom.xml\\n+ \\n+ 4.0.0\\n+\\n+ keycloak-pax-web-tomcat8\\n+ Keycloak Fuse 7.0 Adapter - Tomcat 8\\n+ bundle\\n+\\n+ \\n+ \\n+ org.keycloak.adapters.osgi.tomcat.*;version=\\\"${project.version}\\\"\\n+ \\n+ \\n+ !org.keycloak.adapters.osgi.tomcat,\\n+ org.keycloak.*;version=\\\"${project.version}\\\",\\n+ *;resolution:=optional\\n+ \\n+ org.ops4j.pax.web.pax-web-tomcat\\n+ \\n+\\n+ \\n+ \\n+ org.jboss.logging\\n+ jboss-logging\\n+ provided\\n+ \\n+ \\n+ org.ops4j.pax.web\\n+ pax-web-api\\n+ provided\\n+ \\n+\\n+ \\n+ org.keycloak\\n+ keycloak-tomcat8-adapter\\n+ provided\\n+ \\n+ \\n+ org.apache.tomcat\\n+ tomcat-catalina\\n+ ${tomcat.version}\\n+ provided\\n+ \\n+ \\n+\\n+ \\n+ \\n+ \\n+ org.apache.maven.plugins\\n+ maven-compiler-plugin\\n+ \\n+ ${maven.compiler.source}\\n+ ${maven.compiler.target}\\n+ \\n+ \\n+\\n+ \\n+ \\n+ maven-jar-plugin\\n+ \\n+ \\n+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF\\n+ \\n+ \\n+ \\n+ \\n+ org.apache.felix\\n+ maven-bundle-plugin\\n+ true\\n+ \\n+ \\n+ bundle-manifest\\n+ process-classes\\n+ \\n+ manifest\\n+ \\n+ \\n+ \\n+ \\n+ \\n+ ${project.name}\\n+ ${project.groupId}.${project.artifactId}\\n+ ${keycloak.osgi.import}\\n+ ${keycloak.osgi.export}\\n+ ${keycloak.osgi.fragment}\\n+ \\n+ \\n+ \\n+ \\n+ \\n+\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/tomcat8/src/main/java/org/keycloak/adapters/osgi/tomcat/KeycloakAuthenticatorService.java\",\n \"diff\": \"+/*\\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\\n+ * and other contributors as indicated by the @author tags.\\n+ *\\n+ * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n+ * you may not use this file except in compliance with the License.\\n+ * You may obtain a copy of the License at\\n+ *\\n+ * http://www.apache.org/licenses/LICENSE-2.0\\n+ *\\n+ * Unless required by applicable law or agreed to in writing, software\\n+ * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n+ * See the License for the specific language governing permissions and\\n+ * limitations under the License.\\n+ */\\n+\\n+package org.keycloak.adapters.osgi.tomcat;\\n+\\n+import org.ops4j.pax.web.service.AuthenticatorService;\\n+\\n+/**\\n+ *\\n+ * @author hmlnarik\\n+ */\\n+public class KeycloakAuthenticatorService implements AuthenticatorService {\\n+\\n+ @Override\\n+ public T getAuthenticatorService(String method, Class iface) {\\n+ if (method == null || iface != org.apache.catalina.Valve.class) {\\n+ return null;\\n+ }\\n+\\n+ if (\\\"KEYCLOAK\\\".equalsIgnoreCase(method)) {\\n+ return iface.cast(new org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve());\\n+ }\\n+\\n+ return null;\\n+ }\\n+\\n+}\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"adapters/oidc/fuse7/tomcat8/src/main/resources/META-INF/services/org.ops4j.pax.web.service.AuthenticatorService\",\n \"diff\": \"+org.keycloak.adapters.osgi.tomcat.KeycloakAuthenticatorService\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"distribution/adapters/osgi/features/src/main/resources/features.xml\",\n \"new_path\": \"distribution/adapters/osgi/features/src/main/resources/features.xml\",\n \"diff\": \"mvn:org.keycloak/keycloak-camel-undertow/${project.version}\\n
\\n+ \\n+\\n+\\n\\n
The keycloak JAAS configuration
\\nkeycloak-adapter-core\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-7277 KEYCLOAK-7282 Tomcat 8/Pax Web integration"}}},{"rowIdx":2937,"cells":{"author":{"kind":"number","value":339185,"string":"339,185"},"date":{"kind":"string","value":"24.05.2018 15:32:01"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"dd6735285d5adaabd0dbf6e39e938b987b5b6914"},"message":{"kind":"string","value":"Don't create symlinks in download-license-files.sh"},"mods":{"kind":"list like","value":[{"change_type":"MODIFY","old_path":"distribution/licenses-common/download-license-files.sh","new_path":"distribution/licenses-common/download-license-files.sh","diff":"@@ -61,30 +61,4 @@ echo \"==> Normalizing license line endings\" >&2\nfind \"$output_dir\" -maxdepth 1 -type f -name '*.txt' -print0 | xargs --no-run-if-empty -0 dos2unix\n-echo \"==> Symlinking identical files\" >&2\n-\n-hashtemp=\"$(mktemp)\"\n-trap \"rm '$hashtemp'\" EXIT\n-\n-cd \"$output_dir\"\n-find -maxdepth 1 -type f -name '*.txt' -print0 | LC_ALL=C sort -z | xargs --no-run-if-empty -0 sha256sum | sed 's, \\./,,' > \"$hashtemp\"\n-\n-declare -A processed_hashes\n-\n-while IFS=\" \" read -r -d $'\\n' hash filename\n-do\n- if ! [ -v processed_hashes[\"$hash\"] ]\n- then\n- echo \"$filename\" >&2\n- grep -F \"$hash \" \"$hashtemp\" | grep -vxF \"$hash $filename\" | \\\n- while IFS=\" \" read -r -d $'\\n' dup_hash dup_filename\n- do\n- echo \" -> $dup_filename\" >&2\n- rm \"$dup_filename\"\n- ln -s \"$filename\" \"$dup_filename\"\n- done\n- processed_hashes[\"$hash\"]=\"$filename\"\n- fi\n-done < \"$hashtemp\"\n-\necho \"==> Complete\" >&2\n"}],"string":"[\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"distribution/licenses-common/download-license-files.sh\",\n \"new_path\": \"distribution/licenses-common/download-license-files.sh\",\n \"diff\": \"@@ -61,30 +61,4 @@ echo \\\"==> Normalizing license line endings\\\" >&2\\nfind \\\"$output_dir\\\" -maxdepth 1 -type f -name '*.txt' -print0 | xargs --no-run-if-empty -0 dos2unix\\n-echo \\\"==> Symlinking identical files\\\" >&2\\n-\\n-hashtemp=\\\"$(mktemp)\\\"\\n-trap \\\"rm '$hashtemp'\\\" EXIT\\n-\\n-cd \\\"$output_dir\\\"\\n-find -maxdepth 1 -type f -name '*.txt' -print0 | LC_ALL=C sort -z | xargs --no-run-if-empty -0 sha256sum | sed 's, \\\\./,,' > \\\"$hashtemp\\\"\\n-\\n-declare -A processed_hashes\\n-\\n-while IFS=\\\" \\\" read -r -d $'\\\\n' hash filename\\n-do\\n- if ! [ -v processed_hashes[\\\"$hash\\\"] ]\\n- then\\n- echo \\\"$filename\\\" >&2\\n- grep -F \\\"$hash \\\" \\\"$hashtemp\\\" | grep -vxF \\\"$hash $filename\\\" | \\\\\\n- while IFS=\\\" \\\" read -r -d $'\\\\n' dup_hash dup_filename\\n- do\\n- echo \\\" -> $dup_filename\\\" >&2\\n- rm \\\"$dup_filename\\\"\\n- ln -s \\\"$filename\\\" \\\"$dup_filename\\\"\\n- done\\n- processed_hashes[\\\"$hash\\\"]=\\\"$filename\\\"\\n- fi\\n-done < \\\"$hashtemp\\\"\\n-\\necho \\\"==> Complete\\\" >&2\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-7438 Don't create symlinks in download-license-files.sh"}}},{"rowIdx":2938,"cells":{"author":{"kind":"number","value":339185,"string":"339,185"},"date":{"kind":"string","value":"24.05.2018 16:06:53"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"60a03d0293108f23fc15db33918a5cff9a8b8632"},"message":{"kind":"string","value":"Align versions to match EAP 7.1.3"},"mods":{"kind":"list like","value":[{"change_type":"MODIFY","old_path":"pom.xml","new_path":"pom.xml","diff":"pom\n\n- 7.2.2.GA\n+ 7.2.3.GA\n${timestamp}\n11.0.0.Final\n1.2.2.Final\n- 7.1.2.GA-redhat-1\n+ 7.1.3.GA-redhat-1\n1.2.2.Final\n3.0.10.Final\n2.0.10.Final\n1.6.1\n2011.1\n1.4.193\n- 5.1.13.Final\n+ 5.1.14.Final\n1.0.0.Final\n- 8.2.10.Final\n+ 8.2.11.Final\n2.8.11\n- 2.8.11\n+ 2.8.11.1\n1.5.5\n3.3.1.Final\n- 2.0.1.Final\n+ 2.1.0.Final\n1.2.0.Final\n1.0.0.Final\n1.0.1.Final\n2.2.11\n20140925\n1.4.18.Final\n- 1.1.9.Final\n+ 1.1.10.Final\n1.0.1.Final\n5.0.3\n2.0.9\n"}],"string":"[\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"pom.xml\",\n \"new_path\": \"pom.xml\",\n \"diff\": \"pom\\n\\n- 7.2.2.GA\\n+ 7.2.3.GA\\n${timestamp}\\n11.0.0.Final\\n1.2.2.Final\\n- 7.1.2.GA-redhat-1\\n+ 7.1.3.GA-redhat-1\\n1.2.2.Final\\n3.0.10.Final\\n2.0.10.Final\\n1.6.1\\n2011.1\\n1.4.193\\n- 5.1.13.Final\\n+ 5.1.14.Final\\n1.0.0.Final\\n- 8.2.10.Final\\n+ 8.2.11.Final\\n2.8.11\\n- 2.8.11\\n+ 2.8.11.1\\n1.5.5\\n3.3.1.Final\\n- 2.0.1.Final\\n+ 2.1.0.Final\\n1.2.0.Final\\n1.0.0.Final\\n1.0.1.Final\\n2.2.11\\n20140925\\n1.4.18.Final\\n- 1.1.9.Final\\n+ 1.1.10.Final\\n1.0.1.Final\\n5.0.3\\n2.0.9\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-7434 Align versions to match EAP 7.1.3"}}},{"rowIdx":2939,"cells":{"author":{"kind":"number","value":339581,"string":"339,581"},"date":{"kind":"string","value":"09.03.2018 18:14:48"},"timezone":{"kind":"number","value":-3600,"string":"-3,600"},"hash":{"kind":"string","value":"b8adee4004179af7a41b822e40e869fd0bc60748"},"message":{"kind":"string","value":"Create the databases for import during perf tests"},"mods":{"kind":"list like","value":[{"change_type":"ADD","old_path":null,"new_path":"testsuite/performance/README.datasets.md","diff":"+# Keycloak Performance Testsuite - Generating datasets\n+\n+\n+## Generating a set of datasets for multiple realms\n+\n+The first dataset is small and is created quickly. Building of each subsequent dataset continues on top\n+of the previous dataset.\n+\n+Datasets are created with a specific released server version (rather than a snapshot) in order to be\n+usable with later releases - newer server version should be able to migrate schema from any previous release.\n+\n+We use 10 concurrent threads, which is enough to saturate a\n+dual core machine. For quad-core you can try to double the number of workers.\n+\n+```\n+cd testsuite/performance\n+\n+mvn clean install -Dserver.version=4.0.0.Beta1\n+\n+mvn verify -Pteardown\n+mvn verify -Pprovision\n+mvn verify -Pgenerate-data -Ddataset=10r100u1c -DnumOfWorkers=10\n+mvn verify -Pexport-dump -Ddataset=10r100u1c\n+\n+mvn verify -Pgenerate-data -Ddataset=20r100u1c -DstartAtRealmIdx=10 -DnumOfWorkers=10\n+mvn verify -Pexport-dump -Ddataset=20r100u1c\n+\n+mvn verify -Pgenerate-data -Ddataset=50r100u1c -DstartAtRealmIdx=20 -DnumOfWorkers=10\n+mvn verify -Pexport-dump -Ddataset=50r100u1c\n+\n+mvn verify -Pgenerate-data -Ddataset=200r100u1c -DstartAtRealmIdx=50 -DnumOfWorkers=10\n+mvn verify -Pexport-dump -Ddataset=200r100u1c\n+\n+mvn verify -Pgenerate-data -Ddataset=500r100u1c -DstartAtRealmIdx=200 -DnumOfWorkers=10\n+mvn verify -Pexport-dump -Ddataset=500r100u1c\n+```\n+\n+If the dataset dump file is not available locally but it's known that the dataset for specific version exists on the server\n+it can be retrieved by specifying a proper server version again. For example:\n+```\n+mvn verify -Pteardown\n+mvn clean install\n+mvn verify -Pprovision\n+mvn verify -Pimport-dump -Ddataset=20r100u1c -Dserver.version=4.0.0.Beta1\n+\n+```\n"},{"change_type":"MODIFY","old_path":"testsuite/performance/tests/docker-compose.sh","new_path":"testsuite/performance/tests/docker-compose.sh","diff":"@@ -399,7 +399,7 @@ case \"$OPERATION\" in\nfi\necho \"Importing $DATASET.sql.gz\"\nset -o pipefail\n- if ! zcat $DATASET.sql.gz | docker exec -i $DB_CONTAINER /usr/bin/mysql -u root --password=root keycloak ; then\n+ if ! gunzip -c $DATASET.sql.gz | docker exec -i $DB_CONTAINER /usr/bin/mysql -u root --password=root keycloak ; then\necho Import failed.\nexit 1\nfi\n"},{"change_type":"ADD","old_path":null,"new_path":"testsuite/performance/tests/parameters/datasets/10r100u1c.properties","diff":"+numOfRealms=10\n+usersPerRealm=100\n+clientsPerRealm=1\n+realmRoles=100\n+realmRolesPerUser=50\n+clientRolesPerUser=0\n+clientRolesPerClient=0\n+hashIterations=27500\n\\ No newline at end of file\n"},{"change_type":"ADD","old_path":null,"new_path":"testsuite/performance/tests/parameters/datasets/200r100u1c.properties","diff":"+numOfRealms=200\n+usersPerRealm=100\n+clientsPerRealm=1\n+realmRoles=100\n+realmRolesPerUser=50\n+clientRolesPerUser=0\n+clientRolesPerClient=0\n+hashIterations=27500\n\\ No newline at end of file\n"},{"change_type":"ADD","old_path":null,"new_path":"testsuite/performance/tests/parameters/datasets/20r100u1c.properties","diff":"+numOfRealms=20\n+usersPerRealm=100\n+clientsPerRealm=1\n+realmRoles=100\n+realmRolesPerUser=50\n+clientRolesPerUser=0\n+clientRolesPerClient=0\n+hashIterations=27500\n\\ No newline at end of file\n"},{"change_type":"ADD","old_path":null,"new_path":"testsuite/performance/tests/parameters/datasets/500r100u1c.properties","diff":"+numOfRealms=500\n+usersPerRealm=100\n+clientsPerRealm=1\n+realmRoles=100\n+realmRolesPerUser=50\n+clientRolesPerUser=0\n+clientRolesPerClient=0\n+hashIterations=27500\n\\ No newline at end of file\n"},{"change_type":"ADD","old_path":null,"new_path":"testsuite/performance/tests/parameters/datasets/50r100u1c.properties","diff":"+numOfRealms=50\n+usersPerRealm=100\n+clientsPerRealm=1\n+realmRoles=100\n+realmRolesPerUser=50\n+clientRolesPerUser=0\n+clientRolesPerClient=0\n+hashIterations=27500\n\\ No newline at end of file\n"},{"change_type":"MODIFY","old_path":"testsuite/performance/tests/pom.xml","new_path":"testsuite/performance/tests/pom.xml","diff":"read-project-properties\n\n\n+ true\n\n${provisioning.properties.file}\n${dataset.properties.file}\n\ngenerate-data\n+ \n+ 0\n+ false\n+ false\n+ false\n+ \n\n\n\n-DauthUser=${keycloak.admin.user}\n-DauthPassword=${keycloak.admin.password}\n-DnumOfWorkers=${numOfWorkers}\n+ -DstartAtRealmIdx=${startAtRealmIdx}\n+ -DignoreConflicts=${ignoreConflicts}\n+ -DskipRealmRoles=${skipRealmRoles}\n+ -DskipClientRoles=${skipClientRoles}\norg.keycloak.performance.RealmsConfigurationLoader\nbenchmark-realms.json\n\n"},{"change_type":"MODIFY","old_path":"testsuite/performance/tests/src/main/java/org/keycloak/performance/RealmsConfigurationLoader.java","new_path":"testsuite/performance/tests/src/main/java/org/keycloak/performance/RealmsConfigurationLoader.java","diff":"@@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.JsonFactory;\nimport com.fasterxml.jackson.core.JsonParser;\nimport com.fasterxml.jackson.core.JsonToken;\nimport com.fasterxml.jackson.databind.ObjectMapper;\n+import org.jboss.logging.Logger;\nimport org.keycloak.admin.client.Keycloak;\nimport org.keycloak.representations.idm.ClientRepresentation;\nimport org.keycloak.representations.idm.CredentialRepresentation;\n@@ -12,6 +13,7 @@ import org.keycloak.representations.idm.RealmRepresentation;\nimport org.keycloak.representations.idm.RoleRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\n+import javax.ws.rs.ClientErrorException;\nimport javax.ws.rs.core.Response;\nimport java.io.File;\nimport java.io.IOException;\n@@ -28,24 +30,37 @@ import java.util.concurrent.ExecutionException;\nimport java.util.concurrent.LinkedBlockingQueue;\nimport static org.keycloak.performance.RealmsConfigurationBuilder.EXPORT_FILENAME;\n+import static org.keycloak.performance.TestConfig.ignoreConflicts;\nimport static org.keycloak.performance.TestConfig.numOfWorkers;\n+import static org.keycloak.performance.TestConfig.skipClientRoles;\n+import static org.keycloak.performance.TestConfig.skipRealmRoles;\n+import static org.keycloak.performance.TestConfig.startAtRealmIdx;\n+import static org.keycloak.performance.TestConfig.startAtUserIdx;\n/**\n* # build\n- * mvn -f testsuite/integration-arquillian/tests/performance/gatling-perf clean install\n+ * mvn -f testsuite/performance/tests clean install\n*\n* # generate benchmark-realms.json file with generated test data\n- * mvn -f testsuite/integration-arquillian/tests/performance/gatling-perf exec:java -Dexec.mainClass=org.keycloak.performance.RealmsConfigurationBuilder -DnumOfRealms=2 -DusersPerRealm=2 -DclientsPerRealm=2 -DrealmRoles=2 -DrealmRolesPerUser=2 -DclientRolesPerUser=2 -DclientRolesPerClient=2\n+ * mvn -f testsuite/performance/tests exec:java -Dexec.mainClass=org.keycloak.performance.RealmsConfigurationBuilder -DnumOfRealms=2 -DusersPerRealm=2 -DclientsPerRealm=2 -DrealmRoles=2 -DrealmRolesPerUser=2 -DclientRolesPerUser=2 -DclientRolesPerClient=2\n*\n* # use benchmark-realms.json to load the data up to Keycloak Server listening on localhost:8080\n- * mvn -f testsuite/integration-arquillian/tests/performance/gatling-perf exec:java -Dexec.mainClass=org.keycloak.performance.RealmsConfigurationLoader -DnumOfWorkers=5 -Dexec.args=benchmark-realms.json > perf-output.txt\n+ * mvn -f testsuite/performance/tests exec:java -Dexec.mainClass=org.keycloak.performance.RealmsConfigurationLoader -DnumOfWorkers=5 -Dexec.args=benchmark-realms.json > perf-output.txt\n*\n* @author Marko Strukelj\n*/\npublic class RealmsConfigurationLoader {\n+ static Logger log = Logger.getLogger(RealmsConfigurationLoader.class.getName());\n+\nstatic final int ERROR_CHECK_INTERVAL = 10;\n+ static int currentRealm = 0;\n+ static int currentUser = 0;\n+ static int currentClient = 0;\n+\n+ static boolean started;\n+\n// multi-thread mechanics\nstatic final BlockingQueue queue = new LinkedBlockingQueue<>(numOfWorkers);\nstatic final ArrayList workers = new ArrayList<>();\n@@ -58,24 +73,28 @@ public class RealmsConfigurationLoader {\nstatic boolean realmCreated;\npublic static void main(String [] args) throws IOException {\n- System.out.println(\"Keycloak servers: \"+TestConfig.serverUrisList);\n+ println(\"Keycloak servers: \"+TestConfig.serverUrisList);\nif (args.length == 0) {\nargs = new String[] {EXPORT_FILENAME};\n}\nif (args.length != 1) {\n- System.out.println(\"Usage: java \" + RealmsConfigurationLoader.class.getName() + \" \");\n+ println(\"Usage: java \" + RealmsConfigurationLoader.class.getName() + \" \");\nreturn;\n}\nString file = args[0];\n- System.out.println(\"Using file: \" + new File(args[0]).getAbsolutePath());\n- System.out.println(\"Number of workers (numOfWorkers): \" + numOfWorkers);\n+ println(\"Using file: \" + new File(args[0]).getAbsolutePath());\n+ println(\"Number of workers (numOfWorkers): \" + numOfWorkers);\n+ println(\"Parameters: \");\n+ println(\" startAtRealmIdx: \" + startAtRealmIdx);\n+// println(\" startAtUserIdx: \" + startAtUserIdx);\nJsonParser p = initParser(file);\ninitWorkers();\n+ initProgress();\ntry {\n@@ -88,6 +107,28 @@ public class RealmsConfigurationLoader {\n}\n}\n+ private static void initProgress() {\n+ Thread t = new Thread(() -> {\n+\n+ for (;;) {\n+ try {\n+ Thread.sleep(60000);\n+ println(\"At realm: \" + currentRealm + \", Clients: \" + currentClient + \", Users: \" + currentUser);\n+ } catch (InterruptedException e) {\n+ return;\n+ }\n+\n+ }\n+\n+ },\"Progress Logger\");\n+ t.setDaemon(true);\n+ t.start();\n+ }\n+\n+ private static void println(String s) {\n+ System.out.println(s);\n+ }\n+\nprivate static void completeWorkers() {\ntry {\n@@ -101,7 +142,7 @@ public class RealmsConfigurationLoader {\ntry {\nw.join(5000);\nif (w.isAlive()) {\n- System.out.println(\"Worker thread failed to stop: \");\n+ println(\"Worker thread failed to stop: \");\ndumpThread(w);\n}\n} catch (InterruptedException e) {\n@@ -117,6 +158,7 @@ public class RealmsConfigurationLoader {\nwhile (t != JsonToken.END_OBJECT && t != JsonToken.END_ARRAY) {\nif (t != JsonToken.START_ARRAY) {\nreadRealm(p);\n+ currentRealm += 1;\n}\nt = p.nextToken();\n}\n@@ -150,7 +192,7 @@ public class RealmsConfigurationLoader {\nfor (StackTraceElement e: w.getStackTrace()) {\nb.append(e.toString()).append(\"\\n\");\n}\n- System.out.print(b);\n+ println(b.toString());\n}\nprivate static void readRealm(JsonParser p) throws IOException {\n@@ -158,15 +200,22 @@ public class RealmsConfigurationLoader {\n// as soon as we encounter users, roles, clients we create a CreateRealmJob\n// TODO: if after that point in a realm we encounter realm attribute, we report a warning but continue\n+ boolean skip = false;\n+ try {\nRealmRepresentation r = new RealmRepresentation();\nJsonToken t = p.nextToken();\n- while (t != JsonToken.END_OBJECT) {\n+ outer:\n+ while (t != JsonToken.END_OBJECT && !skip) {\n//System.out.println(t + \", name: \" + p.getCurrentName() + \", text: '\" + p.getText() + \"', value: \" + p.getValueAsString());\nswitch (p.getCurrentName()) {\ncase \"realm\":\nr.setRealm(getStringValue(p));\n+ skip = !started && realmSkipped(r.getRealm()) ;\n+ if (skip) {\n+ break outer;\n+ }\nbreak;\ncase \"enabled\":\nr.setEnabled(getBooleanValue(p));\n@@ -180,8 +229,15 @@ public class RealmsConfigurationLoader {\ncase \"passwordPolicy\":\nr.setPasswordPolicy(getStringValue(p));\nbreak;\n+ case \"sslRequired\":\n+ r.setSslRequired(getStringValue(p));\n+ break;\ncase \"users\":\nensureRealm(r);\n+ if (seekToStart()) {\n+ enqueueFetchRealmRoles(r);\n+ completePending();\n+ }\nreadUsers(r, p);\nbreak;\ncase \"roles\":\n@@ -191,16 +247,29 @@ public class RealmsConfigurationLoader {\ncase \"clients\":\nensureRealm(r);\nreadClients(r, p);\n+ completePending();\n+ if (seekToStart()) {\n+ enqueueFetchMissingClients(r);\n+ completePending();\n+ }\nbreak;\ndefault: {\n// if we don't understand the field we ignore it - but report that\n- System.out.println(\"Realm attribute ignored: \" + p.getCurrentName());\n+ log.warn(\"Realm attribute ignored: \" + p.getCurrentName());\nconsumeAttribute(p);\n+ continue; // skip p.nextToken() at end of loop - consumeAttribute() already did it\n}\n}\n+\nt = p.nextToken();\n}\n+ if (skip) {\n+ log.info(\"Realm skipped: \" + r.getRealm());\n+ consumeParent(p);\n+ }\n+\n+ } finally {\n// we wait for realm to complete\ncompletePending();\n@@ -210,6 +279,34 @@ public class RealmsConfigurationLoader {\nrealmRoleIdMap.clear();\nclientRoleIdMap.clear();\n}\n+ }\n+\n+ private static void consumeParent(JsonParser p) throws IOException {\n+ while (p.currentToken() != JsonToken.END_OBJECT) {\n+ consumeAttribute(p);\n+ }\n+ }\n+\n+ private static boolean seekToStart() {\n+ return startAtRealmIdx > 0 || startAtUserIdx > 0;\n+ }\n+\n+ private static boolean seeking() {\n+ return currentRealm < startAtRealmIdx || currentUser < startAtUserIdx;\n+ }\n+\n+ private static boolean realmSkipped(String realm) {\n+ int pos = realm.lastIndexOf(\"_\");\n+ int idx = Integer.parseInt(realm.substring(pos+1));\n+ return idx < startAtRealmIdx;\n+ }\n+\n+ private static boolean userSkipped(String username) {\n+ int pos = username.indexOf(\"_\");\n+ int end = username.indexOf(\"_\", pos+1);\n+ int idx = Integer.parseInt(username.substring(pos+1, end));\n+ return idx < startAtUserIdx;\n+ }\nprivate static void ensureRealm(RealmRepresentation r) {\nif (!realmCreated) {\n@@ -220,34 +317,18 @@ public class RealmsConfigurationLoader {\nprivate static void createRealm(RealmRepresentation r) {\ntry {\n+ started = true;\nqueue.put(new CreateRealmJob(r));\n} catch (InterruptedException e) {\nthrow new RuntimeException(\"Interrupted\", e);\n}\n- // now wait for job to appear\n- PendingResult next = pendingResult.poll();\n- while (next == null) {\n- waitForAwhile();\n- next = pendingResult.poll();\n- }\n-\n- // then wait for the job to complete\n- while (!next.isDone()) {\n- waitForAwhile();\n- }\n-\n- try {\n- next.get();\n- } catch (InterruptedException e) {\n- throw new RuntimeException(\"Interrupted\", e);\n- } catch (ExecutionException e) {\n- throw new RuntimeException(\"Execution failed\", e.getCause());\n- }\n+ completePending();\n}\nprivate static void enqueueCreateUser(RealmRepresentation r, UserRepresentation u) {\ntry {\n+ started = true;\nqueue.put(new CreateUserJob(r, u));\n} catch (InterruptedException e) {\nthrow new RuntimeException(\"Interrupted\", e);\n@@ -256,6 +337,7 @@ public class RealmsConfigurationLoader {\nprivate static void enqueueCreateRealmRole(RealmRepresentation r, RoleRepresentation role) {\ntry {\n+ started = true;\nqueue.put(new CreateRealmRoleJob(r, role));\n} catch (InterruptedException e) {\nthrow new RuntimeException(\"Interrupted\", e);\n@@ -264,6 +346,7 @@ public class RealmsConfigurationLoader {\nprivate static void enqueueCreateClientRole(RealmRepresentation r, RoleRepresentation role, String client) {\ntry {\n+ started = true;\nqueue.put(new CreateClientRoleJob(r, role, client));\n} catch (InterruptedException e) {\nthrow new RuntimeException(\"Interrupted\", e);\n@@ -272,12 +355,31 @@ public class RealmsConfigurationLoader {\nprivate static void enqueueCreateClient(RealmRepresentation r, ClientRepresentation client) {\ntry {\n+ started = true;\nqueue.put(new CreateClientJob(r, client));\n} catch (InterruptedException e) {\nthrow new RuntimeException(\"Interrupted\", e);\n}\n}\n+ private static void enqueueFetchMissingClients(RealmRepresentation r) {\n+ try {\n+ started = true;\n+ queue.put(new FetchMissingClientsJob(r));\n+ } catch (InterruptedException e) {\n+ throw new RuntimeException(\"Interrupted\", e);\n+ }\n+ }\n+\n+ private static void enqueueFetchRealmRoles(RealmRepresentation r) {\n+ try {\n+ started = true;\n+ queue.put(new FetchRealmRolesJob(r));\n+ } catch (InterruptedException e) {\n+ throw new RuntimeException(\"Interrupted\", e);\n+ }\n+ }\n+\nprivate static void waitForAwhile() {\nwaitForAwhile(100, \"Interrupted\");\n}\n@@ -299,18 +401,22 @@ public class RealmsConfigurationLoader {\nif (t != JsonToken.START_ARRAY) {\nthrow new RuntimeException(\"Error reading field 'users'. Expected array of users [\" + t + \"]\");\n}\n- int count = 0;\n+\nt = p.nextToken();\nwhile (t == JsonToken.START_OBJECT) {\nUserRepresentation u = p.readValueAs(UserRepresentation.class);\n+ if (!started && userSkipped(u.getUsername())) {\n+ log.info(\"User skipped: \" + u.getUsername());\n+ } else {\nenqueueCreateUser(r, u);\n+ }\nt = p.nextToken();\n- count += 1;\n+ currentUser += 1;\n// every some users check to see pending errors\n// in order to short-circuit if any errors have occurred\n- if (count % ERROR_CHECK_INTERVAL == 0) {\n- checkPendingErrors();\n+ if (currentUser % ERROR_CHECK_INTERVAL == 0) {\n+ checkPendingErrors(u.getUsername());\n}\n}\n}\n@@ -367,14 +473,16 @@ public class RealmsConfigurationLoader {\nt = p.nextToken();\nwhile (t != JsonToken.END_ARRAY) {\nRoleRepresentation u = p.readValueAs(RoleRepresentation.class);\n+ if (!seeking() || !skipClientRoles) {\nenqueueCreateClientRole(r, u, client);\n+ }\nt = p.nextToken();\ncount += 1;\n// every some roles check to see pending errors\n// in order to short-circuit if any errors have occurred\nif (count % ERROR_CHECK_INTERVAL == 0) {\n- checkPendingErrors();\n+ checkPendingErrors(u.getName());\n}\n}\nt = p.nextToken();\n@@ -393,14 +501,16 @@ public class RealmsConfigurationLoader {\nint count = 0;\nwhile (t == JsonToken.START_OBJECT) {\nRoleRepresentation u = p.readValueAs(RoleRepresentation.class);\n+ if (!seeking() || !skipRealmRoles) {\nenqueueCreateRealmRole(r, u);\n+ }\nt = p.nextToken();\ncount += 1;\n// every some roles check to see pending errors\n// in order to short-circuit if any errors have occurred\nif (count % ERROR_CHECK_INTERVAL == 0) {\n- checkPendingErrors();\n+ checkPendingErrors(u.getName());\n}\n}\n}\n@@ -410,25 +520,25 @@ public class RealmsConfigurationLoader {\nif (t != JsonToken.START_ARRAY) {\nthrow new RuntimeException(\"Error reading field 'clients'. Expected array of clients [\" + t + \"]\");\n}\n- int count = 0;\n+\nt = p.nextToken();\nwhile (t == JsonToken.START_OBJECT) {\nClientRepresentation u = p.readValueAs(ClientRepresentation.class);\nenqueueCreateClient(r, u);\nt = p.nextToken();\n- count += 1;\n+ currentClient += 1;\n// every some users check to see pending errors\n- if (count % ERROR_CHECK_INTERVAL == 0) {\n- checkPendingErrors();\n+ if (currentClient % ERROR_CHECK_INTERVAL == 0) {\n+ checkPendingErrors(u.getClientId());\n}\n}\n}\n- private static void checkPendingErrors() {\n+ private static void checkPendingErrors(String label) {\n// now wait for job to appear\nPendingResult next = pendingResult.peek();\n- while (next == null) {\n+ while (next == null && queue.size() > 0) {\nwaitForAwhile();\nnext = pendingResult.peek();\n}\n@@ -445,7 +555,7 @@ public class RealmsConfigurationLoader {\n} catch (InterruptedException e) {\nthrow new RuntimeException(\"Interrupted\");\n} catch (ExecutionException e) {\n- throw new RuntimeException(\"Execution failed\", e.getCause());\n+ throw new RuntimeException(\"Execution failed in the vicinity of \" + label + \": \", e.getCause());\n}\n}\n}\n@@ -479,9 +589,15 @@ public class RealmsConfigurationLoader {\n}\nprivate static void consumeAttribute(JsonParser p) throws IOException {\n- JsonToken t = p.nextToken();\n+ JsonToken t = p.currentToken();\nif (t == JsonToken.START_OBJECT || t == JsonToken.START_ARRAY) {\np.skipChildren();\n+ p.nextToken();\n+ } else if (t == JsonToken.FIELD_NAME) {\n+ p.nextToken();\n+ consumeAttribute(p);\n+ } else {\n+ p.nextToken();\n}\n}\n@@ -528,6 +644,40 @@ public class RealmsConfigurationLoader {\n}\n}\n+ static class FetchMissingClientsJob extends AdminJob {\n+\n+ private RealmRepresentation realm;\n+\n+ FetchMissingClientsJob(RealmRepresentation r) {\n+ realm = r;\n+ }\n+\n+ @Override\n+ public void run() {\n+ List clients = admin().realms().realm(realm.getRealm()).clients().findAll();\n+ for (ClientRepresentation c: clients) {\n+ clientIdMap.put(c.getClientId(), c.getId());\n+ }\n+ }\n+ }\n+\n+ static class FetchRealmRolesJob extends AdminJob {\n+\n+ private RealmRepresentation realm;\n+\n+ FetchRealmRolesJob(RealmRepresentation r) {\n+ realm = r;\n+ }\n+\n+ @Override\n+ public void run() {\n+ List roles = admin().realms().realm(realm.getRealm()).roles().list();\n+ for (RoleRepresentation r: roles) {\n+ realmRoleIdMap.put(r.getName(), r.getId());\n+ }\n+ }\n+ }\n+\nstatic class CreateRealmJob extends AdminJob {\nprivate RealmRepresentation realm;\n@@ -538,7 +688,15 @@ public class RealmsConfigurationLoader {\n@Override\npublic void run() {\n+ try {\nadmin().realms().create(realm);\n+ } catch (ClientErrorException e) {\n+ if (e.getMessage().endsWith(\"409 Conflict\") && ignoreConflicts) {\n+ log.warn(\"Ignoring conflict when creating a realm: \" + realm.getRealm());\n+ return;\n+ }\n+ throw e;\n+ }\n}\n}\n@@ -556,11 +714,17 @@ public class RealmsConfigurationLoader {\npublic void run() {\nResponse response = admin().realms().realm(realm.getRealm()).users().create(user);\nresponse.close();\n- if (response.getStatus() != 201) {\n- throw new RuntimeException(\"Failed to create user with status: \" + response.getStatusInfo().getReasonPhrase());\n+\n+ if (response.getStatus() == 409 && ignoreConflicts) {\n+ log.warn(\"Ignoring conflict when creating a user: \" + user.getUsername());\n+ user.setId(admin().realms().realm(realm.getRealm()).users().search(user.getUsername()).get(0).getId());\n+ } else if (response.getStatus() == 201) {\n+ user.setId(extractIdFromResponse(response));\n+ } else {\n+ throw new RuntimeException(\"Failed to create user with status: \" + response.getStatusInfo());\n}\n- String userId = extractIdFromResponse(response);\n+ String userId = user.getId();\nList creds = user.getCredentials();\nfor (CredentialRepresentation cred: creds) {\n@@ -641,8 +805,16 @@ public class RealmsConfigurationLoader {\n@Override\npublic void run() {\n+ try {\nadmin().realms().realm(realm.getRealm()).roles().create(role);\n-\n+ } catch (ClientErrorException e) {\n+ if (e.getMessage().endsWith(\"409 Conflict\") && ignoreConflicts) {\n+ log.warn(\"Ignoring conflict when creating a realm role: \" + role.getName());\n+ role = admin().realms().realm(realm.getRealm()).roles().get(role.getName()).toRepresentation();\n+ } else {\n+ throw e;\n+ }\n+ }\n// we need the id but it's not returned by REST API - we have to perform a get on the created role and save the returned id\nRoleRepresentation rr = admin().realms().realm(realm.getRealm()).roles().get(role.getName()).toRepresentation();\nrealmRoleIdMap.put(rr.getName(), rr.getId());\n@@ -668,8 +840,19 @@ public class RealmsConfigurationLoader {\nif (id == null) {\nthrow new RuntimeException(\"No client created for clientId: \" + clientId);\n}\n+\n+ try {\nadmin().realms().realm(realm.getRealm()).clients().get(id).roles().create(role);\n+ } catch (ClientErrorException e) {\n+ if (e.getMessage().endsWith(\"409 Conflict\") && ignoreConflicts) {\n+ log.warn(\"Ignoring conflict when creating a client role: \" + role.getName());\n+ role = admin().realms().realm(realm.getRealm()).clients().get(id).roles().get(role.getName()).toRepresentation();\n+ } else {\n+ throw e;\n+ }\n+ }\n+\n// we need the id but it's not returned by REST API - we have to perform a get on the created role and save the returned id\nRoleRepresentation rr = admin().realms().realm(realm.getRealm()).clients().get(id).roles().get(role.getName()).toRepresentation();\n@@ -680,6 +863,7 @@ public class RealmsConfigurationLoader {\nroleIdMap.put(rr.getName(), rr.getId());\n}\n+\n}\nstatic class CreateClientJob extends AdminJob {\n@@ -697,11 +881,16 @@ public class RealmsConfigurationLoader {\npublic void run() {\nResponse response = admin().realms().realm(realm.getRealm()).clients().create(client);\nresponse.close();\n- if (response.getStatus() != 201) {\n+\n+ if (response.getStatus() == 409 && ignoreConflicts) {\n+ log.warn(\"Ignoring conflict when creating a client: \" + client.getClientId());\n+ client = admin().realms().realm(realm.getRealm()).clients().findByClientId(client.getClientId()).get(0);\n+ } else if (response.getStatus() == 201) {\n+ client.setId(extractIdFromResponse(response));\n+ } else {\nthrow new RuntimeException(\"Failed to create client with status: \" + response.getStatusInfo().getReasonPhrase());\n}\n- String id = extractIdFromResponse(response);\n- clientIdMap.put(client.getClientId(), id);\n+ clientIdMap.put(client.getClientId(), client.getId());\n}\n}\n"},{"change_type":"MODIFY","old_path":"testsuite/performance/tests/src/main/java/org/keycloak/performance/TestConfig.java","new_path":"testsuite/performance/tests/src/main/java/org/keycloak/performance/TestConfig.java","diff":"@@ -34,6 +34,11 @@ public class TestConfig {\n// Settings used by RealmsConfigurationLoader only - when loading data into Keycloak\n//\npublic static final int numOfWorkers = Integer.getInteger(\"numOfWorkers\", 1);\n+ public static final int startAtRealmIdx = Integer.getInteger(\"startAtRealmIdx\", 0);\n+ public static final int startAtUserIdx = 0; // doesn't work properly, will be removed later //Integer.getInteger(\"startAtUserIdx\", 0);\n+ public static final boolean ignoreConflicts = \"true\".equals(System.getProperty(\"ignoreConflicts\", \"false\"));\n+ public static final boolean skipRealmRoles = \"true\".equals(System.getProperty(\"skipRealmRoles\", \"false\"));\n+ public static final boolean skipClientRoles = \"true\".equals(System.getProperty(\"skipClientRoles\", \"false\"));\n//\n// Settings used by RealmConfigurationLoader to connect to Admin REST API\n"},{"change_type":"ADD","old_path":null,"new_path":"testsuite/performance/tests/src/main/resources/logback.xml","diff":"+\n+\n+\n+ \n+ true\n+ \n+\n+ \n+ \n+ %d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx\n+ \n+ false\n+ \n+\n+ \n+ \n+ \n+ \n+\n+ \n+ \n+ \n+\n+\n\\ No newline at end of file\n"}],"string":"[\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"testsuite/performance/README.datasets.md\",\n \"diff\": \"+# Keycloak Performance Testsuite - Generating datasets\\n+\\n+\\n+## Generating a set of datasets for multiple realms\\n+\\n+The first dataset is small and is created quickly. Building of each subsequent dataset continues on top\\n+of the previous dataset.\\n+\\n+Datasets are created with a specific released server version (rather than a snapshot) in order to be\\n+usable with later releases - newer server version should be able to migrate schema from any previous release.\\n+\\n+We use 10 concurrent threads, which is enough to saturate a\\n+dual core machine. For quad-core you can try to double the number of workers.\\n+\\n+```\\n+cd testsuite/performance\\n+\\n+mvn clean install -Dserver.version=4.0.0.Beta1\\n+\\n+mvn verify -Pteardown\\n+mvn verify -Pprovision\\n+mvn verify -Pgenerate-data -Ddataset=10r100u1c -DnumOfWorkers=10\\n+mvn verify -Pexport-dump -Ddataset=10r100u1c\\n+\\n+mvn verify -Pgenerate-data -Ddataset=20r100u1c -DstartAtRealmIdx=10 -DnumOfWorkers=10\\n+mvn verify -Pexport-dump -Ddataset=20r100u1c\\n+\\n+mvn verify -Pgenerate-data -Ddataset=50r100u1c -DstartAtRealmIdx=20 -DnumOfWorkers=10\\n+mvn verify -Pexport-dump -Ddataset=50r100u1c\\n+\\n+mvn verify -Pgenerate-data -Ddataset=200r100u1c -DstartAtRealmIdx=50 -DnumOfWorkers=10\\n+mvn verify -Pexport-dump -Ddataset=200r100u1c\\n+\\n+mvn verify -Pgenerate-data -Ddataset=500r100u1c -DstartAtRealmIdx=200 -DnumOfWorkers=10\\n+mvn verify -Pexport-dump -Ddataset=500r100u1c\\n+```\\n+\\n+If the dataset dump file is not available locally but it's known that the dataset for specific version exists on the server\\n+it can be retrieved by specifying a proper server version again. For example:\\n+```\\n+mvn verify -Pteardown\\n+mvn clean install\\n+mvn verify -Pprovision\\n+mvn verify -Pimport-dump -Ddataset=20r100u1c -Dserver.version=4.0.0.Beta1\\n+\\n+```\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"testsuite/performance/tests/docker-compose.sh\",\n \"new_path\": \"testsuite/performance/tests/docker-compose.sh\",\n \"diff\": \"@@ -399,7 +399,7 @@ case \\\"$OPERATION\\\" in\\nfi\\necho \\\"Importing $DATASET.sql.gz\\\"\\nset -o pipefail\\n- if ! zcat $DATASET.sql.gz | docker exec -i $DB_CONTAINER /usr/bin/mysql -u root --password=root keycloak ; then\\n+ if ! gunzip -c $DATASET.sql.gz | docker exec -i $DB_CONTAINER /usr/bin/mysql -u root --password=root keycloak ; then\\necho Import failed.\\nexit 1\\nfi\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"testsuite/performance/tests/parameters/datasets/10r100u1c.properties\",\n \"diff\": \"+numOfRealms=10\\n+usersPerRealm=100\\n+clientsPerRealm=1\\n+realmRoles=100\\n+realmRolesPerUser=50\\n+clientRolesPerUser=0\\n+clientRolesPerClient=0\\n+hashIterations=27500\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"testsuite/performance/tests/parameters/datasets/200r100u1c.properties\",\n \"diff\": \"+numOfRealms=200\\n+usersPerRealm=100\\n+clientsPerRealm=1\\n+realmRoles=100\\n+realmRolesPerUser=50\\n+clientRolesPerUser=0\\n+clientRolesPerClient=0\\n+hashIterations=27500\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"testsuite/performance/tests/parameters/datasets/20r100u1c.properties\",\n \"diff\": \"+numOfRealms=20\\n+usersPerRealm=100\\n+clientsPerRealm=1\\n+realmRoles=100\\n+realmRolesPerUser=50\\n+clientRolesPerUser=0\\n+clientRolesPerClient=0\\n+hashIterations=27500\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"testsuite/performance/tests/parameters/datasets/500r100u1c.properties\",\n \"diff\": \"+numOfRealms=500\\n+usersPerRealm=100\\n+clientsPerRealm=1\\n+realmRoles=100\\n+realmRolesPerUser=50\\n+clientRolesPerUser=0\\n+clientRolesPerClient=0\\n+hashIterations=27500\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"testsuite/performance/tests/parameters/datasets/50r100u1c.properties\",\n \"diff\": \"+numOfRealms=50\\n+usersPerRealm=100\\n+clientsPerRealm=1\\n+realmRoles=100\\n+realmRolesPerUser=50\\n+clientRolesPerUser=0\\n+clientRolesPerClient=0\\n+hashIterations=27500\\n\\\\ No newline at end of file\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"testsuite/performance/tests/pom.xml\",\n \"new_path\": \"testsuite/performance/tests/pom.xml\",\n \"diff\": \"read-project-properties\\n\\n\\n+ true\\n\\n${provisioning.properties.file}\\n${dataset.properties.file}\\n\\ngenerate-data\\n+ \\n+ 0\\n+ false\\n+ false\\n+ false\\n+ \\n\\n\\n\\n-DauthUser=${keycloak.admin.user}\\n-DauthPassword=${keycloak.admin.password}\\n-DnumOfWorkers=${numOfWorkers}\\n+ -DstartAtRealmIdx=${startAtRealmIdx}\\n+ -DignoreConflicts=${ignoreConflicts}\\n+ -DskipRealmRoles=${skipRealmRoles}\\n+ -DskipClientRoles=${skipClientRoles}\\norg.keycloak.performance.RealmsConfigurationLoader\\nbenchmark-realms.json\\n\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"testsuite/performance/tests/src/main/java/org/keycloak/performance/RealmsConfigurationLoader.java\",\n \"new_path\": \"testsuite/performance/tests/src/main/java/org/keycloak/performance/RealmsConfigurationLoader.java\",\n \"diff\": \"@@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.JsonFactory;\\nimport com.fasterxml.jackson.core.JsonParser;\\nimport com.fasterxml.jackson.core.JsonToken;\\nimport com.fasterxml.jackson.databind.ObjectMapper;\\n+import org.jboss.logging.Logger;\\nimport org.keycloak.admin.client.Keycloak;\\nimport org.keycloak.representations.idm.ClientRepresentation;\\nimport org.keycloak.representations.idm.CredentialRepresentation;\\n@@ -12,6 +13,7 @@ import org.keycloak.representations.idm.RealmRepresentation;\\nimport org.keycloak.representations.idm.RoleRepresentation;\\nimport org.keycloak.representations.idm.UserRepresentation;\\n+import javax.ws.rs.ClientErrorException;\\nimport javax.ws.rs.core.Response;\\nimport java.io.File;\\nimport java.io.IOException;\\n@@ -28,24 +30,37 @@ import java.util.concurrent.ExecutionException;\\nimport java.util.concurrent.LinkedBlockingQueue;\\nimport static org.keycloak.performance.RealmsConfigurationBuilder.EXPORT_FILENAME;\\n+import static org.keycloak.performance.TestConfig.ignoreConflicts;\\nimport static org.keycloak.performance.TestConfig.numOfWorkers;\\n+import static org.keycloak.performance.TestConfig.skipClientRoles;\\n+import static org.keycloak.performance.TestConfig.skipRealmRoles;\\n+import static org.keycloak.performance.TestConfig.startAtRealmIdx;\\n+import static org.keycloak.performance.TestConfig.startAtUserIdx;\\n/**\\n* # build\\n- * mvn -f testsuite/integration-arquillian/tests/performance/gatling-perf clean install\\n+ * mvn -f testsuite/performance/tests clean install\\n*\\n* # generate benchmark-realms.json file with generated test data\\n- * mvn -f testsuite/integration-arquillian/tests/performance/gatling-perf exec:java -Dexec.mainClass=org.keycloak.performance.RealmsConfigurationBuilder -DnumOfRealms=2 -DusersPerRealm=2 -DclientsPerRealm=2 -DrealmRoles=2 -DrealmRolesPerUser=2 -DclientRolesPerUser=2 -DclientRolesPerClient=2\\n+ * mvn -f testsuite/performance/tests exec:java -Dexec.mainClass=org.keycloak.performance.RealmsConfigurationBuilder -DnumOfRealms=2 -DusersPerRealm=2 -DclientsPerRealm=2 -DrealmRoles=2 -DrealmRolesPerUser=2 -DclientRolesPerUser=2 -DclientRolesPerClient=2\\n*\\n* # use benchmark-realms.json to load the data up to Keycloak Server listening on localhost:8080\\n- * mvn -f testsuite/integration-arquillian/tests/performance/gatling-perf exec:java -Dexec.mainClass=org.keycloak.performance.RealmsConfigurationLoader -DnumOfWorkers=5 -Dexec.args=benchmark-realms.json > perf-output.txt\\n+ * mvn -f testsuite/performance/tests exec:java -Dexec.mainClass=org.keycloak.performance.RealmsConfigurationLoader -DnumOfWorkers=5 -Dexec.args=benchmark-realms.json > perf-output.txt\\n*\\n* @author Marko Strukelj\\n*/\\npublic class RealmsConfigurationLoader {\\n+ static Logger log = Logger.getLogger(RealmsConfigurationLoader.class.getName());\\n+\\nstatic final int ERROR_CHECK_INTERVAL = 10;\\n+ static int currentRealm = 0;\\n+ static int currentUser = 0;\\n+ static int currentClient = 0;\\n+\\n+ static boolean started;\\n+\\n// multi-thread mechanics\\nstatic final BlockingQueue queue = new LinkedBlockingQueue<>(numOfWorkers);\\nstatic final ArrayList workers = new ArrayList<>();\\n@@ -58,24 +73,28 @@ public class RealmsConfigurationLoader {\\nstatic boolean realmCreated;\\npublic static void main(String [] args) throws IOException {\\n- System.out.println(\\\"Keycloak servers: \\\"+TestConfig.serverUrisList);\\n+ println(\\\"Keycloak servers: \\\"+TestConfig.serverUrisList);\\nif (args.length == 0) {\\nargs = new String[] {EXPORT_FILENAME};\\n}\\nif (args.length != 1) {\\n- System.out.println(\\\"Usage: java \\\" + RealmsConfigurationLoader.class.getName() + \\\" \\\");\\n+ println(\\\"Usage: java \\\" + RealmsConfigurationLoader.class.getName() + \\\" \\\");\\nreturn;\\n}\\nString file = args[0];\\n- System.out.println(\\\"Using file: \\\" + new File(args[0]).getAbsolutePath());\\n- System.out.println(\\\"Number of workers (numOfWorkers): \\\" + numOfWorkers);\\n+ println(\\\"Using file: \\\" + new File(args[0]).getAbsolutePath());\\n+ println(\\\"Number of workers (numOfWorkers): \\\" + numOfWorkers);\\n+ println(\\\"Parameters: \\\");\\n+ println(\\\" startAtRealmIdx: \\\" + startAtRealmIdx);\\n+// println(\\\" startAtUserIdx: \\\" + startAtUserIdx);\\nJsonParser p = initParser(file);\\ninitWorkers();\\n+ initProgress();\\ntry {\\n@@ -88,6 +107,28 @@ public class RealmsConfigurationLoader {\\n}\\n}\\n+ private static void initProgress() {\\n+ Thread t = new Thread(() -> {\\n+\\n+ for (;;) {\\n+ try {\\n+ Thread.sleep(60000);\\n+ println(\\\"At realm: \\\" + currentRealm + \\\", Clients: \\\" + currentClient + \\\", Users: \\\" + currentUser);\\n+ } catch (InterruptedException e) {\\n+ return;\\n+ }\\n+\\n+ }\\n+\\n+ },\\\"Progress Logger\\\");\\n+ t.setDaemon(true);\\n+ t.start();\\n+ }\\n+\\n+ private static void println(String s) {\\n+ System.out.println(s);\\n+ }\\n+\\nprivate static void completeWorkers() {\\ntry {\\n@@ -101,7 +142,7 @@ public class RealmsConfigurationLoader {\\ntry {\\nw.join(5000);\\nif (w.isAlive()) {\\n- System.out.println(\\\"Worker thread failed to stop: \\\");\\n+ println(\\\"Worker thread failed to stop: \\\");\\ndumpThread(w);\\n}\\n} catch (InterruptedException e) {\\n@@ -117,6 +158,7 @@ public class RealmsConfigurationLoader {\\nwhile (t != JsonToken.END_OBJECT && t != JsonToken.END_ARRAY) {\\nif (t != JsonToken.START_ARRAY) {\\nreadRealm(p);\\n+ currentRealm += 1;\\n}\\nt = p.nextToken();\\n}\\n@@ -150,7 +192,7 @@ public class RealmsConfigurationLoader {\\nfor (StackTraceElement e: w.getStackTrace()) {\\nb.append(e.toString()).append(\\\"\\\\n\\\");\\n}\\n- System.out.print(b);\\n+ println(b.toString());\\n}\\nprivate static void readRealm(JsonParser p) throws IOException {\\n@@ -158,15 +200,22 @@ public class RealmsConfigurationLoader {\\n// as soon as we encounter users, roles, clients we create a CreateRealmJob\\n// TODO: if after that point in a realm we encounter realm attribute, we report a warning but continue\\n+ boolean skip = false;\\n+ try {\\nRealmRepresentation r = new RealmRepresentation();\\nJsonToken t = p.nextToken();\\n- while (t != JsonToken.END_OBJECT) {\\n+ outer:\\n+ while (t != JsonToken.END_OBJECT && !skip) {\\n//System.out.println(t + \\\", name: \\\" + p.getCurrentName() + \\\", text: '\\\" + p.getText() + \\\"', value: \\\" + p.getValueAsString());\\nswitch (p.getCurrentName()) {\\ncase \\\"realm\\\":\\nr.setRealm(getStringValue(p));\\n+ skip = !started && realmSkipped(r.getRealm()) ;\\n+ if (skip) {\\n+ break outer;\\n+ }\\nbreak;\\ncase \\\"enabled\\\":\\nr.setEnabled(getBooleanValue(p));\\n@@ -180,8 +229,15 @@ public class RealmsConfigurationLoader {\\ncase \\\"passwordPolicy\\\":\\nr.setPasswordPolicy(getStringValue(p));\\nbreak;\\n+ case \\\"sslRequired\\\":\\n+ r.setSslRequired(getStringValue(p));\\n+ break;\\ncase \\\"users\\\":\\nensureRealm(r);\\n+ if (seekToStart()) {\\n+ enqueueFetchRealmRoles(r);\\n+ completePending();\\n+ }\\nreadUsers(r, p);\\nbreak;\\ncase \\\"roles\\\":\\n@@ -191,16 +247,29 @@ public class RealmsConfigurationLoader {\\ncase \\\"clients\\\":\\nensureRealm(r);\\nreadClients(r, p);\\n+ completePending();\\n+ if (seekToStart()) {\\n+ enqueueFetchMissingClients(r);\\n+ completePending();\\n+ }\\nbreak;\\ndefault: {\\n// if we don't understand the field we ignore it - but report that\\n- System.out.println(\\\"Realm attribute ignored: \\\" + p.getCurrentName());\\n+ log.warn(\\\"Realm attribute ignored: \\\" + p.getCurrentName());\\nconsumeAttribute(p);\\n+ continue; // skip p.nextToken() at end of loop - consumeAttribute() already did it\\n}\\n}\\n+\\nt = p.nextToken();\\n}\\n+ if (skip) {\\n+ log.info(\\\"Realm skipped: \\\" + r.getRealm());\\n+ consumeParent(p);\\n+ }\\n+\\n+ } finally {\\n// we wait for realm to complete\\ncompletePending();\\n@@ -210,6 +279,34 @@ public class RealmsConfigurationLoader {\\nrealmRoleIdMap.clear();\\nclientRoleIdMap.clear();\\n}\\n+ }\\n+\\n+ private static void consumeParent(JsonParser p) throws IOException {\\n+ while (p.currentToken() != JsonToken.END_OBJECT) {\\n+ consumeAttribute(p);\\n+ }\\n+ }\\n+\\n+ private static boolean seekToStart() {\\n+ return startAtRealmIdx > 0 || startAtUserIdx > 0;\\n+ }\\n+\\n+ private static boolean seeking() {\\n+ return currentRealm < startAtRealmIdx || currentUser < startAtUserIdx;\\n+ }\\n+\\n+ private static boolean realmSkipped(String realm) {\\n+ int pos = realm.lastIndexOf(\\\"_\\\");\\n+ int idx = Integer.parseInt(realm.substring(pos+1));\\n+ return idx < startAtRealmIdx;\\n+ }\\n+\\n+ private static boolean userSkipped(String username) {\\n+ int pos = username.indexOf(\\\"_\\\");\\n+ int end = username.indexOf(\\\"_\\\", pos+1);\\n+ int idx = Integer.parseInt(username.substring(pos+1, end));\\n+ return idx < startAtUserIdx;\\n+ }\\nprivate static void ensureRealm(RealmRepresentation r) {\\nif (!realmCreated) {\\n@@ -220,34 +317,18 @@ public class RealmsConfigurationLoader {\\nprivate static void createRealm(RealmRepresentation r) {\\ntry {\\n+ started = true;\\nqueue.put(new CreateRealmJob(r));\\n} catch (InterruptedException e) {\\nthrow new RuntimeException(\\\"Interrupted\\\", e);\\n}\\n- // now wait for job to appear\\n- PendingResult next = pendingResult.poll();\\n- while (next == null) {\\n- waitForAwhile();\\n- next = pendingResult.poll();\\n- }\\n-\\n- // then wait for the job to complete\\n- while (!next.isDone()) {\\n- waitForAwhile();\\n- }\\n-\\n- try {\\n- next.get();\\n- } catch (InterruptedException e) {\\n- throw new RuntimeException(\\\"Interrupted\\\", e);\\n- } catch (ExecutionException e) {\\n- throw new RuntimeException(\\\"Execution failed\\\", e.getCause());\\n- }\\n+ completePending();\\n}\\nprivate static void enqueueCreateUser(RealmRepresentation r, UserRepresentation u) {\\ntry {\\n+ started = true;\\nqueue.put(new CreateUserJob(r, u));\\n} catch (InterruptedException e) {\\nthrow new RuntimeException(\\\"Interrupted\\\", e);\\n@@ -256,6 +337,7 @@ public class RealmsConfigurationLoader {\\nprivate static void enqueueCreateRealmRole(RealmRepresentation r, RoleRepresentation role) {\\ntry {\\n+ started = true;\\nqueue.put(new CreateRealmRoleJob(r, role));\\n} catch (InterruptedException e) {\\nthrow new RuntimeException(\\\"Interrupted\\\", e);\\n@@ -264,6 +346,7 @@ public class RealmsConfigurationLoader {\\nprivate static void enqueueCreateClientRole(RealmRepresentation r, RoleRepresentation role, String client) {\\ntry {\\n+ started = true;\\nqueue.put(new CreateClientRoleJob(r, role, client));\\n} catch (InterruptedException e) {\\nthrow new RuntimeException(\\\"Interrupted\\\", e);\\n@@ -272,12 +355,31 @@ public class RealmsConfigurationLoader {\\nprivate static void enqueueCreateClient(RealmRepresentation r, ClientRepresentation client) {\\ntry {\\n+ started = true;\\nqueue.put(new CreateClientJob(r, client));\\n} catch (InterruptedException e) {\\nthrow new RuntimeException(\\\"Interrupted\\\", e);\\n}\\n}\\n+ private static void enqueueFetchMissingClients(RealmRepresentation r) {\\n+ try {\\n+ started = true;\\n+ queue.put(new FetchMissingClientsJob(r));\\n+ } catch (InterruptedException e) {\\n+ throw new RuntimeException(\\\"Interrupted\\\", e);\\n+ }\\n+ }\\n+\\n+ private static void enqueueFetchRealmRoles(RealmRepresentation r) {\\n+ try {\\n+ started = true;\\n+ queue.put(new FetchRealmRolesJob(r));\\n+ } catch (InterruptedException e) {\\n+ throw new RuntimeException(\\\"Interrupted\\\", e);\\n+ }\\n+ }\\n+\\nprivate static void waitForAwhile() {\\nwaitForAwhile(100, \\\"Interrupted\\\");\\n}\\n@@ -299,18 +401,22 @@ public class RealmsConfigurationLoader {\\nif (t != JsonToken.START_ARRAY) {\\nthrow new RuntimeException(\\\"Error reading field 'users'. Expected array of users [\\\" + t + \\\"]\\\");\\n}\\n- int count = 0;\\n+\\nt = p.nextToken();\\nwhile (t == JsonToken.START_OBJECT) {\\nUserRepresentation u = p.readValueAs(UserRepresentation.class);\\n+ if (!started && userSkipped(u.getUsername())) {\\n+ log.info(\\\"User skipped: \\\" + u.getUsername());\\n+ } else {\\nenqueueCreateUser(r, u);\\n+ }\\nt = p.nextToken();\\n- count += 1;\\n+ currentUser += 1;\\n// every some users check to see pending errors\\n// in order to short-circuit if any errors have occurred\\n- if (count % ERROR_CHECK_INTERVAL == 0) {\\n- checkPendingErrors();\\n+ if (currentUser % ERROR_CHECK_INTERVAL == 0) {\\n+ checkPendingErrors(u.getUsername());\\n}\\n}\\n}\\n@@ -367,14 +473,16 @@ public class RealmsConfigurationLoader {\\nt = p.nextToken();\\nwhile (t != JsonToken.END_ARRAY) {\\nRoleRepresentation u = p.readValueAs(RoleRepresentation.class);\\n+ if (!seeking() || !skipClientRoles) {\\nenqueueCreateClientRole(r, u, client);\\n+ }\\nt = p.nextToken();\\ncount += 1;\\n// every some roles check to see pending errors\\n// in order to short-circuit if any errors have occurred\\nif (count % ERROR_CHECK_INTERVAL == 0) {\\n- checkPendingErrors();\\n+ checkPendingErrors(u.getName());\\n}\\n}\\nt = p.nextToken();\\n@@ -393,14 +501,16 @@ public class RealmsConfigurationLoader {\\nint count = 0;\\nwhile (t == JsonToken.START_OBJECT) {\\nRoleRepresentation u = p.readValueAs(RoleRepresentation.class);\\n+ if (!seeking() || !skipRealmRoles) {\\nenqueueCreateRealmRole(r, u);\\n+ }\\nt = p.nextToken();\\ncount += 1;\\n// every some roles check to see pending errors\\n// in order to short-circuit if any errors have occurred\\nif (count % ERROR_CHECK_INTERVAL == 0) {\\n- checkPendingErrors();\\n+ checkPendingErrors(u.getName());\\n}\\n}\\n}\\n@@ -410,25 +520,25 @@ public class RealmsConfigurationLoader {\\nif (t != JsonToken.START_ARRAY) {\\nthrow new RuntimeException(\\\"Error reading field 'clients'. Expected array of clients [\\\" + t + \\\"]\\\");\\n}\\n- int count = 0;\\n+\\nt = p.nextToken();\\nwhile (t == JsonToken.START_OBJECT) {\\nClientRepresentation u = p.readValueAs(ClientRepresentation.class);\\nenqueueCreateClient(r, u);\\nt = p.nextToken();\\n- count += 1;\\n+ currentClient += 1;\\n// every some users check to see pending errors\\n- if (count % ERROR_CHECK_INTERVAL == 0) {\\n- checkPendingErrors();\\n+ if (currentClient % ERROR_CHECK_INTERVAL == 0) {\\n+ checkPendingErrors(u.getClientId());\\n}\\n}\\n}\\n- private static void checkPendingErrors() {\\n+ private static void checkPendingErrors(String label) {\\n// now wait for job to appear\\nPendingResult next = pendingResult.peek();\\n- while (next == null) {\\n+ while (next == null && queue.size() > 0) {\\nwaitForAwhile();\\nnext = pendingResult.peek();\\n}\\n@@ -445,7 +555,7 @@ public class RealmsConfigurationLoader {\\n} catch (InterruptedException e) {\\nthrow new RuntimeException(\\\"Interrupted\\\");\\n} catch (ExecutionException e) {\\n- throw new RuntimeException(\\\"Execution failed\\\", e.getCause());\\n+ throw new RuntimeException(\\\"Execution failed in the vicinity of \\\" + label + \\\": \\\", e.getCause());\\n}\\n}\\n}\\n@@ -479,9 +589,15 @@ public class RealmsConfigurationLoader {\\n}\\nprivate static void consumeAttribute(JsonParser p) throws IOException {\\n- JsonToken t = p.nextToken();\\n+ JsonToken t = p.currentToken();\\nif (t == JsonToken.START_OBJECT || t == JsonToken.START_ARRAY) {\\np.skipChildren();\\n+ p.nextToken();\\n+ } else if (t == JsonToken.FIELD_NAME) {\\n+ p.nextToken();\\n+ consumeAttribute(p);\\n+ } else {\\n+ p.nextToken();\\n}\\n}\\n@@ -528,6 +644,40 @@ public class RealmsConfigurationLoader {\\n}\\n}\\n+ static class FetchMissingClientsJob extends AdminJob {\\n+\\n+ private RealmRepresentation realm;\\n+\\n+ FetchMissingClientsJob(RealmRepresentation r) {\\n+ realm = r;\\n+ }\\n+\\n+ @Override\\n+ public void run() {\\n+ List clients = admin().realms().realm(realm.getRealm()).clients().findAll();\\n+ for (ClientRepresentation c: clients) {\\n+ clientIdMap.put(c.getClientId(), c.getId());\\n+ }\\n+ }\\n+ }\\n+\\n+ static class FetchRealmRolesJob extends AdminJob {\\n+\\n+ private RealmRepresentation realm;\\n+\\n+ FetchRealmRolesJob(RealmRepresentation r) {\\n+ realm = r;\\n+ }\\n+\\n+ @Override\\n+ public void run() {\\n+ List roles = admin().realms().realm(realm.getRealm()).roles().list();\\n+ for (RoleRepresentation r: roles) {\\n+ realmRoleIdMap.put(r.getName(), r.getId());\\n+ }\\n+ }\\n+ }\\n+\\nstatic class CreateRealmJob extends AdminJob {\\nprivate RealmRepresentation realm;\\n@@ -538,7 +688,15 @@ public class RealmsConfigurationLoader {\\n@Override\\npublic void run() {\\n+ try {\\nadmin().realms().create(realm);\\n+ } catch (ClientErrorException e) {\\n+ if (e.getMessage().endsWith(\\\"409 Conflict\\\") && ignoreConflicts) {\\n+ log.warn(\\\"Ignoring conflict when creating a realm: \\\" + realm.getRealm());\\n+ return;\\n+ }\\n+ throw e;\\n+ }\\n}\\n}\\n@@ -556,11 +714,17 @@ public class RealmsConfigurationLoader {\\npublic void run() {\\nResponse response = admin().realms().realm(realm.getRealm()).users().create(user);\\nresponse.close();\\n- if (response.getStatus() != 201) {\\n- throw new RuntimeException(\\\"Failed to create user with status: \\\" + response.getStatusInfo().getReasonPhrase());\\n+\\n+ if (response.getStatus() == 409 && ignoreConflicts) {\\n+ log.warn(\\\"Ignoring conflict when creating a user: \\\" + user.getUsername());\\n+ user.setId(admin().realms().realm(realm.getRealm()).users().search(user.getUsername()).get(0).getId());\\n+ } else if (response.getStatus() == 201) {\\n+ user.setId(extractIdFromResponse(response));\\n+ } else {\\n+ throw new RuntimeException(\\\"Failed to create user with status: \\\" + response.getStatusInfo());\\n}\\n- String userId = extractIdFromResponse(response);\\n+ String userId = user.getId();\\nList creds = user.getCredentials();\\nfor (CredentialRepresentation cred: creds) {\\n@@ -641,8 +805,16 @@ public class RealmsConfigurationLoader {\\n@Override\\npublic void run() {\\n+ try {\\nadmin().realms().realm(realm.getRealm()).roles().create(role);\\n-\\n+ } catch (ClientErrorException e) {\\n+ if (e.getMessage().endsWith(\\\"409 Conflict\\\") && ignoreConflicts) {\\n+ log.warn(\\\"Ignoring conflict when creating a realm role: \\\" + role.getName());\\n+ role = admin().realms().realm(realm.getRealm()).roles().get(role.getName()).toRepresentation();\\n+ } else {\\n+ throw e;\\n+ }\\n+ }\\n// we need the id but it's not returned by REST API - we have to perform a get on the created role and save the returned id\\nRoleRepresentation rr = admin().realms().realm(realm.getRealm()).roles().get(role.getName()).toRepresentation();\\nrealmRoleIdMap.put(rr.getName(), rr.getId());\\n@@ -668,8 +840,19 @@ public class RealmsConfigurationLoader {\\nif (id == null) {\\nthrow new RuntimeException(\\\"No client created for clientId: \\\" + clientId);\\n}\\n+\\n+ try {\\nadmin().realms().realm(realm.getRealm()).clients().get(id).roles().create(role);\\n+ } catch (ClientErrorException e) {\\n+ if (e.getMessage().endsWith(\\\"409 Conflict\\\") && ignoreConflicts) {\\n+ log.warn(\\\"Ignoring conflict when creating a client role: \\\" + role.getName());\\n+ role = admin().realms().realm(realm.getRealm()).clients().get(id).roles().get(role.getName()).toRepresentation();\\n+ } else {\\n+ throw e;\\n+ }\\n+ }\\n+\\n// we need the id but it's not returned by REST API - we have to perform a get on the created role and save the returned id\\nRoleRepresentation rr = admin().realms().realm(realm.getRealm()).clients().get(id).roles().get(role.getName()).toRepresentation();\\n@@ -680,6 +863,7 @@ public class RealmsConfigurationLoader {\\nroleIdMap.put(rr.getName(), rr.getId());\\n}\\n+\\n}\\nstatic class CreateClientJob extends AdminJob {\\n@@ -697,11 +881,16 @@ public class RealmsConfigurationLoader {\\npublic void run() {\\nResponse response = admin().realms().realm(realm.getRealm()).clients().create(client);\\nresponse.close();\\n- if (response.getStatus() != 201) {\\n+\\n+ if (response.getStatus() == 409 && ignoreConflicts) {\\n+ log.warn(\\\"Ignoring conflict when creating a client: \\\" + client.getClientId());\\n+ client = admin().realms().realm(realm.getRealm()).clients().findByClientId(client.getClientId()).get(0);\\n+ } else if (response.getStatus() == 201) {\\n+ client.setId(extractIdFromResponse(response));\\n+ } else {\\nthrow new RuntimeException(\\\"Failed to create client with status: \\\" + response.getStatusInfo().getReasonPhrase());\\n}\\n- String id = extractIdFromResponse(response);\\n- clientIdMap.put(client.getClientId(), id);\\n+ clientIdMap.put(client.getClientId(), client.getId());\\n}\\n}\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"testsuite/performance/tests/src/main/java/org/keycloak/performance/TestConfig.java\",\n \"new_path\": \"testsuite/performance/tests/src/main/java/org/keycloak/performance/TestConfig.java\",\n \"diff\": \"@@ -34,6 +34,11 @@ public class TestConfig {\\n// Settings used by RealmsConfigurationLoader only - when loading data into Keycloak\\n//\\npublic static final int numOfWorkers = Integer.getInteger(\\\"numOfWorkers\\\", 1);\\n+ public static final int startAtRealmIdx = Integer.getInteger(\\\"startAtRealmIdx\\\", 0);\\n+ public static final int startAtUserIdx = 0; // doesn't work properly, will be removed later //Integer.getInteger(\\\"startAtUserIdx\\\", 0);\\n+ public static final boolean ignoreConflicts = \\\"true\\\".equals(System.getProperty(\\\"ignoreConflicts\\\", \\\"false\\\"));\\n+ public static final boolean skipRealmRoles = \\\"true\\\".equals(System.getProperty(\\\"skipRealmRoles\\\", \\\"false\\\"));\\n+ public static final boolean skipClientRoles = \\\"true\\\".equals(System.getProperty(\\\"skipClientRoles\\\", \\\"false\\\"));\\n//\\n// Settings used by RealmConfigurationLoader to connect to Admin REST API\\n\"\n },\n {\n \"change_type\": \"ADD\",\n \"old_path\": null,\n \"new_path\": \"testsuite/performance/tests/src/main/resources/logback.xml\",\n \"diff\": \"+\\n+\\n+\\n+ \\n+ true\\n+ \\n+\\n+ \\n+ \\n+ %d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx\\n+ \\n+ false\\n+ \\n+\\n+ \\n+ \\n+ \\n+ \\n+\\n+ \\n+ \\n+ \\n+\\n+\\n\\\\ No newline at end of file\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-6759 Create the databases for import during perf tests"}}},{"rowIdx":2940,"cells":{"author":{"kind":"number","value":339511,"string":"339,511"},"date":{"kind":"string","value":"28.05.2018 14:13:54"},"timezone":{"kind":"number","value":-32400,"string":"-32,400"},"hash":{"kind":"string","value":"eb9715147684e6890ccb7201ded09bf453712dbc"},"message":{"kind":"string","value":"OAuth Authorization Server Metadata for Proof Key for Code Exchange"},"mods":{"kind":"list like","value":[{"change_type":"MODIFY","old_path":"services/src/main/java/org/keycloak/protocol/oidc/OIDCWellKnownProvider.java","new_path":"services/src/main/java/org/keycloak/protocol/oidc/OIDCWellKnownProvider.java","diff":"@@ -69,6 +69,9 @@ public class OIDCWellKnownProvider implements WellKnownProvider {\n// TODO: Add more of OIDC scopes\npublic static final List SCOPES_SUPPORTED= list(OAuth2Constants.SCOPE_OPENID, OAuth2Constants.OFFLINE_ACCESS);\n+ // KEYCLOAK-7451 OAuth Authorization Server Metadata for Proof Key for Code Exchange\n+ public static final List DEFAULT_CODE_CHALLENGE_METHODS_SUPPORTED = list(OAuth2Constants.PKCE_METHOD_PLAIN, OAuth2Constants.PKCE_METHOD_S256);\n+\nprivate KeycloakSession session;\npublic OIDCWellKnownProvider(KeycloakSession session) {\n@@ -113,6 +116,9 @@ public class OIDCWellKnownProvider implements WellKnownProvider {\nconfig.setRequestParameterSupported(true);\nconfig.setRequestUriParameterSupported(true);\n+ // KEYCLOAK-7451 OAuth Authorization Server Metadata for Proof Key for Code Exchange\n+ config.setCodeChallengeMethodsSupported(DEFAULT_CODE_CHALLENGE_METHODS_SUPPORTED);\n+\nreturn config;\n}\n"},{"change_type":"MODIFY","old_path":"services/src/main/java/org/keycloak/protocol/oidc/representations/OIDCConfigurationRepresentation.java","new_path":"services/src/main/java/org/keycloak/protocol/oidc/representations/OIDCConfigurationRepresentation.java","diff":"@@ -103,6 +103,10 @@ public class OIDCConfigurationRepresentation {\n@JsonProperty(\"request_uri_parameter_supported\")\nprivate Boolean requestUriParameterSupported;\n+ // KEYCLOAK-7451 OAuth Authorization Server Metadata for Proof Key for Code Exchange\n+ @JsonProperty(\"code_challenge_methods_supported\")\n+ private List codeChallengeMethodsSupported;\n+\nprotected Map otherClaims = new HashMap();\npublic String getIssuer() {\n@@ -297,6 +301,14 @@ public class OIDCConfigurationRepresentation {\nthis.requestUriParameterSupported = requestUriParameterSupported;\n}\n+ // KEYCLOAK-7451 OAuth Authorization Server Metadata for Proof Key for Code Exchange\n+ public List getCodeChallengeMethodsSupported() {\n+ return codeChallengeMethodsSupported;\n+ }\n+ public void setCodeChallengeMethodsSupported(List codeChallengeMethodsSupported) {\n+ this.codeChallengeMethodsSupported = codeChallengeMethodsSupported;\n+ }\n+\n@JsonAnyGetter\npublic Map getOtherClaims() {\nreturn otherClaims;\n"},{"change_type":"MODIFY","old_path":"testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/oidc/OIDCWellKnownProviderTest.java","new_path":"testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/oidc/OIDCWellKnownProviderTest.java","diff":"@@ -119,6 +119,10 @@ public class OIDCWellKnownProviderTest extends AbstractKeycloakTest {\n// Request and Request_Uri\nAssert.assertTrue(oidcConfig.getRequestParameterSupported());\nAssert.assertTrue(oidcConfig.getRequestUriParameterSupported());\n+\n+ // KEYCLOAK-7451 OAuth Authorization Server Metadata for Proof Key for Code Exchange\n+ // PKCE support\n+ Assert.assertNames(oidcConfig.getCodeChallengeMethodsSupported(), OAuth2Constants.PKCE_METHOD_PLAIN, OAuth2Constants.PKCE_METHOD_S256);\n} finally {\nclient.close();\n}\n"}],"string":"[\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"services/src/main/java/org/keycloak/protocol/oidc/OIDCWellKnownProvider.java\",\n \"new_path\": \"services/src/main/java/org/keycloak/protocol/oidc/OIDCWellKnownProvider.java\",\n \"diff\": \"@@ -69,6 +69,9 @@ public class OIDCWellKnownProvider implements WellKnownProvider {\\n// TODO: Add more of OIDC scopes\\npublic static final List SCOPES_SUPPORTED= list(OAuth2Constants.SCOPE_OPENID, OAuth2Constants.OFFLINE_ACCESS);\\n+ // KEYCLOAK-7451 OAuth Authorization Server Metadata for Proof Key for Code Exchange\\n+ public static final List DEFAULT_CODE_CHALLENGE_METHODS_SUPPORTED = list(OAuth2Constants.PKCE_METHOD_PLAIN, OAuth2Constants.PKCE_METHOD_S256);\\n+\\nprivate KeycloakSession session;\\npublic OIDCWellKnownProvider(KeycloakSession session) {\\n@@ -113,6 +116,9 @@ public class OIDCWellKnownProvider implements WellKnownProvider {\\nconfig.setRequestParameterSupported(true);\\nconfig.setRequestUriParameterSupported(true);\\n+ // KEYCLOAK-7451 OAuth Authorization Server Metadata for Proof Key for Code Exchange\\n+ config.setCodeChallengeMethodsSupported(DEFAULT_CODE_CHALLENGE_METHODS_SUPPORTED);\\n+\\nreturn config;\\n}\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"services/src/main/java/org/keycloak/protocol/oidc/representations/OIDCConfigurationRepresentation.java\",\n \"new_path\": \"services/src/main/java/org/keycloak/protocol/oidc/representations/OIDCConfigurationRepresentation.java\",\n \"diff\": \"@@ -103,6 +103,10 @@ public class OIDCConfigurationRepresentation {\\n@JsonProperty(\\\"request_uri_parameter_supported\\\")\\nprivate Boolean requestUriParameterSupported;\\n+ // KEYCLOAK-7451 OAuth Authorization Server Metadata for Proof Key for Code Exchange\\n+ @JsonProperty(\\\"code_challenge_methods_supported\\\")\\n+ private List codeChallengeMethodsSupported;\\n+\\nprotected Map otherClaims = new HashMap();\\npublic String getIssuer() {\\n@@ -297,6 +301,14 @@ public class OIDCConfigurationRepresentation {\\nthis.requestUriParameterSupported = requestUriParameterSupported;\\n}\\n+ // KEYCLOAK-7451 OAuth Authorization Server Metadata for Proof Key for Code Exchange\\n+ public List getCodeChallengeMethodsSupported() {\\n+ return codeChallengeMethodsSupported;\\n+ }\\n+ public void setCodeChallengeMethodsSupported(List codeChallengeMethodsSupported) {\\n+ this.codeChallengeMethodsSupported = codeChallengeMethodsSupported;\\n+ }\\n+\\n@JsonAnyGetter\\npublic Map getOtherClaims() {\\nreturn otherClaims;\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/oidc/OIDCWellKnownProviderTest.java\",\n \"new_path\": \"testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/oidc/OIDCWellKnownProviderTest.java\",\n \"diff\": \"@@ -119,6 +119,10 @@ public class OIDCWellKnownProviderTest extends AbstractKeycloakTest {\\n// Request and Request_Uri\\nAssert.assertTrue(oidcConfig.getRequestParameterSupported());\\nAssert.assertTrue(oidcConfig.getRequestUriParameterSupported());\\n+\\n+ // KEYCLOAK-7451 OAuth Authorization Server Metadata for Proof Key for Code Exchange\\n+ // PKCE support\\n+ Assert.assertNames(oidcConfig.getCodeChallengeMethodsSupported(), OAuth2Constants.PKCE_METHOD_PLAIN, OAuth2Constants.PKCE_METHOD_S256);\\n} finally {\\nclient.close();\\n}\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"KEYCLOAK-7451 OAuth Authorization Server Metadata for Proof Key for Code Exchange"}}},{"rowIdx":2941,"cells":{"author":{"kind":"number","value":339362,"string":"339,362"},"date":{"kind":"string","value":"18.05.2018 13:51:22"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"16fd6558a603bbc64367553aa1d5a34a9f984936"},"message":{"kind":"string","value":"Enable adding of default groups"},"mods":{"kind":"list like","value":[{"change_type":"MODIFY","old_path":"federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java","new_path":"federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java","diff":"@@ -38,20 +38,11 @@ import org.keycloak.credential.CredentialInputValidator;\nimport org.keycloak.credential.CredentialModel;\nimport org.keycloak.federation.kerberos.impl.KerberosUsernamePasswordAuthenticator;\nimport org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator;\n-import org.keycloak.models.CredentialValidationOutput;\n-import org.keycloak.models.GroupModel;\n-import org.keycloak.models.KeycloakSession;\n-import org.keycloak.models.LDAPConstants;\n-import org.keycloak.models.ModelDuplicateException;\n-import org.keycloak.models.ModelException;\n+import org.keycloak.models.*;\n+import org.keycloak.models.utils.DefaultRoles;\nimport org.keycloak.models.utils.ReadOnlyUserModelDelegate;\nimport org.keycloak.policy.PasswordPolicyManagerProvider;\nimport org.keycloak.policy.PolicyError;\n-import org.keycloak.models.RealmModel;\n-import org.keycloak.models.RoleModel;\n-import org.keycloak.models.UserCredentialModel;\n-import org.keycloak.models.UserManager;\n-import org.keycloak.models.UserModel;\nimport org.keycloak.models.cache.UserCache;\nimport org.keycloak.models.credential.PasswordUserCredentialModel;\nimport org.keycloak.models.utils.KeycloakModelUtils;\n@@ -269,7 +260,20 @@ public class LDAPStorageProvider implements UserStorageProvider,\nuser.setSingleAttribute(LDAPConstants.LDAP_ID, ldapUser.getUuid());\nuser.setSingleAttribute(LDAPConstants.LDAP_ENTRY_DN, ldapUser.getDn().toString());\n- return proxy(realm, user, ldapUser);\n+ // Add the user to the default groups and add default required actions\n+ UserModel proxy = proxy(realm, user, ldapUser);\n+ DefaultRoles.addDefaultRoles(realm, user);\n+\n+ for (GroupModel g : realm.getDefaultGroups()) {\n+ proxy.joinGroup(g);\n+ }\n+ for (RequiredActionProviderModel r : realm.getRequiredActionProviders()) {\n+ if (r.isEnabled() && r.isDefaultAction()) {\n+ user.addRequiredAction(r.getAlias());\n+ }\n+ }\n+\n+ return proxy;\n}\n@Override\n"}],"string":"[\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java\",\n \"new_path\": \"federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java\",\n \"diff\": \"@@ -38,20 +38,11 @@ import org.keycloak.credential.CredentialInputValidator;\\nimport org.keycloak.credential.CredentialModel;\\nimport org.keycloak.federation.kerberos.impl.KerberosUsernamePasswordAuthenticator;\\nimport org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator;\\n-import org.keycloak.models.CredentialValidationOutput;\\n-import org.keycloak.models.GroupModel;\\n-import org.keycloak.models.KeycloakSession;\\n-import org.keycloak.models.LDAPConstants;\\n-import org.keycloak.models.ModelDuplicateException;\\n-import org.keycloak.models.ModelException;\\n+import org.keycloak.models.*;\\n+import org.keycloak.models.utils.DefaultRoles;\\nimport org.keycloak.models.utils.ReadOnlyUserModelDelegate;\\nimport org.keycloak.policy.PasswordPolicyManagerProvider;\\nimport org.keycloak.policy.PolicyError;\\n-import org.keycloak.models.RealmModel;\\n-import org.keycloak.models.RoleModel;\\n-import org.keycloak.models.UserCredentialModel;\\n-import org.keycloak.models.UserManager;\\n-import org.keycloak.models.UserModel;\\nimport org.keycloak.models.cache.UserCache;\\nimport org.keycloak.models.credential.PasswordUserCredentialModel;\\nimport org.keycloak.models.utils.KeycloakModelUtils;\\n@@ -269,7 +260,20 @@ public class LDAPStorageProvider implements UserStorageProvider,\\nuser.setSingleAttribute(LDAPConstants.LDAP_ID, ldapUser.getUuid());\\nuser.setSingleAttribute(LDAPConstants.LDAP_ENTRY_DN, ldapUser.getDn().toString());\\n- return proxy(realm, user, ldapUser);\\n+ // Add the user to the default groups and add default required actions\\n+ UserModel proxy = proxy(realm, user, ldapUser);\\n+ DefaultRoles.addDefaultRoles(realm, user);\\n+\\n+ for (GroupModel g : realm.getDefaultGroups()) {\\n+ proxy.joinGroup(g);\\n+ }\\n+ for (RequiredActionProviderModel r : realm.getRequiredActionProviders()) {\\n+ if (r.isEnabled() && r.isDefaultAction()) {\\n+ user.addRequiredAction(r.getAlias());\\n+ }\\n+ }\\n+\\n+ return proxy;\\n}\\n@Override\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"Enable adding of default groups"}}},{"rowIdx":2942,"cells":{"author":{"kind":"number","value":339520,"string":"339,520"},"date":{"kind":"string","value":"25.05.2018 23:33:48"},"timezone":{"kind":"number","value":-7200,"string":"-7,200"},"hash":{"kind":"string","value":"c64ecb1ab84e66fcb486423c1978d3b83852e8d2"},"message":{"kind":"string","value":"Remove expired objects from cache cluster instead of local only"},"mods":{"kind":"list like","value":[{"change_type":"MODIFY","old_path":"model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanAuthenticationSessionProvider.java","new_path":"model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanAuthenticationSessionProvider.java","diff":"@@ -120,7 +120,7 @@ public class InfinispanAuthenticationSessionProvider implements AuthenticationSe\nwhile (itr.hasNext()) {\ncounter++;\nRootAuthenticationSessionEntity entity = itr.next().getValue();\n- tx.remove(CacheDecorators.localCache(cache), entity.getId());\n+ tx.remove(cache, entity.getId());\n}\nlog.debugf(\"Removed %d expired authentication sessions for realm '%s'\", counter, realm.getName());\n"},{"change_type":"MODIFY","old_path":"model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProvider.java","new_path":"model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProvider.java","diff":"@@ -476,8 +476,6 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\n// Each cluster node cleanups just local sessions, which are those owned by itself (+ few more taking l1 cache into account)\nCache> localCache = CacheDecorators.localCache(sessionCache);\n- Cache> localClientSessionCache = CacheDecorators.localCache(clientSessionCache);\n-\nCache> localCacheStoreIgnore = CacheDecorators.skipCacheLoaders(localCache);\nfinal AtomicInteger userSessionsSize = new AtomicInteger();\n@@ -495,12 +493,12 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\npublic void accept(UserSessionEntity userSessionEntity) {\nuserSessionsSize.incrementAndGet();\n- Future future = localCache.removeAsync(userSessionEntity.getId());\n+ Future future = sessionCache.removeAsync(userSessionEntity.getId());\nfutures.addTask(future);\nuserSessionEntity.getAuthenticatedClientSessions().forEach((clientUUID, clientSessionId) -> {\nclientSessionsSize.incrementAndGet();\n- Future f = localClientSessionCache.removeAsync(clientSessionId);\n+ Future f = clientSessionCache.removeAsync(clientSessionId);\nfutures.addTask(f);\n});\n}\n@@ -508,9 +506,10 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\n});\n// Removing detached clientSessions. Ignore remoteStore for stream iteration. But we will invoke remoteStore for clientSession removal propagate\n- Cache> localCacheStoreIgnoreClientSessionCache = CacheDecorators.localCache(localClientSessionCache);\n+ Cache> localClientSessionCache = CacheDecorators.localCache(clientSessionCache);\n+ Cache> localClientSessionCacheStoreIgnore = CacheDecorators.skipCacheLoaders(localClientSessionCache);\n- localCacheStoreIgnoreClientSessionCache\n+ localClientSessionCacheStoreIgnore\n.entrySet()\n.stream()\n.filter(AuthenticatedClientSessionPredicate.create(realm.getId()).expired(expired))\n@@ -521,7 +520,7 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\npublic void accept(AuthenticatedClientSessionEntity clientSessionEntity) {\nclientSessionsSize.incrementAndGet();\n- Future future = localClientSessionCache.removeAsync(clientSessionEntity.getId());\n+ Future future = clientSessionCache.removeAsync(clientSessionEntity.getId());\nfutures.addTask(future);\n}\n@@ -539,7 +538,6 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\n// Each cluster node cleanups just local sessions, which are those owned by himself (+ few more taking l1 cache into account)\nCache> localCache = CacheDecorators.localCache(offlineSessionCache);\n- Cache> localClientSessionCache = CacheDecorators.localCache(offlineClientSessionCache);\nUserSessionPredicate predicate = UserSessionPredicate.create(realm.getId()).expired(null, expiredOffline);\n@@ -562,11 +560,11 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\npublic void accept(UserSessionEntity userSessionEntity) {\nuserSessionsSize.incrementAndGet();\n- Future future = localCache.removeAsync(userSessionEntity.getId());\n+ Future future = offlineSessionCache.removeAsync(userSessionEntity.getId());\nfutures.addTask(future);\nuserSessionEntity.getAuthenticatedClientSessions().forEach((clientUUID, clientSessionId) -> {\nclientSessionsSize.incrementAndGet();\n- Future f = localClientSessionCache.removeAsync(clientSessionId);\n+ Future f = offlineClientSessionCache.removeAsync(clientSessionId);\nfutures.addTask(f);\n});\n@@ -575,11 +573,11 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\n}\n});\n-\n// Removing detached clientSessions. Ignore remoteStore for stream iteration. But we will invoke remoteStore for clientSession removal propagate\n- Cache> localCacheStoreIgnoreClientSessionCache = CacheDecorators.localCache(localClientSessionCache);\n+ Cache> localClientSessionCache = CacheDecorators.localCache(offlineClientSessionCache);\n+ Cache> localClientSessionCacheStoreIgnore = CacheDecorators.skipCacheLoaders(localClientSessionCache);\n- localCacheStoreIgnoreClientSessionCache\n+ localClientSessionCacheStoreIgnore\n.entrySet()\n.stream()\n.filter(AuthenticatedClientSessionPredicate.create(realm.getId()).expired(expiredOffline))\n@@ -590,7 +588,7 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\npublic void accept(AuthenticatedClientSessionEntity clientSessionEntity) {\nclientSessionsSize.incrementAndGet();\n- Future future = localClientSessionCache.removeAsync(clientSessionEntity.getId());\n+ Future future = offlineClientSessionCache.removeAsync(clientSessionEntity.getId());\nfutures.addTask(future);\n}\n"}],"string":"[\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanAuthenticationSessionProvider.java\",\n \"new_path\": \"model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanAuthenticationSessionProvider.java\",\n \"diff\": \"@@ -120,7 +120,7 @@ public class InfinispanAuthenticationSessionProvider implements AuthenticationSe\\nwhile (itr.hasNext()) {\\ncounter++;\\nRootAuthenticationSessionEntity entity = itr.next().getValue();\\n- tx.remove(CacheDecorators.localCache(cache), entity.getId());\\n+ tx.remove(cache, entity.getId());\\n}\\nlog.debugf(\\\"Removed %d expired authentication sessions for realm '%s'\\\", counter, realm.getName());\\n\"\n },\n {\n \"change_type\": \"MODIFY\",\n \"old_path\": \"model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProvider.java\",\n \"new_path\": \"model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProvider.java\",\n \"diff\": \"@@ -476,8 +476,6 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\\n// Each cluster node cleanups just local sessions, which are those owned by itself (+ few more taking l1 cache into account)\\nCache> localCache = CacheDecorators.localCache(sessionCache);\\n- Cache> localClientSessionCache = CacheDecorators.localCache(clientSessionCache);\\n-\\nCache> localCacheStoreIgnore = CacheDecorators.skipCacheLoaders(localCache);\\nfinal AtomicInteger userSessionsSize = new AtomicInteger();\\n@@ -495,12 +493,12 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\\npublic void accept(UserSessionEntity userSessionEntity) {\\nuserSessionsSize.incrementAndGet();\\n- Future future = localCache.removeAsync(userSessionEntity.getId());\\n+ Future future = sessionCache.removeAsync(userSessionEntity.getId());\\nfutures.addTask(future);\\nuserSessionEntity.getAuthenticatedClientSessions().forEach((clientUUID, clientSessionId) -> {\\nclientSessionsSize.incrementAndGet();\\n- Future f = localClientSessionCache.removeAsync(clientSessionId);\\n+ Future f = clientSessionCache.removeAsync(clientSessionId);\\nfutures.addTask(f);\\n});\\n}\\n@@ -508,9 +506,10 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\\n});\\n// Removing detached clientSessions. Ignore remoteStore for stream iteration. But we will invoke remoteStore for clientSession removal propagate\\n- Cache> localCacheStoreIgnoreClientSessionCache = CacheDecorators.localCache(localClientSessionCache);\\n+ Cache> localClientSessionCache = CacheDecorators.localCache(clientSessionCache);\\n+ Cache> localClientSessionCacheStoreIgnore = CacheDecorators.skipCacheLoaders(localClientSessionCache);\\n- localCacheStoreIgnoreClientSessionCache\\n+ localClientSessionCacheStoreIgnore\\n.entrySet()\\n.stream()\\n.filter(AuthenticatedClientSessionPredicate.create(realm.getId()).expired(expired))\\n@@ -521,7 +520,7 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\\npublic void accept(AuthenticatedClientSessionEntity clientSessionEntity) {\\nclientSessionsSize.incrementAndGet();\\n- Future future = localClientSessionCache.removeAsync(clientSessionEntity.getId());\\n+ Future future = clientSessionCache.removeAsync(clientSessionEntity.getId());\\nfutures.addTask(future);\\n}\\n@@ -539,7 +538,6 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\\n// Each cluster node cleanups just local sessions, which are those owned by himself (+ few more taking l1 cache into account)\\nCache> localCache = CacheDecorators.localCache(offlineSessionCache);\\n- Cache> localClientSessionCache = CacheDecorators.localCache(offlineClientSessionCache);\\nUserSessionPredicate predicate = UserSessionPredicate.create(realm.getId()).expired(null, expiredOffline);\\n@@ -562,11 +560,11 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\\npublic void accept(UserSessionEntity userSessionEntity) {\\nuserSessionsSize.incrementAndGet();\\n- Future future = localCache.removeAsync(userSessionEntity.getId());\\n+ Future future = offlineSessionCache.removeAsync(userSessionEntity.getId());\\nfutures.addTask(future);\\nuserSessionEntity.getAuthenticatedClientSessions().forEach((clientUUID, clientSessionId) -> {\\nclientSessionsSize.incrementAndGet();\\n- Future f = localClientSessionCache.removeAsync(clientSessionId);\\n+ Future f = offlineClientSessionCache.removeAsync(clientSessionId);\\nfutures.addTask(f);\\n});\\n@@ -575,11 +573,11 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\\n}\\n});\\n-\\n// Removing detached clientSessions. Ignore remoteStore for stream iteration. But we will invoke remoteStore for clientSession removal propagate\\n- Cache> localCacheStoreIgnoreClientSessionCache = CacheDecorators.localCache(localClientSessionCache);\\n+ Cache> localClientSessionCache = CacheDecorators.localCache(offlineClientSessionCache);\\n+ Cache> localClientSessionCacheStoreIgnore = CacheDecorators.skipCacheLoaders(localClientSessionCache);\\n- localCacheStoreIgnoreClientSessionCache\\n+ localClientSessionCacheStoreIgnore\\n.entrySet()\\n.stream()\\n.filter(AuthenticatedClientSessionPredicate.create(realm.getId()).expired(expiredOffline))\\n@@ -590,7 +588,7 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\\npublic void accept(AuthenticatedClientSessionEntity clientSessionEntity) {\\nclientSessionsSize.incrementAndGet();\\n- Future future = localClientSessionCache.removeAsync(clientSessionEntity.getId());\\n+ Future future = offlineClientSessionCache.removeAsync(clientSessionEntity.getId());\\nfutures.addTask(future);\\n}\\n\"\n }\n]"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"Apache License 2.0"},"repo":{"kind":"string","value":"keycloak/keycloak"},"original_message":{"kind":"string","value":"Remove expired objects from cache cluster instead of local only"}}},{"rowIdx":2943,"cells":{"author":{"kind":"number","value":339219,"string":"339,219"},"date":{"kind":"string","value":"29.05.2018 21:30:48"},"timezone":{"kind":"number","value":-28800,"string":"-28,800"},"hash":{"kind":"string","value":"77e503f5caee0587d8bbb5ae0ea743a51c8f91fc"},"message":{"kind":"string","value":"Fixes Device Activity Response - HTML update"},"mods":{"kind":"list like","value":[{"change_type":"MODIFY","old_path":"themes/src/main/resources/theme/keycloak-preview/account/resources/app/content/account-page/account-page.component.html","new_path":"themes/src/main/resources/theme/keycloak-preview/account/resources/app/content/account-page/account-page.component.html","diff":"

{{'personalInfoHtmlTitle' | translate}}

\n\n-
\n-
\n+
\n+
\n
\n
\n{{'personalSubTitle' | translate}}\n"},{"change_type":"MODIFY","old_path":"themes/src/main/resources/theme/keycloak-preview/account/resources/app/content/applications-page/applications-page.component.html","new_path":"themes/src/main/resources/theme/keycloak-preview/account/resources/app/content/applications-page/applications-page.component.html","diff":"\n
\n+
\n
\n
\n
\n
\n \n
\n-\n
\n
\n
\n
\n-\n-
\n-\n-
\n+
\n
\n
\n
\n\n
\n
\n-
\n+
\n
\n
\n
\n