Erhalten Sie 404 auf Callback -URI von OpenID ConnectC#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Erhalten Sie 404 auf Callback -URI von OpenID Connect

Post by Anonymous »

Ich bekomme nach der Authentifizierung einen 404 aus dem Browser auf meinem OpenID -Callback -URI, als ob es sich um eine statische Datei handeln soll. Das, das ich registriert habe, ist in den Bereichen https: // localhost: 44368/signin-oidc. Dies ist notwendigerweise ASP.NET 4.8 mit Owin Middleware. Die Middleware ignoriert meinen Rückruf einfach total. Ich habe doppelte, dreifache, vierfache, nu-uple überprüft, ob alle URI-Pfade zwischen dem, was in Azure AD, My Web.Config registriert ist, und meinen Authentifizierungsoptionen übereinstimmen. Parameter. Von den sechs Handlern, die ich jetzt habe, werden nur Autorisierungscoderecebed, MessageCeived, recirecttoidentityProvider abgefeuert.

Code: Select all






























< /code>
Hier ist mein anfängliches Start -up.cs von bevor ich die vier Handler hinzugefügt habe, die ich in meinem Addendum erwähne: < /p>
using System.Threading.Tasks;
using Microsoft.Owin;
using Owin;
using Microsoft.Owin.Diagnostics;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.OpenIdConnect;
using System.Configuration;

[assembly: OwinStartup(typeof(OpenID_Test.Startup))]
namespace OpenID_Test
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.Use(async (context, next) =>
{
// This writeline shows up in the output window several times
System.Diagnostics.Debug.WriteLine("Incoming request: " + context.Request.Method + " " + context.Request.Path + " Query: " + context.Request.QueryString);
await next();
System.Diagnostics.Debug.WriteLine("After first next(), status code: "  + context.Response.StatusCode);
});
app.UseErrorPage(new ErrorPageOptions()
{
ShowCookies = true,
ShowEnvironment = true,
ShowQuery = true,
ShowExceptionDetails = true,
ShowHeaders = true,
ShowSourceCode = true,
SourceCodeLineCount = 10
});

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
app.SetDefaultSignInAsAuthenticationType(
CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
ClientId = ConfigurationManager.AppSettings["ClientId"],
ClientSecret = ConfigurationManager.AppSettings["ClientSecret"],
Authority = ConfigurationManager.AppSettings["Authority"],
RedirectUri = ConfigurationManager.AppSettings["RedirectUri"],
CallbackPath = new PathString("/signin-oidc"),
ResponseType = "code",
Scope = "openid profile email",
Notifications = new OpenIdConnectAuthenticationNotifications
{
SecurityTokenValidated = context =>
{
// This writeline doesn't show up in the output window
System.Diagnostics.Debug.WriteLine("\n\nSecurityTokenValidated triggered\n\n");
context.AuthenticationTicket.Properties.RedirectUri = "/Home.aspx";
return Task.FromResult(0);
},
AuthenticationFailed = context =>
{
// Nor does this one
System.Diagnostics.Debug.WriteLine("\n\nAuthenticationFailed triggered\n\n");
return Task.FromResult(0);
}
}
});
app.Use(async (context, next) =>
{
// This writeline also shows up several times
System.Diagnostics.Debug.WriteLine("End of flow before next(): " + context.Request.Method + " " + context.Request.Path + " Query: " + context.Request.QueryString);
await next();
System.Diagnostics.Debug.WriteLine("End of flow after next(), status code: " + context.Response.StatusCode);
});
}
}
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post