diff --git a/src/Dfe.RegionalImprovementForStandardsAndExcellence/Pages/Index.cshtml b/src/Dfe.RegionalImprovementForStandardsAndExcellence/Pages/Index.cshtml index 09c3d62..4d80621 100644 --- a/src/Dfe.RegionalImprovementForStandardsAndExcellence/Pages/Index.cshtml +++ b/src/Dfe.RegionalImprovementForStandardsAndExcellence/Pages/Index.cshtml @@ -12,7 +12,7 @@ Schools requiring improvement - Select a new school + Add a school
diff --git a/src/Dfe.RegionalImprovementForStandardsAndExcellence/Program.cs b/src/Dfe.RegionalImprovementForStandardsAndExcellence/Program.cs index 4b147cc..1158636 100644 --- a/src/Dfe.RegionalImprovementForStandardsAndExcellence/Program.cs +++ b/src/Dfe.RegionalImprovementForStandardsAndExcellence/Program.cs @@ -65,50 +65,7 @@ options.MaxModelValidationErrors = 50; }); -builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme).AddMicrosoftIdentityWebApp(options => -{ - builder.Configuration.Bind("AzureAd", options); - - options.Events = new OpenIdConnectEvents - { - OnRemoteFailure = context => - { - // Log error details - Console.WriteLine("Authentication failure: " + context.Failure?.Message); - if (context.Failure?.InnerException != null) - { - Console.WriteLine("Inner exception: " + context.Failure.InnerException.Message); - } - - // Redirect to a custom error page or show the error - context.Response.Redirect("/Account/Error"); - context.HandleResponse(); - return Task.CompletedTask; - }, - - OnTokenValidated = context => - { - // Log claims received - var claims = context.Principal?.Claims; - Console.WriteLine("User claims:"); - foreach (var claim in claims ?? Enumerable.Empty()) - { - Console.WriteLine($"{claim.Type}: {claim.Value}"); - } - - return Task.CompletedTask; - }, - - OnRedirectToIdentityProvider = context => - { - // Log the details of the redirect request - Console.WriteLine("Redirecting to Identity Provider"); - Console.WriteLine($"Redirect URI: {context.ProtocolMessage.RedirectUri}"); - Console.WriteLine($"Request Type: {context.ProtocolMessage.RequestType}"); - return Task.CompletedTask; - } - }; -}); +builder.Services.AddMicrosoftIdentityWebAppAuthentication(config); builder.Services.AddAuthorization(options => { options.DefaultPolicy = SetupAuthorizationPolicyBuilder().Build(); }); AuthorizationPolicyBuilder SetupAuthorizationPolicyBuilder() diff --git a/src/Dfe.RegionalImprovementForStandardsAndExcellence/appsettings.json b/src/Dfe.RegionalImprovementForStandardsAndExcellence/appsettings.json index fadb7e3..744caed 100644 --- a/src/Dfe.RegionalImprovementForStandardsAndExcellence/appsettings.json +++ b/src/Dfe.RegionalImprovementForStandardsAndExcellence/appsettings.json @@ -5,8 +5,10 @@ "Microsoft.AspNetCore": "Warning" } }, + "ConnectionStrings": { + "DefaultConnection": "" + }, "AllowedHosts": "*", - "AcademiesApi": { "ApiKey": "", "Url": ""