Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External Authentication Feature #16721

Merged
merged 40 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0c24e35
External User Authentication Feature
MikeAlhayek Sep 13, 2024
cd96228
the feature is not discoverble
MikeAlhayek Sep 14, 2024
0448e58
Update dependencies
MikeAlhayek Sep 14, 2024
02d73cb
Fix tests
MikeAlhayek Sep 15, 2024
2d9c8b2
fix build
MikeAlhayek Sep 15, 2024
bce3e34
Merge branch 'main' into ma/external-login-feature
MikeAlhayek Sep 16, 2024
a348814
Fix the invalid link in docs
MikeAlhayek Sep 16, 2024
5b2969f
update startup
MikeAlhayek Sep 16, 2024
93568e7
Merge branch 'ma/external-login-feature' of https://github.com/Orchar…
MikeAlhayek Sep 16, 2024
5036ebd
fix docs
MikeAlhayek Sep 16, 2024
cab5012
Merge branch 'main' into ma/external-login-feature
MikeAlhayek Sep 16, 2024
cb358cb
use options to cleanup code
MikeAlhayek Sep 16, 2024
0d8f905
Merge branch 'ma/external-login-feature' of https://github.com/Orchar…
MikeAlhayek Sep 16, 2024
ddd0e7e
Merge branch 'main' into ma/external-login-feature
MikeAlhayek Sep 16, 2024
11bdb88
Update release notes.
MikeAlhayek Sep 16, 2024
6b509d2
seal class
MikeAlhayek Sep 16, 2024
492f69b
Merge branch 'main' into ma/external-login-feature
MikeAlhayek Sep 16, 2024
9eb21ec
Update src/OrchardCore.Modules/OrchardCore.Users/Manifest.cs
MikeAlhayek Sep 17, 2024
34ee37a
update titles
MikeAlhayek Sep 17, 2024
b0feaa3
update
MikeAlhayek Sep 17, 2024
b65bd79
Merge branch 'main' into ma/external-login-feature
MikeAlhayek Sep 17, 2024
e08d177
Update 2.1.0.md
MikeAlhayek Sep 17, 2024
98754f7
add settings to the UI
MikeAlhayek Sep 17, 2024
a85acdb
update docs
MikeAlhayek Sep 17, 2024
30c36e4
fix conflict
MikeAlhayek Sep 17, 2024
210b025
Simplify settings and fix some bugs
MikeAlhayek Sep 17, 2024
03245eb
simplify
MikeAlhayek Sep 17, 2024
02501cd
remove AllowSiteRegistration options
MikeAlhayek Sep 17, 2024
5f5eef2
EnabledByDependencyOnly
MikeAlhayek Sep 17, 2024
97b910b
don't use obsolete properties
MikeAlhayek Sep 17, 2024
af90910
clean up and fix NRE
MikeAlhayek Sep 17, 2024
b98057c
Add DisableNewRegistrations settings
MikeAlhayek Sep 17, 2024
92bede7
Removing unnecessary namespace import
Piedone Sep 18, 2024
a76fa95
Update src/OrchardCore.Modules/OrchardCore.Users/Views/ExternalRegist…
MikeAlhayek Sep 18, 2024
5708db1
Update src/docs/releases/2.1.0.md
MikeAlhayek Sep 18, 2024
0d5b6cd
address feedback
MikeAlhayek Sep 18, 2024
03e7a53
Merge branch 'main' into ma/external-login-feature
MikeAlhayek Sep 18, 2024
9e2897a
Merge branch 'main' into ma/external-login-feature
MikeAlhayek Sep 18, 2024
f592361
Merge branch 'main' into ma/external-login-feature
MikeAlhayek Sep 18, 2024
04812f7
improve DisableNewRegistrations migration logic
MikeAlhayek Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/OrchardCore.Modules/OrchardCore.Facebook/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
Description = "Authenticates users from Meta.",
Dependencies =
[
FacebookConstants.Features.Core
FacebookConstants.Features.Core,
"OrchardCore.Users.ExternalAuthentication",
]
)]

Expand Down
6 changes: 5 additions & 1 deletion src/OrchardCore.Modules/OrchardCore.GitHub/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@
Id = GitHubConstants.Features.GitHubAuthentication,
Name = "GitHub Authentication",
Category = "GitHub",
Description = "Authenticates users with their GitHub Account."
Description = "Authenticates users with their GitHub Account.",
Dependencies =
[
"OrchardCore.Users.ExternalAuthentication",
]
)]
6 changes: 5 additions & 1 deletion src/OrchardCore.Modules/OrchardCore.Google/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
Id = GoogleConstants.Features.GoogleAuthentication,
Name = "Google Authentication",
Category = "Google",
Description = "Authenticates users with their Google Account."
Description = "Authenticates users with their Google Account.",
Dependencies =
[
"OrchardCore.Users.ExternalAuthentication",
]
)]

[assembly: Feature(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@
Id = MicrosoftAuthenticationConstants.Features.MicrosoftAccount,
Name = "Microsoft Account Authentication",
Category = "Microsoft Authentication",
Description = "Authenticates users with their Microsoft Account."
Description = "Authenticates users with their Microsoft Account.",
Dependencies =
[
"OrchardCore.Users.ExternalAuthentication",
]
)]

[assembly: Feature(
Id = MicrosoftAuthenticationConstants.Features.AAD,
Name = "Microsoft Entra ID (Azure Active Directory) Authentication",
Category = "Microsoft Authentication",
Description = "Authenticates users with their Microsoft Entra ID Account."
Description = "Authenticates users with their Microsoft Entra ID Account.",
Dependencies =
[
"OrchardCore.Users.ExternalAuthentication",
]
)]
1 change: 1 addition & 0 deletions src/OrchardCore.Modules/OrchardCore.OpenId/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Dependencies =
[
OpenIdConstants.Features.Core,
"OrchardCore.Users.ExternalAuthentication",
]
)]

Expand Down
6 changes: 5 additions & 1 deletion src/OrchardCore.Modules/OrchardCore.Twitter/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@
Name = "Sign in with X (Twitter)",
Category = "X (Twitter)",
Description = "Authenticates users with their X (Twitter) Account.",
Dependencies = [TwitterConstants.Features.Twitter]
Dependencies =
[
TwitterConstants.Features.Twitter,
"OrchardCore.Users.ExternalAuthentication",
]
)]
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using OrchardCore.Users.Models;
using OrchardCore.Workflows.Services;

Expand Down Expand Up @@ -36,4 +37,24 @@ protected IActionResult RedirectToLocal(string returnUrl)

return Redirect("~/");
}

protected void CopyTempDataErrorsToModelState()
{
foreach (var errorMessage in TempData.Where(x => x.Key.StartsWith("error")).Select(x => x.Value.ToString()))
{
ModelState.AddModelError(string.Empty, errorMessage);
}
}

MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
protected bool AddUserEnabledError(IUser user, IStringLocalizer S)
{
if (user is not User localUser || !localUser.IsEnabled)
{
ModelState.AddModelError(string.Empty, S["The specified user is not allowed to sign in."]);

return true;
}

return false;
}
}
Loading