Exploring the compatibility between ADFS 2.0 and JSONP

My main website uses passive federation (ADFS 2.0) and includes javascript that communicates with an MVC Web API site using jsonp.

I am facing a challenge in getting this WebAPI to support Single Sign On on the same machine but different port. The passive redirects are causing issues with the jsonp requests, as the STS returns its own script instead of redirecting to the actual URL for the response script.

I am wondering if passive federation is compatible with a jsonp webapi. If not, how can I implement Active Federation without requiring username/password credentials? Since users are already authenticated via the main website before accessing the webapi, how can I leverage their existing login status within the webapi?

Answer №1

In this particular situation, the passive federation protocol will not be effective.

There are two possible solutions:

  • If your web API is primarily utilized by your website, you can share the cookie generated by WIF upon user authentication. To achieve this, ensure that different websites configure the <cookieHandler> section in WIF configuration to utilize the same domain and path, using a Fully Qualified Domain Name (FQDN) instead of machine names. This allows the browser to recognize both the website and the API as part of the same domain.

  • Another option is to set up the Web API to extract and authenticate SAML tokens generated during the authentication process. In this case, save the token used for authentication by enabling the saveBootstrapToken setting in the <service> element of the WIF configuration. Retrieve the token using the claimsIdentity.GetBootrapToken() extension method, then attach it as an HTTP header in JavaScript calls like "Authorization: bearer ...the-token....". On the server side, validate the token programmatically. Keep in mind that there may be limitations in IIS due to header length if the token is excessively large.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

JS unable to insert new row in table

I checked the input value before submitting it in the form and confirmed that it is correct, returning as a string.enter image description here const saveList = () => { const inputListNameText = inputListName.value; fetch('/api/lists' ...

Do arrays permanently retain the strings stored within them?

As an 11-year-old who has been learning Javascript for the past month and a half, I am currently working on creating a login/register system. Right now, my focus is on the register part. I have a question: when adding a string/number/boolean to an array, d ...

What is the best way to eliminate the occurrence of the word 'undefined' from the cycle output?

Can anyone assist with solving this issue? The webpage on JSFIDDLE displays 4 news containers, but an 'undefined' string appears before the first news container. I am looking to remove that 'undefined' string. Here is the HTML code: ...

Changing text content into objects in Protractor

I am facing an issue with a span tag that contains JSON text, which I need to convert into an object in Protractor for testing purposes. {"type":"msax-cc-error","value":[{"Code":22104,"Message":"Card holder is required"},{"Code":22058,"Message":"Card numb ...

MongoDB results are being pushed into an array, yet the array continues to stay devoid of any data

Hello all! This is my introductory question on stack overflow, so I appreciate your patience. I am currently working on a controller function that is responsible for rendering the Google Maps API. My goal is to iterate through the results fetched from Mon ...

After establishing the connection between Ajax and PHP with a relationship table, the inserted data is not being displayed

I am new to using Ajax and Php and have a question about inserting data into a Mysql table using Bootstrap Modal, Ajax, and Php. Currently, I have a table named "tbl_employee" and a page called "index.php." In the "index.php" page, there is a Bootstrap m ...

A step-by-step guide to setting up a Slick Slider JS slideshow with center mode

I am working on implementing a carousel using the amazing Slick Slider, which I have successfully used for images in the past without any issues. My goal is to create a 'center mode' slideshow similar to the example provided but with multiple div ...

Templating with Underscores: Revolutionizing token markers

When using out of the box underscore templating, the default markers for raw content are <%= %>, and for HTML escaped content are <%- %>. However, it is possible to change these markers by adjusting the template settings, for example: _.templ ...

Having difficulty with building a basic module in Node JS, it's just not cooperating

As a newcomer to Node JS, this platform, and the English language, I apologize in advance for any linguistic errors. I seem to be encountering a "return" error within my code. Specifically, when I include the hi.myFunc(); function, I receive the ...

Retrieving a targeted data point from a JSON object

I am working with a json data that contains various properties, but I am only interested in extracting the uniqueIDs. Is there a way to retrieve ONLY the uniqueID values and have them returned to me as a comma separated list, for example: 11111, 22222? (I ...

After incorporating some movement effects into my menu, suddenly none of the buttons were responding

While working on my website and trying to add a close menu button, I encountered an issue where all the menu buttons stopped functioning. Here is the HTML code snippet: <div id="openMenuButton"> <span style= "font-size:30px;cu ...

Is there a flawless web UI framework that complements the Microsoft stack? Delving into architectural considerations

I am seeking recommendations for a solution to the challenge at hand, understanding that there may not be a one-size-fits-all answer to my query: My current scenario involves a WinForms.NET (v4.0 framework) UI with a WCF back-end and EF4 model objects, wh ...

Animation does not occur after the stop() function is executed

My goal is to create a functionality where, upon moving back to the grey content box after leaving the button, the slideUp animation stops and the content slides down again. This works seamlessly with jQuery 1.x (edge), but when I switch to jQuery 1.10, th ...

Looking to trigger a PHP page by clicking on a div?

Is there a way to trigger a PHP page call when a user clicks on a <DIV> with AJAX? Additionally, can the text of the DIV be changed to display "LOADING....." simultaneously? I lack knowledge about AJAX. Could you please provide me with more details ...

The JQUERY code for refreshing a div requires a timeout delay

I'm looking for a way to refresh a specific div on my website that's used for chat. Here's the code I currently have: var refreshId = setInterval(function() { $('#chat_grab').load('chat_grab.php?randval=' + Math.rand ...

How can I create a box-shaped outline using Three.js?

As someone new to threejs, I have been trying to figure out how to render a transparent box around a symbol in my canvas. The box should only display a border and the width of this border should be customizable. Currently, I am using wireframe to create a ...

Turn off integrity verification for local dependencies in package-lock.json

Is there a way to bypass the integrity check for a local dependency in package-lock.json? Within my project repository, I have a core library along with two Angular applications that both rely on this core library as a dependency. The problem arises beca ...

Locate the parent element that has the smallest amount of space taken up by its child elements

My goal is to determine which container, among several <divs>, each containing multiple child <divs> of varying sizes, has the smallest amount of space covered by the child elements. <div class="container" id="first"> ...

Implement using a variable as a key for an object in a reducer function

I am facing an issue with constructing an object. The string, named "SKU" in this scenario is being passed through action as action.name. Although I have all the necessary data in the reducer function, I need to dynamically replace the hardcoded SKU with ...

angularjs determining the appropriate time to utilize a directive

I have been delving into JavaScript and AngularJS for approximately a month now, but I still find myself unsure of when to use directives. For example: I am looking to display appointments in a table with the date as the table header. I envision having bu ...