<?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: PxGrid API for getAssets not working in Network Security</title>
    <link>https://community.cisco.com/t5/network-security/pxgrid-api-for-getassets-not-working/m-p/3903983#M145</link>
    <description>&lt;P&gt;I would suggest you to try using a certificate to authenticate. And, will also ask John to take a look.&lt;/P&gt;
&lt;P&gt;PS: I moved your discussion to the security developer support forum for DevNet.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Aug 2019 17:16:32 GMT</pubDate>
    <dc:creator>hslai</dc:creator>
    <dc:date>2019-08-06T17:16:32Z</dc:date>
    <item>
      <title>PxGrid API for getAssets not working</title>
      <link>https://community.cisco.com/t5/network-security/pxgrid-api-for-getassets-not-working/m-p/3903012#M144</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying-out PxGrid, and trying to use the PxGrid client both to Publish and Subscribe to endpoint assets.&lt;/P&gt;&lt;P&gt;I am following these resources -&lt;/P&gt;&lt;P&gt;For context-in code -&amp;nbsp;&lt;A href="https://developer.cisco.com/docs/pxgrid/#!pxgrid-context-in" target="_blank" rel="noopener"&gt;https://developer.cisco.com/docs/pxgrid/#!pxgrid-context-in&lt;/A&gt;&lt;/P&gt;&lt;P&gt;For getting info on all assets -&amp;nbsp;&lt;A href="https://d1nmyq4gcgsfi5.cloudfront.net/fileMedia/ea02ce59-2668-441a-601d-0c6ca59d8bf4/CiscopxGrid20_je.pdf" target="_blank" rel="noopener"&gt;https://d1nmyq4gcgsfi5.cloudfront.net/fileMedia/ea02ce59-2668-441a-601d-0c6ca59d8bf4/CiscopxGrid20_je.pdf&lt;/A&gt;&amp;nbsp;[Page 127]&lt;/P&gt;&lt;P&gt;I am successfully able to publish endpoint information and to subscribe to it as well. However, my initial use-case goes like this-&lt;/P&gt;&lt;P&gt;"Create a PxGrid client and a pub-sub service which publishes endpoint asset information; create a subscription to this service and retrieve newly created endpoints; Use the [restBaseURL]/getAssets to get the info on already present assets for first time use."&lt;/P&gt;&lt;P&gt;I am doing the following -&lt;/P&gt;&lt;P&gt;1. Create a PxGrid client and a publisher to publish Endpoint Asset information - Successful&lt;/P&gt;&lt;P&gt;Sample code for publisher service-&lt;/P&gt;&lt;PRE&gt;sessionProperties.put(&lt;SPAN&gt;"wsPubsubService"&lt;/SPAN&gt;, &lt;SPAN&gt;"com.cisco.ise.pubsub"&lt;/SPAN&gt;);&lt;BR /&gt;sessionProperties.put(&lt;SPAN&gt;"assetTopic"&lt;/SPAN&gt;, &lt;SPAN&gt;"/topic/com.cisco.endpoint.asset"&lt;/SPAN&gt;);&lt;BR /&gt;sessionProperties.put(&lt;SPAN&gt;"restBaseUrl"&lt;/SPAN&gt;, &lt;SPAN&gt;"https://" &lt;/SPAN&gt;+ config.getHostnames()[&lt;SPAN&gt;0&lt;/SPAN&gt;] + &lt;SPAN&gt;":8910/pxgrid/ind/asset/"&lt;/SPAN&gt;);&lt;BR /&gt;ServiceRegisterResponse response = control.serviceRegister(&lt;SPAN&gt;"com.cisco.endpoint.asset"&lt;/SPAN&gt;, sessionProperties);&lt;/PRE&gt;&lt;P&gt;2. Create a PxGrid client and subscribe to the above and get information on endpoint asset as it is published - Successful&lt;/P&gt;&lt;P&gt;Sample code -&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;executor.scheduleWithFixedDelay(() -&amp;gt; {&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    try {&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        endpoint.subscribe(new StompSubscription("/topic/com.cisco.endpoint.asset", new EndpointAssetHandler()));&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    } catch (IOException e) {&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        logger.error("Publish failure");&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    }&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;}, 0, 5, TimeUnit.SECONDS);&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;With this, as I said, I am successfully able to get info on the &lt;EM&gt;NEW&amp;nbsp;&lt;/EM&gt;assets.&lt;/P&gt;&lt;P&gt;3. However, imagine that I have endpoint assets which are pre-registered in ISE. So I do something like -&lt;/P&gt;&lt;PRE&gt;Service[] services = https.serviceLookup(&lt;SPAN&gt;"com.cisco.endpoint.asset"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE&gt;Service service = services[&lt;SPAN&gt;0&lt;/SPAN&gt;];&lt;BR /&gt;String url = service.getProperties().get(&lt;SPAN&gt;"restBaseUrl"&lt;/SPAN&gt;) + &lt;SPAN&gt;"getAssets"&lt;/SPAN&gt;;&lt;BR /&gt;&lt;SPAN&gt;logger&lt;/SPAN&gt;.info(&lt;SPAN&gt;"url={}"&lt;/SPAN&gt;, url);&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// pxGrid AccesssSecret for the node&lt;BR /&gt;&lt;/SPAN&gt;String secret = https.getAccessSecret(service.getNodeName());&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//SessionQueryRequest request = new SessionQueryRequest();&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;//request.startTimestamp = startTimestamp;&lt;BR /&gt;&lt;/SPAN&gt;SampleHelper.&lt;SPAN&gt;postObjectAndPrint&lt;/SPAN&gt;(url, config.getNodeName(), secret, config.getSSLContext().getSocketFactory(), &lt;SPAN&gt;""&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;P&gt;I am getting the following error -&lt;/P&gt;&lt;PRE&gt;12:34:50.186 [main] INFO com.cisco.pxgrid.samples.ise.PxgridControl - AccountCreate request={"nodeName":"macSub"}
12:34:50.504 [main] INFO com.cisco.pxgrid.samples.ise.PxgridControl - AccountCreate response={"nodeName":"macSub","password":"MKrcmgdnWHErLG25","userName":"macSub"}
Password: MKrcmgdnWHErLG25
12:34:50.511 [main] INFO com.cisco.pxgrid.samples.ise.PxgridControl - AccountActivate request={}
12:34:50.690 [main] INFO com.cisco.pxgrid.samples.ise.PxgridControl - AccountActivate response={"accountState":"PENDING","version":"2.0.0.13"}
12:35:50.695 [main] INFO com.cisco.pxgrid.samples.ise.PxgridControl - AccountActivate request={}
12:35:50.714 [main] INFO com.cisco.pxgrid.samples.ise.PxgridControl - AccountActivate response={"accountState":"ENABLED","version":"2.0.0.13"}
12:35:50.714 [main] INFO com.cisco.pxgrid.samples.ise.SessionQueryAll - pxGrid controller version=2.0.0.13
12:35:50.722 [main] INFO com.cisco.pxgrid.samples.ise.PxgridControl - ServiceLookup request={"name":"com.cisco.endpoint.asset"}
12:35:50.748 [main] INFO com.cisco.pxgrid.samples.ise.PxgridControl - ServiceLookup response={"services":[{"name":"com.cisco.endpoint.asset","nodeName":"mac1","properties":{"wsPubsubService":"com.cisco.ise.pubsub","restBaseUrl":"https://&amp;lt;ISE_IP&amp;gt;:8910/pxgrid/ind/asset/","assetTopic":"/topic/com.cisco.endpoint.asset"}}]}
12:36:11.727 [main] INFO com.cisco.pxgrid.samples.ise.SessionQueryAll - url=https://&amp;lt;ISE_IP&amp;gt;:8910/pxgrid/ind/asset/getAssets
12:36:40.250 [main] INFO com.cisco.pxgrid.samples.ise.PxgridControl - AccessSecret request={"peerNodeName":"mac1"}
12:36:40.486 [main] INFO com.cisco.pxgrid.samples.ise.PxgridControl - AccessSecret response={"secret":"95v8KD3EF86RI1eA"}
12:37:04.589 [main] INFO com.cisco.pxgrid.samples.ise.SampleHelper - postData=""
12:37:04.716 [main] INFO com.cisco.pxgrid.samples.ise.SampleHelper - Response status=401
Content: &amp;lt;h1&amp;gt;HTTP Status 401 – Unauthorized&amp;lt;/h1&amp;gt;&amp;lt;hr class="line" /&amp;gt;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Type&amp;lt;/b&amp;gt; Status Report&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&lt;BR /&gt;&amp;lt;b&amp;gt;Message&amp;lt;/b&amp;gt; No AuthenticationProvider found for org.springframework.security.authentication.UsernamePasswordAuthenticationToken&amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Description&amp;lt;/b&amp;gt; The request has not been applied because it lacks valid authentication credentials for the target resource.&amp;lt;/p&amp;gt;&amp;lt;hr class="line" /&amp;gt;&amp;lt;h3&amp;gt;&amp;lt;/h3&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;P&gt;The error says - 401 Unauthorized, however, I have correctly retrieved the secret for the publishing service and the peerNodeName and used that for authentication.&lt;/P&gt;&lt;P&gt;Also, I can, as I said, subscribe, and get the newly published endpoint assets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that I can get the existing endpoint asset information directly from the ISE API, however, since the above is advocated as the&amp;nbsp;&lt;EM&gt;NEW&amp;nbsp;&lt;/EM&gt;way of doing things, and to maintain consistency by using&amp;nbsp;&lt;EM&gt;ONLY&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;ONE&lt;/EM&gt; set of API's, it would be great to know where I am going wrong.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 11:47:28 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/pxgrid-api-for-getassets-not-working/m-p/3903012#M144</guid>
      <dc:creator>AK9751</dc:creator>
      <dc:date>2019-08-05T11:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: PxGrid API for getAssets not working</title>
      <link>https://community.cisco.com/t5/network-security/pxgrid-api-for-getassets-not-working/m-p/3903983#M145</link>
      <description>&lt;P&gt;I would suggest you to try using a certificate to authenticate. And, will also ask John to take a look.&lt;/P&gt;
&lt;P&gt;PS: I moved your discussion to the security developer support forum for DevNet.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2019 17:16:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/pxgrid-api-for-getassets-not-working/m-p/3903983#M145</guid>
      <dc:creator>hslai</dc:creator>
      <dc:date>2019-08-06T17:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: PxGrid API for getAssets not working</title>
      <link>https://community.cisco.com/t5/network-security/pxgrid-api-for-getassets-not-working/m-p/3904053#M146</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please email me directly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;John&lt;/P&gt;
&lt;P&gt;jeppich@cisco.com&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2019 19:11:50 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/pxgrid-api-for-getassets-not-working/m-p/3904053#M146</guid>
      <dc:creator>jeppich</dc:creator>
      <dc:date>2019-08-06T19:11:50Z</dc:date>
    </item>
  </channel>
</rss>

