Call OpeIDM Rest API from custom jsp page

This topic has 1 reply, 2 voices, and was last updated 6 years, 7 months ago by Jake Feasel.

  • Author
    Posts
  • #7510
     sr
    Participant

    Hi,

    We have custom jsp form from where we want to pass data to openidm, for ex: to search a user in openidm based on the email entered in the form & get the response.

    In jsp page, We have planned to use javascript that will make REST call to OpenIDM.
    However, I am unable to figure out how to call OpenIDM Rest APIs from javascript.

    Any sample code/pointers to achieve this, would be highly helpful.

    Please let us know in case this approach needs to be altered or if there’s a better way to achieve it.

    Thanks!

    • This topic was modified 6 years, 7 months ago by sr.
    #7537
     Jake Feasel
    Moderator

    You need to use CORS for this: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS . Doing so will allow you to make the standard REST calls to the OpenIDM backend in the same was as any other REST client.

    To use CORS with your OpenIDM instance, you need to specifically whitelist the host which will be making the XHR calls (your JSP server). To do this, add the full origin details to the “allowedOrigins” list in conf/servletfilter-cors.json

    Here are the details for this servlet filter, from Jetty: http://www.eclipse.org/jetty/documentation/current/cross-origin-filter.html

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?