Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

CORS Filter Issue using ADF BC REST services with ADF Security implementation

Subramanian Meyyappan-OracleSep 24 2018 — edited Oct 5 2019

Hi Team,

I have a requirement to protect my REST API's using ADF Security(Security Model: ADF Authentication) which is built on ADF framework and expose it for JET UI.

Please find the implementation had done from ADF and JET front.

ADF Implementation:

      As mentioned in the below blog CORS had enabled for REST application and it protected by ADF Security.

The REST application deployed in WebLogic Server where SSL got enabled.

https://blogs.oracle.com/shay/enabling-cors-for-adf-business-component-rest-services

JET Implementation:

    REST API's got consumed through JET application using through AJAX calls. While trying to access the UI page GET call is trying to invoke the API and it got failed for two reasons:

  1. No Credentials - Credentials required.
  2. CORS Issue

Please find the below error from browser console.

Failed to load resource: the server responded with a status of 401 (Unauthorized) 

localhost/:1 Failed to load http://xx.xxx.xxx.xxx:7003/RESTapi/rest/v0/departments?totalResults=true&offset=0&limit=5: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.

In order to solve Issue#1. I ran the REST API URL in the browser and provide the required credentials. Post authentication, the same API can be able to access it in browser.

Now, am trying to access the same API in the AJAX call where in application(localhost:8000). It returns the same error.   

In order to solve Issue#2 I had configured below options on top of blogger implementations it is not working as expected.

http://www.javadoc.io/doc/com.thetransactioncompany/cors-filter/2.6

Also, I have tried below mentioned way.

https://rssupport.atlassian.net/wiki/spaces/ALFJ/pages/67600479/Setup+Guide+for+CORS+Cross-Origin+Resource+Sharing

Just I want to understand because of Unauthorized access CORS is firing?

Note: Previously, Implementation from ADF and JET was working fine without implementing the ADF security.

After implementing ADF Security ran into two issues.

JET version: 5.0

Studio Edition Version 12.2.1.0.0

Any help on this shall be highly appreciated.

Regards,

Subramanian

This post has been answered by Subramanian Meyyappan-Oracle on Sep 26 2018
Jump to Answer
Comments
Post Details
Added on Sep 24 2018
5 comments
648 views