Skip to content

Commit

Permalink
Update the Mimban sample to use provider-specific authentication schemes
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinchalet committed Mar 15, 2024
1 parent e405c7b commit e5adebc
Show file tree
Hide file tree
Showing 16 changed files with 12 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Security.Claims;
using System.Threading.Tasks;
using Aridka.Server.Helpers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Mvc;
using OpenIddict.Abstractions;
using OpenIddict.Client.AspNetCore;
Expand Down
6 changes: 3 additions & 3 deletions samples/Mimban/Mimban.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using OpenIddict.Abstractions;
using OpenIddict.Client.AspNetCore;
using OpenIddict.Server.AspNetCore;
using OpenIddict.Validation.AspNetCore;
using Quartz;
using static OpenIddict.Abstractions.OpenIddictConstants;
using static OpenIddict.Client.WebIntegration.OpenIddictClientWebIntegrationConstants;

var builder = WebApplication.CreateBuilder(args);

Expand Down Expand Up @@ -161,7 +161,7 @@ await using (var scope = app.Services.CreateAsyncScope())
app.MapMethods("callback/login/github", [HttpMethods.Get, HttpMethods.Post], async (HttpContext context) =>
{
// Resolve the claims extracted by OpenIddict from the userinfo response returned by GitHub.
var result = await context.AuthenticateAsync(OpenIddictClientAspNetCoreDefaults.AuthenticationScheme);
var result = await context.AuthenticateAsync(Providers.GitHub);
var identity = new ClaimsIdentity(
authenticationType: "ExternalLogin",
Expand Down Expand Up @@ -195,7 +195,7 @@ await using (var scope = app.Services.CreateAsyncScope())
RedirectUri = context.Request.GetEncodedUrl()
};
return Results.Challenge(properties, [OpenIddictClientAspNetCoreDefaults.AuthenticationScheme]);
return Results.Challenge(properties, [Providers.GitHub]);
}
var identifier = principal.FindFirst(ClaimTypes.NameIdentifier)!.Value;
Expand Down
3 changes: 1 addition & 2 deletions samples/Mortis/Mortis.Client/App_Start/BundleConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Web;
using System.Web.Optimization;
using System.Web.Optimization;

namespace Mortis.Client
{
Expand Down
3 changes: 1 addition & 2 deletions samples/Mortis/Mortis.Client/App_Start/FilterConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc;

namespace Mortis.Client
{
Expand Down
6 changes: 1 addition & 5 deletions samples/Mortis/Mortis.Client/App_Start/RouteConfig.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc;
using System.Web.Routing;

namespace Mortis.Client
Expand Down
6 changes: 1 addition & 5 deletions samples/Mortis/Mortis.Client/Global.asax.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

Expand Down
3 changes: 1 addition & 2 deletions samples/Mortis/Mortis.Server/App_Start/BundleConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Web;
using System.Web.Optimization;
using System.Web.Optimization;

namespace Mortis.Server
{
Expand Down
3 changes: 1 addition & 2 deletions samples/Mortis/Mortis.Server/App_Start/FilterConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc;

namespace Mortis.Server
{
Expand Down
4 changes: 0 additions & 4 deletions samples/Mortis/Mortis.Server/App_Start/IdentityConfig.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Globalization;
using System.Linq;
using System.Security.Claims;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.IdentityModel.Tokens;
using Microsoft.Owin.Security;
using Mortis.Server.Helpers;
using Mortis.Server.ViewModels.Authorization;
Expand Down
6 changes: 1 addition & 5 deletions samples/Mortis/Mortis.Server/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc;

namespace Mortis.Server.Controllers
{
Expand Down
3 changes: 1 addition & 2 deletions samples/Mortis/Mortis.Server/Controllers/ManageController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Mvc;
using OpenIddict.Abstractions;
using OpenIddict.Client.AspNetCore;
Expand Down
2 changes: 0 additions & 2 deletions samples/Zirku/Zirku.Client1/InteractiveService.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using OpenIddict.Abstractions;
using OpenIddict.Client;
using static OpenIddict.Abstractions.OpenIddictConstants;
using static OpenIddict.Abstractions.OpenIddictExceptions;
Expand Down

0 comments on commit e5adebc

Please sign in to comment.