<?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: How do I integrate with nuxeo-platform-login-portal-sso in my portal? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328382#M15383</link>
    <description>&lt;P&gt;With Nuxeo DM 5.5, I tried to use &amp;lt;i&amp;gt;nuxeo-platform-login-portal-sso&amp;lt;/i&amp;gt; for authentication using &amp;lt;i&amp;gt;nuxeo-http-client&amp;lt;/i&amp;gt; but I have always 401 reponse when calling &amp;lt;i&amp;gt;client.getSession()&amp;lt;/i&amp;gt;. Inside server.log, I have this lines&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2012 14:39:47 GMT</pubDate>
    <dc:creator>hachicha_</dc:creator>
    <dc:date>2012-01-31T14:39:47Z</dc:date>
    <item>
      <title>How do I integrate with nuxeo-platform-login-portal-sso in my portal?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328380#M15381</link>
      <description>&lt;P&gt;I want to use &lt;CODE&gt;nuxeo-platform-login-portal-sso&lt;/CODE&gt; for authentication, but how do I communicate the client authentication info exactly?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2011 17:10:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328380#M15381</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2011-12-22T17:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate with nuxeo-platform-login-portal-sso in my portal?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328381#M15382</link>
      <description>&lt;P&gt;First, note that &lt;CODE&gt;nuxeo-platform-login-portal-sso&lt;/CODE&gt; is a bit of a misnomer, what this module really does is establish a shared-secret method of authenticating between the Nuxeo server and a client.&lt;/P&gt;
&lt;H1&gt;Server&lt;/H1&gt;
&lt;P&gt;On the server side, you establish it using something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;extension
    target="org.nuxeo.ecm.platform.ui.web.auth.service.PluggableAuthenticationService"
    point="authenticators"&amp;gt;
  &amp;lt;authenticationPlugin name="PORTAL_AUTH"&amp;gt;
    &amp;lt;loginModulePlugin&amp;gt;Trusting_LM&amp;lt;/loginModulePlugin&amp;gt;
    &amp;lt;parameters&amp;gt;
      &amp;lt;parameter name="secret"&amp;gt;MySharedSecret&amp;lt;/parameter&amp;gt;
      &amp;lt;parameter name="maxAge"&amp;gt;60&amp;lt;/parameter&amp;gt;
    &amp;lt;/parameters&amp;gt;
  &amp;lt;/authenticationPlugin&amp;gt;
&amp;lt;/extension&amp;gt;

&amp;lt;!-- Include Portal Auth into authentication chain --&amp;gt;
&amp;lt;extension
    target="org.nuxeo.ecm.platform.ui.web.auth.service.PluggableAuthenticationService"
    point="chain"&amp;gt;
  &amp;lt;authenticationChain&amp;gt;
    &amp;lt;plugins&amp;gt;
      &amp;lt;!--  Keep basic Auth at top of Auth chain to support RSS access via BasicAuth --&amp;gt;
      &amp;lt;plugin&amp;gt;BASIC_AUTH&amp;lt;/plugin&amp;gt;
      &amp;lt;plugin&amp;gt;PORTAL_AUTH&amp;lt;/plugin&amp;gt;
      &amp;lt;plugin&amp;gt;FORM_AUTH&amp;lt;/plugin&amp;gt;
    &amp;lt;/plugins&amp;gt;
  &amp;lt;/authenticationChain&amp;gt;
&amp;lt;/extension&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here we've chosen to name this authentication method &lt;CODE&gt;PORTAL_AUTH&lt;/CODE&gt;. Note that the &lt;STRONG&gt;secret&lt;/STRONG&gt; parameter contains the shared secret that the client will have to know.&lt;/P&gt;
&lt;H1&gt;Client&lt;/H1&gt;
&lt;P&gt;On the client side, you could use one of the existing clients:&lt;/P&gt;
&lt;H2&gt;Using nuxeo-http-client&lt;/H2&gt;
&lt;P&gt;&lt;CODE&gt;nuxeo-http-client&lt;/CODE&gt; is a sample Java client to do REST calls to Nuxeo. You can configure it connect to a server that uses &lt;CODE&gt;nuxeo-platform-login-portal-sso&lt;/CODE&gt; by doing:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;NuxeoServer nxServer = new NuxeoServer("http://127.0.0.1:8080/nuxeo");
nxServer.setAuthType(NuxeoServer.AUTH_TYPE_SECRET);
nxServer.setSharedSecretAuthentication("Administrator", "MySharedSecret");
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See &lt;CODE&gt;src/test/java/org/nuxeo/ecm/http/client/remote/tests/RemoteTests.java&lt;/CODE&gt; in &lt;CODE&gt;nuxeo-http-client&lt;/CODE&gt; for more.&lt;/P&gt;
&lt;H2&gt;Using nuxeo-automation-client&lt;/H2&gt;
&lt;P&gt;&lt;CODE&gt;nuxeo-automation-client&lt;/CODE&gt; is a more modern Nuxeo Java client using high-level Document abstractions. You can configure it to connect to a server that uses &lt;CODE&gt;platform-login-portal-sso&lt;/CODE&gt; by doing:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;HttpAutomationClient client = new HttpAutomationClient("http://localhost:8080/nuxeo/site/automation");
client.setRequestInterceptor(new PortalSSOAuthInterceptor("MySharedSecret", "Administrator"));
Session session = client.getSession();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See &lt;CODE&gt;src/test/java/org/nuxeo/ecm/automation/client/jaxrs/test/SampleSSOPortal.java&lt;/CODE&gt; in &lt;CODE&gt;nuxeo-automation-client&lt;/CODE&gt; for more.&lt;/P&gt;
&lt;H2&gt;Manual HTTP calls&lt;/H2&gt;
&lt;P&gt;If you want to do all the calls to Nuxeo yourself, you'll have to decide which HTTP requests to make, and in addition you'll have to send some specific headers to authenticate. The HTTP headers are:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;NX_TS&lt;/CODE&gt;: the timestamp, in milliseconds since epoch, when you're generating the request.&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;NX_RD&lt;/CODE&gt;: a few some random characters.&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;NX_USER&lt;/CODE&gt;: the user as whom you want to authenticate.&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;NX_TOKEN&lt;/CODE&gt;: a token proving authentication generated using the algorithm &lt;CODE&gt;BASE64_MD5(timestamp + ":" + random + ":" + secret + ":" + user)&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The token contains the secret but in a hashed form which cannot be reversed by an eavesdropper to generate new requests. The timestamp is used to avoid replay attacks (the delta with the real time on the server cannot be more than the &lt;CODE&gt;maxAge&lt;/CODE&gt; specified on the server). The random characters are used to avoid pre-computed dictionary attacks.&lt;/P&gt;
&lt;P&gt;The following Java code can be used:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;import java.security.MessageDigest;
import javax.xml.bind.DatatypeConverter;

public String makeToken(String timestamp, String random, String secret,
        String user) throws Exception {
    String clearToken = timestamp + ":" + random + ":" + secret + ":"
            + user;
    byte[] md5 = MessageDigest.getInstance("MD5").digest(
            clearToken.getBytes());
    return DatatypeConverter.printBase64Binary(md5);
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As a validation of your code, check that &lt;CODE&gt;makeToken("1324572561000", "qwertyuiop", "secret", "bob")&lt;/CODE&gt; returns &lt;CODE&gt;8y4yXfms/iKge/OtG6d2zg==&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2011 17:58:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328381#M15382</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2011-12-22T17:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate with nuxeo-platform-login-portal-sso in my portal?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328382#M15383</link>
      <description>&lt;P&gt;With Nuxeo DM 5.5, I tried to use &amp;lt;i&amp;gt;nuxeo-platform-login-portal-sso&amp;lt;/i&amp;gt; for authentication using &amp;lt;i&amp;gt;nuxeo-http-client&amp;lt;/i&amp;gt; but I have always 401 reponse when calling &amp;lt;i&amp;gt;client.getSession()&amp;lt;/i&amp;gt;. Inside server.log, I have this lines&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2012 14:39:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328382#M15383</guid>
      <dc:creator>hachicha_</dc:creator>
      <dc:date>2012-01-31T14:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate with nuxeo-platform-login-portal-sso in my portal?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328383#M15384</link>
      <description>&lt;P&gt;How does that integrate with other SSO uses? Like if I want to authenticate nuxeo through REMOTE_USER-like environment variable, but still connecting clients to it like you described above?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2012 16:38:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328383#M15384</guid>
      <dc:creator>OlivierM_</dc:creator>
      <dc:date>2012-02-01T16:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate with nuxeo-platform-login-portal-sso in my portal?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328384#M15385</link>
      <description>&lt;P&gt;Does this approach work if I do not have the user's name/password in LDAP, SQL, or a config file or do I need to have the user name defined somewhere? Is there a need for a "user" entity for documentation ownership, ACls, etc?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Aug 2012 01:19:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328384#M15385</guid>
      <dc:creator>mike_frey</dc:creator>
      <dc:date>2012-08-25T01:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate with nuxeo-platform-login-portal-sso in my portal?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328385#M15386</link>
      <description>&lt;P&gt;This (the first long comment) was posted as an answer but is not an answer. Please ask questions as new questions.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2012 19:45:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328385#M15386</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2012-08-30T19:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate with nuxeo-platform-login-portal-sso in my portal?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328386#M15387</link>
      <description>&lt;P&gt;mike&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2012 19:47:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-do-i-integrate-with-nuxeo-platform-login-portal-sso-in-my/m-p/328386#M15387</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2012-08-30T19:47:29Z</dc:date>
    </item>
  </channel>
</rss>

