<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unable to call nuxeo rest api from rest client when integrated with Keycloak authentication plugin in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/unable-to-call-nuxeo-rest-api-from-rest-client-when-integrated/m-p/316946#M3947</link>
    <description>&lt;P&gt;Are you building the 10.10 branch of &lt;CODE&gt;nuxeo-platform-login-keycloak&lt;/CODE&gt; (which is needed because you're using Nuxeo 10.10) ?&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jun 2019 12:36:21 GMT</pubDate>
    <dc:creator>Florent_Guillau</dc:creator>
    <dc:date>2019-06-17T12:36:21Z</dc:date>
    <item>
      <title>Unable to call nuxeo rest api from rest client when integrated with Keycloak authentication plugin</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/unable-to-call-nuxeo-rest-api-from-rest-client-when-integrated/m-p/316945#M3946</link>
      <description>&lt;P&gt;I wanted to integrate keycloak as authentication plugin for nuxeo platform both running on my local machine&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Set up details&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Nuxeo platform version: 10.10 (runs on tomcat 9)&lt;BR /&gt; /&amp;gt;
Keycloak version: 6.0.1&lt;BR /&gt; /&amp;gt;
keycloak tomcat adapter distribution: keycloak-tomcat8-adapter-dist&lt;/P&gt;
&lt;P&gt;I followed the steps mentioned in &lt;A href="https://github.com/nuxeo/nuxeo/tree/master/nuxeo-services/login/nuxeo-platform-login-keycloak"&gt;link&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Here, I built the nuxeo-platform-login-keycloak plugin for keycloak 6.0.1 version.
On keycloak, I set up a auth client under newly created realm 'demo'&lt;/P&gt;
&lt;P&gt;Client details available in &lt;A href="%5Bhttps://i.stack.imgur.com/ch0yz.jpg%5D(https://i.stack.imgur.com/ch0yz.jpg)"&gt;client configuration&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I created role as 'Members' and added admin role to it I created a user 'keycloakuser' and added to 'Members'.&lt;/P&gt;
&lt;P&gt;When nuxeo ui is hit from browser, the authentication flow works fine. It redirects me to login page of keycloak, on valid credentials, it redirects me to nuxeo ui. The user created along with 'Members' group assigned to it.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Error Scenario&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;To call rest api from postman, I configured Oauth2 for authentication.&lt;/P&gt;
&lt;P&gt;Auth url: &lt;A href="http://localhost:8080/auth/realms/demo/protocol/openid-connect/auth" target="test_blank"&gt;http://localhost:8080/auth/realms/demo/protocol/openid-connect/auth&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Token Url: &lt;A href="http://localhost:8080/auth/realms/demo/protocol/openid-connect/token" target="test_blank"&gt;http://localhost:8080/auth/realms/demo/protocol/openid-connect/token&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Client: testclient&lt;/P&gt;
&lt;P&gt;Client secret: *****&lt;/P&gt;
&lt;P&gt;Scope: openid&lt;/P&gt;
&lt;P&gt;I used access_token obtained using Oauth2 flow, to make API call as &lt;A href="http://localhost:8190/nuxeo/api/v1/id/document_id" target="test_blank"&gt;http://localhost:8190/nuxeo/api/v1/id/document_id&lt;/A&gt;. It is failing with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-java"&gt;java.lang.ClassCastException: class org.apache.catalina.core.ApplicationHttpRequest cannot be cast to class org.apache.catalina.connector.RequestFacade (org.apache.catalina.core.ApplicationHttpRequest and org.apache.catalina.connector.RequestFacade are in unnamed module of loader java.net.URLClassLoader @39aeed2f)
    at org.nuxeo.ecm.platform.ui.web.keycloak.DeploymentResult.invokeOn(DeploymentResult.java:79) [nuxeo-platform-login-keycloak-10.10.jar:?]
    at org.nuxeo.ecm.platform.ui.web.keycloak.KeycloakAuthenticatorProvider.provide(KeycloakAuthenticatorProvider.java:56) [nuxeo-platform-login-keycloak-10.10.jar:?]
    at org.nuxeo.ecm.platform.ui.web.keycloak.KeycloakAuthenticationPlugin.handleRetrieveIdentity(KeycloakAuthenticationPlugin.java:113) [nuxeo-platform-login-keycloak-10.10.jar:?]
    at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.handleRetrieveIdentity(NuxeoAuthenticationFilter.java:1137) [nuxeo-platform-web-common-10.10.jar:?]
    at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.doFilterInternal(NuxeoAuthenticationFilter.java:548) [nuxeo-platform-web-common-10.10.jar:?]

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Observation:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The API request call is not hitting the keycloak endpoint&lt;/LI&gt;
&lt;LI&gt;I tried to print the reqqest type (actually the request wrapper type) in both scenarios.
For browser request, it was &lt;CODE&gt;org.apache.catalina.connector.RequestFacade&lt;/CODE&gt; and for api request it was &lt;CODE&gt;org.apache.catalina.core.ApplicationHttpRequest&lt;/CODE&gt; which is not extending
&lt;CODE&gt;org.apache.catalina.connector.RequestFacade&lt;/CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Questions:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Does above behavior (mentioend in point 2) differ in tomcat versions earlier to tomcat 9?&lt;/LI&gt;
&lt;LI&gt;Is the problem with compatibility issues with tomcat version and keycloak adapters jar version?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;(crossposted on &lt;A href="https://stackoverflow.com/questions/56574241/unable-to-call-nuxeo-rest-api-from-rest-client-when-integrated-with-keycloak-aut"&gt;StackOverflow&lt;/A&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 10:36:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/unable-to-call-nuxeo-rest-api-from-rest-client-when-integrated/m-p/316945#M3946</guid>
      <dc:creator>Ravindra_Nalavd</dc:creator>
      <dc:date>2019-06-14T10:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to call nuxeo rest api from rest client when integrated with Keycloak authentication plugin</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/unable-to-call-nuxeo-rest-api-from-rest-client-when-integrated/m-p/316946#M3947</link>
      <description>&lt;P&gt;Are you building the 10.10 branch of &lt;CODE&gt;nuxeo-platform-login-keycloak&lt;/CODE&gt; (which is needed because you're using Nuxeo 10.10) ?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 12:36:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/unable-to-call-nuxeo-rest-api-from-rest-client-when-integrated/m-p/316946#M3947</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2019-06-17T12:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to call nuxeo rest api from rest client when integrated with Keycloak authentication plugin</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/unable-to-call-nuxeo-rest-api-from-rest-client-when-integrated/m-p/316947#M3948</link>
      <description>&lt;P&gt;[Florent Guillaume](https&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 09:05:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/unable-to-call-nuxeo-rest-api-from-rest-client-when-integrated/m-p/316947#M3948</guid>
      <dc:creator>Ravindra_Nalavd</dc:creator>
      <dc:date>2019-06-18T09:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to call nuxeo rest api from rest client when integrated with Keycloak authentication plugin</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/unable-to-call-nuxeo-rest-api-from-rest-client-when-integrated/m-p/316948#M3949</link>
      <description>&lt;P&gt;the keycloak-tomcat8-adapter-dist is for tomcat 8. Will this work for tomcat 9 as well? As the distribution files are not available for tomcat 9&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 12:29:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/unable-to-call-nuxeo-rest-api-from-rest-client-when-integrated/m-p/316948#M3949</guid>
      <dc:creator>Ravindra_Nalavd</dc:creator>
      <dc:date>2019-06-18T12:29:23Z</dc:date>
    </item>
  </channel>
</rss>

