Skip to content

Remote authentication not working when Framework app is not the root of the website #191

@pdunkerley

Description

@pdunkerley

I am trying to get the remote authentication working against our ASP.NET MVC 5.2 app. Our app doesn't run in the root of the IIS website - we have to run it as a sub application (i.e. /myapp), and I think this may be causing the problem I am having. Essentially, when the Core app makes the authentication request to the Framework app, it calls "/systemweb-adapters/authenticate" and not "/myapp/systemweb-adapters/authenticate", which then fails with a 404 (I can see this in the IIS logs).

In Program.cs I have the following:

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSystemWebAdapters()
    .AddRemoteApp(options =>
    {
        options.RemoteAppUrl = new("http://localhost/MyApp");
        options.ApiKey = "MySecretKey";
    })
    .AddRemoteAppAuthentication(true);

But it seems to ignore the "/MyApp" bit when it makes the request. I have created a dummy solution with a framework app and a core app, and can get the remote authentication working just fine when the framework app is in the root of a website, but as soon as I put it in a sub folder, it fails due to the above path problem.

Is this a bug, or I am approaching this incorrectly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions