<div dir="ltr">+ <a class="gmail_plusreply" id="plusReplyChip-1" href="mailto:dev@shibboleth.net" tabindex="-1">@Shib Dev</a> <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 5, 2019 at 2:40 PM DD K <<a href="mailto:ddk05361@gmail.com">ddk05361@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Brent,<br><br></div><div>Yeah, as you said doing it in the way I've did previously was the fix. Attaching the code snippet for future references:<br><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"DejaVu Sans Mono";font-size:9pt"><span style="color:rgb(204,120,50)">private </span>EntityDescriptor <span style="color:rgb(255,198,109)">generateMetadataObjectFromString</span>(String metadataString) {<br> EntityDescriptor entityDescriptor = <span style="color:rgb(204,120,50)">null;<br></span><span style="color:rgb(204,120,50)"> </span>InputStream inputStream<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)"> try </span>{<br> <span style="font-style:italic">doBootstrap</span>()<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(128,128,128)"> </span>inputStream = <span style="color:rgb(204,120,50)">new </span>ByteArrayInputStream(metadataString.trim().getBytes(StandardCharsets.<span style="color:rgb(152,118,170);font-style:italic">UTF_8</span>))<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)"> </span>entityDescriptor = (EntityDescriptor) XMLObjectSupport.<span style="font-style:italic">unmarshallFromInputStream</span>(<br> XMLObjectProviderRegistrySupport.<span style="font-style:italic">getParserPool</span>()<span style="color:rgb(204,120,50)">, </span>inputStream)<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)"> </span>} <span style="color:rgb(204,120,50)">catch </span>( UnmarshallingException | XMLParserException e) {<br> <span style="color:rgb(152,118,170);font-style:italic">log</span>.error(<span style="color:rgb(106,135,89)">"Error While reading Service Provider metadata xml"</span><span style="color:rgb(204,120,50)">, </span>e)<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)"> </span>}<br> <span style="color:rgb(204,120,50)">return </span>entityDescriptor<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)"> </span>}</pre></div><div><br></div><div>Thanks All for the answers,</div><div>Deshan Koswatte<br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 15, 2019 at 2:02 AM Brent Putman <<a href="mailto:putmanb@georgetown.edu" target="_blank">putmanb@georgetown.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p><br>
</p>
<div class="gmail-m_-2326682982604455748gmail-m_7948196408723179366moz-cite-prefix">On 8/14/19 4:29 AM, DD K wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hi All,<br>
<br>
</div>
<div>What I'm currently trying is to migrate from OpenSAML2.x to
OpenSAML3.x. Currently on OpenSAML2.x the code is as below:</div>
<br>
</div>
</blockquote>
<p>Well that wasn't correct in the first place. At least not if
you're just trying to turn some XML you already have into an
XMLObject tree. If you have the XML for an existing
EntityDescriptor or EntitiesDescriptor element and just want to
parse that into OpenSAML representation, then you just parse and
unmarshall. Exactly like what you were doing in the earlier
thread you posted for (I think) AuthnRequest. Given that you were
using the DOMMetadataProvider, you were doing sort of doing that,
but in a very roundabout and unnecessary fashion.</p>
<p><br>
</p>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
<div>But I've struggled to find a resource on how to generate a
EntityDescriptor to return from the method cause now there is
no method such as <i>generateMetadata()</i> in <i>DOMMetadataResolver</i>,
keeping this apart </div>
</div>
</blockquote>
<p><br>
</p>
<p>Right, the entire design and API of metadata providers changed in
3.x. In 3.x it's entirely EntityDescirptor-centric (no more
EntitiesDescriptors are surfaced) and the API is about searching
for and returning 1 or more EntityDescriptors.<br>
</p>
<p><br>
</p>
<blockquote type="cite">
<div dir="ltr">
<div>there is a method called <i>resolveSingle()</i> but it
needs a <i>CriteriaSet(which i do not know what to include)</i>.<br>
</div>
</div>
<br>
</blockquote>
<p>Right, in the new model you would supply criteria for the
EntityDescriptor(s) you want. In the common SSO use case, you
usually want just 1, based usually on entityID criteria.</p>
<p>If you want to see how that works, take a look at the relevant
unit tests, there's plenty of examples there.<br>
</p>
<p><br>
</p>
</div>
</blockquote></div></div>
</blockquote></div>