GetProfileMappings(int portalId);
9 | ProfileMapping GetProfileMapping(string dnnProfilePropertyName, int portalId);
10 | void UpdateProfileMapping(string dnnProfilePropertyName, string b2cClaimName, int portalId);
11 | void InsertProfileMapping(string dnnProfilePropertyName, string b2cClaimName, int portalId);
12 | void DeleteProfileMapping(string dnnProfilePropertyName, int portalId);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/globals/application.js:
--------------------------------------------------------------------------------
1 | import utilities from "../utils";
2 | const boilerPlate = {
3 | init() {
4 | // This setting is required and define the public path
5 | // to allow the web application to download assets on demand
6 | // eslint-disable-next-line no-undef
7 | // __webpack_public_path__ = options.publicPath;
8 | let options = window.dnn.initAzureADB2C();
9 |
10 | utilities.init(options.utility);
11 | utilities.moduleName = options.moduleName;
12 |
13 | },
14 | dispatch() {
15 | throw new Error("dispatch method needs to be overwritten from the Redux store");
16 | }
17 | };
18 |
19 |
20 | export default boilerPlate;
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/App_Start/RouteConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Mvc;
6 | using System.Web.Routing;
7 |
8 | namespace TaskWebApp
9 | {
10 | public class RouteConfig
11 | {
12 | public static void RegisterRoutes(RouteCollection routes)
13 | {
14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
15 |
16 | routes.MapRoute(
17 | name: "Default",
18 | url: "{controller}/{action}/{id}",
19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
20 | );
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/App_Start/RouteConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Mvc;
6 | using System.Web.Routing;
7 |
8 | namespace TaskService
9 | {
10 | public class RouteConfig
11 | {
12 | public static void RegisterRoutes(RouteCollection routes)
13 | {
14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
15 |
16 | routes.MapRoute(
17 | name: "Default",
18 | url: "{controller}/{action}/{id}",
19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
20 | );
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/main.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { render } from "react-dom";
3 | import { Provider } from "react-redux";
4 | import application from "./globals/application";
5 | import configureStore from "./store/configureStore";
6 | import Root from "./containers/Root";
7 |
8 | let store = configureStore({enabled: false, instrumentationKey: ""});
9 |
10 | application.dispatch = store.dispatch;
11 |
12 | const appContainer = document.getElementById("azureADB2C-container");
13 | const initCallback = appContainer.getAttribute("data-init-callback");
14 | application.init(initCallback);
15 |
16 | render(
17 |
18 |
19 | ,
20 | appContainer
21 | );
22 |
23 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/App_Start/WebApiConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web.Http;
5 |
6 | namespace TaskService
7 | {
8 | public static class WebApiConfig
9 | {
10 | public static void Register(HttpConfiguration config)
11 | {
12 | // Web API configuration and services
13 | config.EnableCors();
14 |
15 | // Web API routes
16 | config.MapHttpAttributeRoutes();
17 |
18 | config.Routes.MapHttpRoute(
19 | name: "DefaultApi",
20 | routeTemplate: "api/{controller}/{id}",
21 | defaults: new { id = RouteParameter.Optional }
22 | );
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/samples/ChromeExtension/src/background.js:
--------------------------------------------------------------------------------
1 | chrome.runtime.onInstalled.addListener(function() {
2 |
3 | // Only enable the addon when browsing a specific website
4 | chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
5 | chrome.declarativeContent.onPageChanged.addRules([{
6 | conditions: [
7 | new chrome.declarativeContent.PageStateMatcher({
8 | pageUrl: {hostEquals: 'intelequia.com'},
9 | }),
10 | new chrome.declarativeContent.PageStateMatcher({
11 | pageUrl: {hostEquals: 'github.com'},
12 | })
13 | ],
14 | actions: [new chrome.declarativeContent.ShowPageAction()]
15 | }]);
16 | });
17 | });
18 |
19 | var version = "1.0";
20 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Mvc;
6 |
7 | namespace TaskWebApp.Controllers
8 | {
9 | public class HomeController : Controller
10 | {
11 | public ActionResult Index()
12 | {
13 | return View();
14 | }
15 |
16 | [Authorize]
17 | public ActionResult Claims()
18 | {
19 | ViewBag.Message = "Your application description page.";
20 | return View();
21 | }
22 |
23 | public ActionResult Error(string message)
24 | {
25 | ViewBag.Message = message;
26 |
27 | return View("Error");
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/Global.asax.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.Http;
6 | using System.Web.Mvc;
7 | using System.Web.Optimization;
8 | using System.Web.Routing;
9 |
10 | namespace TaskService
11 | {
12 | public class WebApiApplication : System.Web.HttpApplication
13 | {
14 | protected void Application_Start()
15 | {
16 | AreaRegistration.RegisterAllAreas();
17 | GlobalConfiguration.Configure(WebApiConfig.Register);
18 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
19 | RouteConfig.RegisterRoutes(RouteTable.Routes);
20 | BundleConfig.RegisterBundles(BundleTable.Bundles);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/samples/SPA-WebAPI-Client/Components/DnnB2CWebViewPage.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 |
3 | namespace Dnn.Modules.B2CTasksSPA_WebAPI_Client.Components
4 | {
5 | public class DnnB2CWebViewPage : DotNetNuke.Web.Mvc.Framework.DnnWebViewPage
6 | {
7 | public string AuthToken {
8 | get
9 | {
10 | var token = Request?.Cookies["AzureB2CUserToken"]?.Value;
11 | if (token != null && token.Contains("oauth_token="))
12 | {
13 | token = token.Split('&').FirstOrDefault(x => x.Contains("oauth_token="))?.Substring("oauth_token=".Length);
14 | }
15 | return token;
16 | }
17 | }
18 | public override void Execute()
19 | {
20 | base.ExecutePageHierarchy();
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/components/svg/error.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/samples/Hello/readme.md:
--------------------------------------------------------------------------------
1 | # How to setup this ROPC example
2 |
3 | This is an example application that allows the user to login into Azure AD B2C directory
4 | to obtain a JWT token, and then call a DNN Website that has been setup with the
5 | DNN Azure AD B2C Auth provider
6 | You need to:
7 | 1. [Create a ROPC policy in B2C](https://docs.microsoft.com/es-es/azure/active-directory-b2c/configure-ropc?tabs=applications#create-a-resource-owner-user-flow) and ensure you specify the "emails" claim on the policy
8 | 2. [Register an application in B2C](https://docs.microsoft.com/es-es/azure/active-directory-b2c/configure-ropc?tabs=applications#register-an-application)
9 | 3. Setup the DNN portal to enable the JWT Authorization through the advanced settings of the module, and add the APPLICATION ID to the list of valid audiences
10 |
11 | More info at https://docs.microsoft.com/es-es/azure/active-directory-b2c/configure-ropc
12 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Components/Models/RoleMapping.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Web.Caching;
3 | using DotNetNuke.ComponentModel.DataAnnotations;
4 |
5 | namespace DotNetNuke.Authentication.Azure.B2C.Components.Models
6 | {
7 | [TableName("AzureB2C_RoleMappings")]
8 | //setup the primary key for table
9 | [PrimaryKey("RoleMappingId", AutoIncrement = true)]
10 | //configure caching using PetaPoco
11 | [Cacheable("RoleMapping", CacheItemPriority.Default, 20)]
12 | public class RoleMapping
13 | {
14 | public int RoleMappingId { get; set; }
15 |
16 | public string DnnRoleName { get; set; }
17 | public string B2cRoleName { get; set; }
18 | public int PortalId { get; set; }
19 | public int CreatedByUserId { get; set; }
20 | public DateTime CreatedOnDate { get; set; }
21 | public int LastModifiedByUserId { get; set; }
22 | public DateTime LastModifiedOnDate { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Views/Tasks/Index.cshtml:
--------------------------------------------------------------------------------
1 |
2 | @{
3 | ViewBag.Title = "To-Do List";
4 | }
5 |
6 | To-Do List
7 |
8 | @using (Html.BeginForm("Create", "Tasks", FormMethod.Post))
9 | {
10 |
11 | New Item:
12 |
13 |
14 | }
15 |
16 |
17 |
18 |
19 |
20 |
21 | Items:
22 |
23 |
24 | @foreach (var item in ViewBag.Tasks)
25 | {
26 |
27 |
28 | @using (Html.BeginForm("Delete", "Tasks", FormMethod.Post))
29 | {
30 | @item["Text"]
31 | Delete
32 | }
33 |
34 |
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Providers/DataProviders/SqlDataProvider/01.07.02.SqlDataProvider:
--------------------------------------------------------------------------------
1 | IF NOT EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND OBJECT_ID = OBJECT_ID('{databaseOwner}{objectQualifier}AzureB2C_GetExpiredUserRoles'))
2 | exec('CREATE PROCEDURE {databaseOwner}[{objectQualifier}AzureB2C_GetExpiredUserRoles] AS BEGIN SET NOCOUNT ON; END')
3 | GO
4 |
5 | ALTER PROCEDURE {databaseOwner}[{objectQualifier}AzureB2C_GetExpiredUserRoles]
6 | @PortalId INT
7 | AS
8 | BEGIN
9 | SET NOCOUNT ON;
10 |
11 | SELECT
12 | u.UserID,
13 | u.Email,
14 | r.RoleID,
15 | r.RoleName,
16 | ur.ExpiryDate
17 | FROM
18 | dbo.UserRoles ur
19 | INNER JOIN
20 | dbo.Users u ON ur.UserID = u.UserID
21 | INNER JOIN
22 | dbo.Roles r ON ur.RoleID = r.RoleID
23 | WHERE
24 | r.PortalID = 0
25 | AND r.IsSystemRole = 0
26 | AND ur.ExpiryDate IS NOT NULL
27 | AND ur.ExpiryDate > DATEADD(HOUR, -24, GETDATE())
28 | AND ur.ExpiryDate <= GETDATE()
29 |
30 |
31 | END
32 | GO
33 |
34 | -- comment
--------------------------------------------------------------------------------
/samples/ChromeExtension/src/policies.js:
--------------------------------------------------------------------------------
1 | // Enter here the user flows and custom policies for your B2C application
2 | // To learn more about user flows, visit https://docs.microsoft.com/en-us/azure/active-directory-b2c/user-flow-overview
3 | // To learn more about custom policies, visit https://docs.microsoft.com/en-us/azure/active-directory-b2c/custom-policy-overview
4 |
5 | const b2cPolicies = {
6 | names: {
7 | signUpSignIn: "b2c_1_signup",
8 | forgotPassword: "b2c_1_passwordreset",
9 | editProfile: "b2c_1_profile"
10 | },
11 | authorities: {
12 | signUpSignIn: {
13 | authority: "https://mytenant.b2clogin.com/mytenant.onmicrosoft.com/b2c_1_signup",
14 | },
15 | forgotPassword: {
16 | authority: "https://mytenant.b2clogin.com/mytenant.onmicrosoft.com/b2c_1_passwordreset",
17 | },
18 | editProfile: {
19 | authority: "https://mytenant.b2clogin.com/mytenant.onmicrosoft.com/b2c_1_profile"
20 | }
21 | },
22 | }
--------------------------------------------------------------------------------
/samples/SPA-WebAPI-Client/Controllers/ItemController.cs:
--------------------------------------------------------------------------------
1 | /*
2 | ' Copyright (c) 2019 Intelequia
3 | ' All rights reserved.
4 | '
5 | ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
6 | ' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
7 | ' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
8 | ' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
9 | ' DEALINGS IN THE SOFTWARE.
10 | '
11 | */
12 |
13 | using System.Web.Mvc;
14 | using DotNetNuke.Web.Mvc.Framework.Controllers;
15 | using DotNetNuke.Web.Mvc.Framework.ActionFilters;
16 | using System.Linq;
17 |
18 | namespace Dnn.Modules.B2CTasksSPA_WebAPI_Client.Controllers
19 | {
20 | [DnnHandleError]
21 | public class ItemController : DnnController
22 | {
23 | public ActionResult Index()
24 | {
25 | return View();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/docs/images/BadgeRelease.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | release
14 | release
15 | v1.8.0
16 | v1.8.0
17 |
18 |
19 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/constants/actionTypes/settings.js:
--------------------------------------------------------------------------------
1 | const settingsActionTypes = {
2 | SWITCH_TAB: "SWITCH_TAB",
3 | RETRIEVED_SETTINGS: "RETRIEVED_SETTINGS",
4 | UPDATED_SETTINGS: "UPDATED_SETTINGS",
5 | UPDATED_PROFILEMAPPING: "UPDATED_PROFILEMAPPING",
6 | SETTINGS_CLIENT_MODIFIED: "SETTINGS_CLIENT_MODIFIED",
7 | RETRIEVED_PROFILESETTINGS: "RETRIEVED_PROFILESETTINGS",
8 | RETRIEVED_PROFILEPROPERTIES: "RETRIEVED_PROFILEPROPERTIES",
9 | CANCELLED_PROFILEMAPPING_CLIENT_MODIFIED: "CANCELLED_PROFILEMAPPING_CLIENT_MODIFIED",
10 | PROFILEMAPPINGS_CLIENT_MODIFIED: "PROFILEMAPPINGS_CLIENT_MODIFIED",
11 | SWITCH_MAPPING_SUBTAB: "SWITCH_MAPPING_SUBTAB",
12 | RETRIEVED_ROLEMAPPINGSETTINGS: "RETRIEVED_ROLEMAPPINGSETTINGS",
13 | RETRIEVED_AVAILABLEROLES: "RETRIEVED_AVAILABLEROLES",
14 | ROLEMAPPINGS_CLIENT_MODIFIED: "ROLEMAPPINGS_CLIENT_MODIFIED",
15 | RETRIEVED_USERMAPPINGSETTINGS: "RETRIEVED_USERMAPPINGSETTINGS",
16 | USERMAPPINGS_CLIENT_MODIFIED: "USERMAPPINGS_CLIENT_MODIFIED"
17 | };
18 | export default settingsActionTypes;
--------------------------------------------------------------------------------
/samples/Hello/Hello.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29001.49
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hello", "Hello.csproj", "{DEB12BEC-09B5-466F-9264-0D27945E33D8}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {DEB12BEC-09B5-466F-9264-0D27945E33D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {DEB12BEC-09B5-466F-9264-0D27945E33D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {DEB12BEC-09B5-466F-9264-0D27945E33D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {DEB12BEC-09B5-466F-9264-0D27945E33D8}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {C108D897-D092-4E06-891A-D887DAE8292D}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Providers/DataProviders/SqlDataProvider/01.00.00.SqlDataProvider:
--------------------------------------------------------------------------------
1 | IF NOT EXISTS (SELECT * FROM {databaseOwner}[{objectQualifier}Schedule] WHERE TypeFullName = 'DotNetNuke.Authentication.Azure.B2C.ScheduledTasks.SyncSchedule, DotNetNuke.Authentication.Azure.B2C')
2 | BEGIN
3 | INSERT INTO {databaseOwner}[{objectQualifier}Schedule]
4 | ([TypeFullName]
5 | ,[TimeLapse]
6 | ,[TimeLapseMeasurement]
7 | ,[RetryTimeLapse]
8 | ,[RetryTimeLapseMeasurement]
9 | ,[RetainHistoryNum]
10 | ,[AttachToEvent]
11 | ,[CatchUpEnabled]
12 | ,[Enabled]
13 | ,[ObjectDependencies]
14 | ,[Servers]
15 | ,[CreatedByUserID]
16 | ,[CreatedOnDate]
17 | ,[LastModifiedByUserID]
18 | ,[LastModifiedOnDate]
19 | ,[FriendlyName])
20 | VALUES
21 | ('DotNetNuke.Authentication.Azure.B2C.ScheduledTasks.SyncSchedule, DotNetNuke.Authentication.Azure.B2C',
22 | 3, 'h',
23 | 30, 'm',
24 | 10,
25 | '', 'false', 'true',
26 | '', NULL,
27 | NULL, NULL,
28 | NULL, NULL,
29 | 'Azure AD B2C Sync')
30 | END
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Intelequia Software Solutions. All rights reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
22 |
--------------------------------------------------------------------------------
/samples/SPA-WebAPI-Client/SPA-WebAPI-Client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29009.5
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPA-WebAPI-Client", "SPA-WebAPI-Client.csproj", "{4130D773-4930-4C21-9BCF-0C5244F585D0}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {4130D773-4930-4C21-9BCF-0C5244F585D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {4130D773-4930-4C21-9BCF-0C5244F585D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {4130D773-4930-4C21-9BCF-0C5244F585D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {4130D773-4930-4C21-9BCF-0C5244F585D0}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {44A9EFB5-E42B-4E60-819C-6B7617C4BAEB}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Views/Shared/_LoginPartial.cshtml:
--------------------------------------------------------------------------------
1 | @if (Request.IsAuthenticated)
2 | {
3 |
4 |
5 |
6 | @User.Identity.Name
7 |
8 |
9 |
10 | @Html.ActionLink("Edit Profile", "EditProfile", "Account")
11 |
12 |
13 | @Html.ActionLink("Reset Password", "ResetPassword", "Account")
14 |
15 |
16 |
17 |
18 |
19 | @Html.ActionLink("Sign out", "SignOut", "Account")
20 |
21 |
22 |
23 | }
24 | else
25 | {
26 |
27 | @Html.ActionLink("Sign up / Sign in", "SignUpSignIn", "Account", routeValues: null, htmlAttributes: new { id = "signUpSignInLink" })
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Images/google.svg:
--------------------------------------------------------------------------------
1 | Asset 56
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/module.css:
--------------------------------------------------------------------------------
1 | ul.buttonList .azureb2c a span {
2 | padding-left: 45px;
3 | background: url('images/azure-login.png') no-repeat 6px 7px;
4 | }
5 | ul.buttonList .azureb2c a:after {
6 | position: absolute;
7 | left: 35px;
8 | top: 0;
9 | height: 100%;
10 | width: 0;
11 | content: "";
12 | border-left: 1px solid rgba(0,0,0,0.2);
13 | border-right: 1px solid rgba(255,255,255,0.3);
14 | }
15 |
16 |
17 | /*AZURE*/
18 | ul.buttonList li.azureb2c a {
19 | background: #8851a3 url(images/azure-bg.png) repeat-x;
20 | }
21 | ul.buttonList .azureb2c a {
22 | color: #fff;
23 | text-shadow: 0px -1px 0px rgba(0,0,0,0.4);
24 | border-color: #6f4285; /* dark teal blue */
25 | background-position: 0;
26 | background-color: #8851a3;
27 | }
28 | ul.buttonList .azureb2c a:hover {
29 | color: #fff;
30 | border-color: #6f4285; /* dark teal blue */
31 | text-shadow: 0px -1px 0px rgba(0,0,0,0.4);
32 | background-position: 0 -50px;
33 | background-color: #a97ebf;
34 | }
35 | ul.buttonList .azureb2c a:active {
36 | background-position: 0 -100px;
37 | border-color: #6f4285; /* dark teal blue */
38 | background-color: #6f4285;
39 | }
40 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2CLicense.txt:
--------------------------------------------------------------------------------
1 | Intelequia Software Solutions
2 | Copyright (c) 2010-2023 by Intelequia Software Solutions
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Microsoft Corporation. All rights reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
22 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/App_Start/BundleConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Web;
2 | using System.Web.Optimization;
3 |
4 | namespace TaskWebApp
5 | {
6 | public class BundleConfig
7 | {
8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
9 | public static void RegisterBundles(BundleCollection bundles)
10 | {
11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
12 | "~/Scripts/jquery-{version}.js"));
13 |
14 | // Use the development version of Modernizr to develop with and learn from. Then, when you're
15 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
16 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
17 | "~/Scripts/modernizr-*"));
18 |
19 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
20 | "~/Scripts/bootstrap.js",
21 | "~/Scripts/respond.js"));
22 |
23 | bundles.Add(new StyleBundle("~/Content/css").Include(
24 | "~/Content/bootstrap.css",
25 | "~/Content/site.css"));
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/samples/ChromeExtension/src/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "TodoList B2C Example",
3 | "description": "Example to illustrate how to login into Azure AD B2C to obtain a token and consume a secured WebAPI",
4 | "version": "1.0",
5 | "permissions": [
6 | "debugger",
7 | "declarativeContent",
8 | "storage"
9 | ],
10 | "background": {
11 | "scripts": ["background.js"],
12 | "persistent": true
13 | },
14 | "page_action": {
15 | "default_popup": "todolist.html",
16 | "default_icon": {
17 | "16": "b2c16.png",
18 | "32": "b2c32.png",
19 | "64": "b2c64.png",
20 | "128": "b2c128.png"
21 | },
22 | "default_title": "TodoList B2C Example"
23 | },
24 | "icons": {
25 | "16": "b2c16.png",
26 | "32": "b2c32.png",
27 | "64": "b2c64.png",
28 | "128": "b2c128.png"
29 | },
30 | "manifest_version": 2,
31 | "incognito": "split",
32 | "web_accessible_resources": ["todolist.html"],
33 | "content_security_policy": "script-src 'self' https://ajax.googleapis.com https://alcdn.msauth.net/ https://code.jquery.com/ https://cdn.jsdelivr.net https://stackpath.bootstrapcdn.com/ https://cdnjs.cloudflare.com; object-src 'self'"
34 | }
35 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Components/B2CControllerConfiguration.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.IdentityModel.Protocols.OpenIdConnect;
2 |
3 | namespace DotNetNuke.Authentication.Azure.B2C.Components
4 | {
5 | public class B2CControllerConfiguration
6 | {
7 | public string RopcPolicyName { get; set; }
8 | public OpenIdConnectConfiguration OpenIdConfig { get; set; }
9 |
10 | public B2CControllerConfiguration(string ropcPolicyName, OpenIdConnectConfiguration config)
11 | {
12 | RopcPolicyName = ropcPolicyName;
13 | OpenIdConfig = config;
14 | }
15 |
16 | ///
17 | /// This is to check if the current OpenIdConnectConfiguration is still valid. If the value of the ROPC
18 | /// policy has been changed by the user, this configuration is not valid anymore
19 | ///
20 | public bool IsValid(AzureConfig azureB2cConfig, string defaultRopcPolicy)
21 | {
22 | if (RopcPolicyName.ToLower() == azureB2cConfig.RopcPolicy.ToLower())
23 | return true;
24 |
25 | if (RopcPolicyName.ToLower() == defaultRopcPolicy.ToLower() && string.IsNullOrEmpty(azureB2cConfig.RopcPolicy))
26 | return true;
27 |
28 | return false;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | "plugins": [
3 | "react",
4 | ],
5 | "env": {
6 | "browser": true,
7 | "commonjs": true
8 | },
9 | "extends": ["eslint:recommended", "plugin:react/recommended"],
10 | "settings": {
11 | "react": {
12 | "version": "16"
13 | }
14 | },
15 | "parserOptions": {
16 | "ecmaFeatures": {
17 | "jsx": true
18 | },
19 | "ecmaVersion": 2018,
20 | "sourceType": "module"
21 | },
22 | "globals": {
23 | "__": false,
24 | "Promise": false,
25 | "VERSION": false,
26 | "process": false
27 | },
28 | "rules": {
29 | "semi": "error",
30 | "no-var": "error",
31 | "quotes": ["warn", "double" ],
32 | "indent": ["warn", 4, {"SwitchCase": 1}],
33 | "no-unused-vars": "warn",
34 | "no-console": "warn",
35 | "keyword-spacing": "warn",
36 | "eqeqeq": "warn",
37 | "space-before-function-paren": ["warn", { "anonymous": "always", "named": "never" }],
38 | "space-before-blocks": "warn",
39 | "no-multiple-empty-lines": "warn",
40 | "react/jsx-equals-spacing": ["warn", "never"],
41 | "id-match": ["error", "^([A-Za-z0-9_])+$", {"properties": true}]
42 | }
43 | };
44 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Settings.ascx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Este código fue generado por una herramienta.
4 | //
5 | // Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
6 | // se vuelve a generar el código.
7 | //
8 | //------------------------------------------------------------------------------
9 |
10 | namespace DotNetNuke.Authentication.Azure.B2C {
11 |
12 |
13 | public partial class Settings {
14 |
15 | #pragma warning disable CS0108 // Member hides inherited member; missing new keyword
16 | ///
17 | /// Control SettingsEditor.
18 | ///
19 | ///
20 | /// Campo generado automáticamente.
21 | /// Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
22 | ///
23 | protected global::DotNetNuke.UI.WebControls.PropertyEditorControl SettingsEditor;
24 | #pragma warning restore CS0108 // Member hides inherited member; missing new keyword
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/samples/SPA-WebAPI-Client/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
--------------------------------------------------------------------------------
/samples/SPA-WebAPI-Client/License.txt:
--------------------------------------------------------------------------------
1 |
2 |
License
3 |
4 | Intelequia https://intelequia.com
5 | Copyright (c) 2019
6 | by Intelequia
7 |
8 |
9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
10 | documentation files (the "Software"), to deal in the Software without restriction, including without limitation
11 | the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
12 | to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13 |
14 |
15 | The above copyright notice and this permission notice shall be included in all copies or substantial portions
16 | of the Software.
17 |
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 |
21 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/samples/ChromeExtension/src/authConfig.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Config object to be passed to MSAL on creation.
4 | * For a full list of msal.js configuration parameters,
5 | * visit https://azuread.github.io/microsoft-authentication-library-for-js/docs/msal/modules/_configuration_.html
6 | * */
7 |
8 |
9 | const msalConfig = {
10 | auth: {
11 | clientId: "611dc285-7d91-48b4-b683-4a391815b08f",
12 | authority: b2cPolicies.authorities.signUpSignIn.authority,
13 | validateAuthority: false
14 | },
15 | cache: {
16 | cacheLocation: "localStorage", // This configures where your cache will be stored
17 | storeAuthStateInCookie: false // Set this to "true" to save cache in cookies to address trusted zones limitations in IE (see: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/Known-issues-on-IE-and-Edge-Browser)
18 | }
19 | };
20 |
21 | /**
22 | * Scopes you enter here will be consented once you authenticate. For a full list of available authentication parameters,
23 | * visit https://azuread.github.io/microsoft-authentication-library-for-js/docs/msal/modules/_authenticationparameters_.html
24 | */
25 | const loginRequest = {
26 | scopes: ["openid", "profile"]
27 | };
28 |
29 | // Add here scopes for access token to be used at the API endpoints.
30 | const tokenRequest = {
31 | scopes: apiConfig.b2cScopes, // e.g. ["https://fabrikamb2c.onmicrosoft.com/helloapi/demo.read"]
32 | };
33 |
--------------------------------------------------------------------------------
/samples/SPA-WebAPI-Client/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/samples/SPA-WebAPI-Client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("SPA_WebAPI_Client")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("SPA_WebAPI_Client")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("5ef01dd5-84a1-49f3-9232-067440288455")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Revision and Build Numbers
32 | // by using the '*' as shown below:
33 | [assembly: AssemblyVersion("00.00.02.*")]
34 | [assembly: AssemblyFileVersion("00.00.02.*")]
35 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/App_Start/BundleConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Web;
2 | using System.Web.Optimization;
3 |
4 | namespace TaskService
5 | {
6 | public class BundleConfig
7 | {
8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
9 | public static void RegisterBundles(BundleCollection bundles)
10 | {
11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
12 | "~/Scripts/jquery-{version}.js"));
13 |
14 | // Use the development version of Modernizr to develop with and learn from. Then, when you're
15 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
16 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
17 | "~/Scripts/modernizr-*"));
18 |
19 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
20 | "~/Scripts/bootstrap.js",
21 | "~/Scripts/respond.js"));
22 |
23 | bundles.Add(new StyleBundle("~/Content/css").Include(
24 | "~/Content/bootstrap.css",
25 | "~/Content/site.css"));
26 |
27 | // Set EnableOptimizations to false for debugging. For more information,
28 | // visit http://go.microsoft.com/fwlink/?LinkId=301862
29 | BundleTable.EnableOptimizations = true;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TaskService")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TaskService")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("a8b53cb6-e5b1-4c0e-bb63-b0c179dc368c")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TaskWebApp")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TaskWebApp")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("04859550-a63c-4b8e-85d1-e19407a5b6f8")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/Views/Home/Index.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
ASP.NET
3 |
ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript.
4 |
Learn more »
5 |
6 |
7 |
8 |
Getting started
9 |
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach
10 | a broad range of clients, including browsers and mobile devices. ASP.NET Web API
11 | is an ideal platform for building RESTful applications on the .NET Framework.
12 |
Learn more »
13 |
14 |
15 |
Get more libraries
16 |
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
17 |
Learn more »
18 |
19 |
20 |
Web Hosting
21 |
You can easily find a web hosting company that offers the right mix of features and price for your applications.
22 |
Learn more »
23 |
24 |
25 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Components/IB2CController.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 |
3 | //
4 | // Intelequia Software solutions - https://intelequia.com
5 | // Copyright (c) 2019
6 | // by Intelequia Software Solutions
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11 | // to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 | // of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 |
22 | #endregion
23 |
24 | using System.Net.Http;
25 |
26 | namespace DotNetNuke.Authentication.Azure.B2C.Components
27 | {
28 | public interface IB2CController
29 | {
30 | string SchemeType { get; }
31 | string ValidateToken(HttpRequestMessage request);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Views/Home/Index.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Home Page";
3 | }
4 |
5 |
6 |
ASP.NET
7 |
ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.
8 |
Learn more »
9 |
10 |
11 |
12 |
13 |
Getting started
14 |
15 | ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
16 | enables a clean separation of concerns and gives you full control over markup
17 | for enjoyable, agile development.
18 |
19 |
Learn more »
20 |
21 |
22 |
Get more libraries
23 |
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
24 |
Learn more »
25 |
26 |
27 |
Web Hosting
28 |
You can easily find a web hosting company that offers the right mix of features and price for your applications.
29 |
Learn more »
30 |
31 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewBag.Title
7 | @Styles.Render("~/Content/css")
8 | @Scripts.Render("~/bundles/modernizr")
9 |
10 |
11 |
12 |
13 |
21 |
22 |
23 | @Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)
24 |
25 |
26 |
27 |
28 |
29 | @RenderBody()
30 |
31 |
34 |
35 |
36 | @Scripts.Render("~/bundles/jquery")
37 | @Scripts.Render("~/bundles/bootstrap")
38 | @RenderSection("scripts", required: false)
39 |
40 |
41 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C.Extensibility/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("DotNetNuke.Authentication.Azure.B2C.Extensibility")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DotNetNuke.Authentication.Azure.B2C.Extensibility")]
13 | [assembly: AssemblyCopyright("Copyright © 2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("42445032-9098-4160-930d-4127dc292695")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Images/github.svg:
--------------------------------------------------------------------------------
1 | CxiFJ0.tif (2)
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Components/Graph/GraphServiceClientFactory.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Graph;
2 | using System;
3 | using System.Net.Http;
4 | using System.Net.Http.Headers;
5 | using System.Reflection;
6 | using System.Threading.Tasks;
7 |
8 | namespace DotNetNuke.Authentication.Azure.B2C.Components.Graph
9 | {
10 | internal static class GraphServiceClientFactory
11 | {
12 | public static GraphServiceClient GetAuthenticatedGraphClient(
13 | Func> acquireAccessToken)
14 | {
15 | return new GraphServiceClient(
16 | new CustomAuthenticationProvider(acquireAccessToken)
17 | );
18 | }
19 | }
20 |
21 | class CustomAuthenticationProvider : IAuthenticationProvider
22 | {
23 | private readonly Func> _acquireAccessToken;
24 | public CustomAuthenticationProvider(Func> acquireAccessToken)
25 | {
26 | _acquireAccessToken = acquireAccessToken;
27 | }
28 |
29 | public async Task AuthenticateRequestAsync(HttpRequestMessage requestMessage)
30 | {
31 | var accessToken = await _acquireAccessToken.Invoke();
32 |
33 | // Add the token in the Authorization header
34 | requestMessage.Headers.Authorization = new AuthenticationHeaderValue(
35 | "Bearer", accessToken
36 | );
37 | string version = CustomAttributeExtensions.GetCustomAttribute((Assembly.GetExecutingAssembly()))?.Version;
38 | requestMessage.Headers.Add("User-Agent", $"DNN Azure AD B2C Provider (v{version})");
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/samples/SPA-WebAPI-Client/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/components/roleMappings/roleMappingEditor/style.less:
--------------------------------------------------------------------------------
1 | @import "~@dnnsoftware/dnn-react-common/styles/index.less";
2 | .rolemapping-editor {
3 | float: left;
4 | margin: 20px 30px;
5 | .topMessage {
6 | border: 1px solid @alto;
7 | padding: 10px 20px;
8 | background-color: @mercury;
9 | margin: 0 0 20px 0;
10 | }
11 | .dnn-ui-common-input-group {
12 | padding: 0 0 15px 0;
13 | label {
14 | font-weight: bolder;
15 | float: left;
16 | }
17 | .dnn-label {
18 | margin: 8px 0;
19 | }
20 | .dnn-dropdown,.dnn-dropdown-with-error
21 | {
22 | width: 100% !important;
23 | box-sizing: border-box;
24 | }
25 | .dnn-single-line-input-with-error {
26 | width: 100% !important;
27 | }
28 | }
29 | .dnn-grid-system {
30 | .left-column {
31 | padding-right: 30px;
32 | border-right: 1px solid @alto;
33 | }
34 | .right-column {
35 | padding-left: 30px;
36 | border-left: 0 !important;
37 | }
38 | }
39 | .editor-buttons-box {
40 | width: 100%;
41 | text-align: center;
42 | float: left;
43 | margin: 30px 0 0 0;
44 | .dnn-ui-common-button {
45 | margin: 5px;
46 | }
47 | .edit-icon {
48 | margin: 0px 10px 20px 10px;
49 | float: right;
50 | svg {
51 | width: 16px;
52 | float: left;
53 | height: 16px;
54 | }
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/components/userMappings/userMappingEditor/style.less:
--------------------------------------------------------------------------------
1 | @import "~@dnnsoftware/dnn-react-common/styles/index.less";
2 | .usermapping-editor {
3 | float: left;
4 | margin: 20px 30px;
5 | .topMessage {
6 | border: 1px solid @alto;
7 | padding: 10px 20px;
8 | background-color: @mercury;
9 | margin: 0 0 20px 0;
10 | }
11 | .dnn-ui-common-input-group {
12 | padding: 0 0 15px 0;
13 | label {
14 | font-weight: bolder;
15 | float: left;
16 | }
17 | .dnn-label {
18 | margin: 8px 0;
19 | }
20 | .dnn-dropdown,.dnn-dropdown-with-error
21 | {
22 | width: 100% !important;
23 | box-sizing: border-box;
24 | }
25 | .dnn-single-line-input-with-error {
26 | width: 100% !important;
27 | }
28 | }
29 | .dnn-grid-system {
30 | .left-column {
31 | padding-right: 30px;
32 | border-right: 1px solid @alto;
33 | }
34 | .right-column {
35 | padding-left: 30px;
36 | border-left: 0 !important;
37 | }
38 | }
39 | .editor-buttons-box {
40 | width: 100%;
41 | text-align: center;
42 | float: left;
43 | margin: 30px 0 0 0;
44 | .dnn-ui-common-button {
45 | margin: 5px;
46 | }
47 | .edit-icon {
48 | margin: 0px 10px 20px 10px;
49 | float: right;
50 | svg {
51 | width: 16px;
52 | float: left;
53 | height: 16px;
54 | }
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/components/profileMappings/profileMappingEditor/style.less:
--------------------------------------------------------------------------------
1 | @import "~@dnnsoftware/dnn-react-common/styles/index.less";
2 | .profilemapping-editor {
3 | float: left;
4 | margin: 20px 30px;
5 | .topMessage {
6 | border: 1px solid @alto;
7 | padding: 10px 20px;
8 | background-color: @mercury;
9 | margin: 0 0 20px 0;
10 | }
11 | .dnn-ui-common-input-group {
12 | padding: 0 0 15px 0;
13 | label {
14 | font-weight: bolder;
15 | float: left;
16 | }
17 | .dnn-label {
18 | margin: 8px 0;
19 | }
20 | .dnn-dropdown,.dnn-dropdown-with-error
21 | {
22 | width: 100% !important;
23 | box-sizing: border-box;
24 | }
25 | .dnn-single-line-input-with-error {
26 | width: 100% !important;
27 | }
28 | }
29 | .dnn-grid-system {
30 | .left-column {
31 | padding-right: 30px;
32 | border-right: 1px solid @alto;
33 | }
34 | .right-column {
35 | padding-left: 30px;
36 | border-left: 0 !important;
37 | }
38 | }
39 | .editor-buttons-box {
40 | width: 100%;
41 | text-align: center;
42 | float: left;
43 | margin: 30px 0 0 0;
44 | .dnn-ui-common-button {
45 | margin: 5px;
46 | }
47 | .edit-icon {
48 | margin: 0px 10px 20px 10px;
49 | float: right;
50 | svg {
51 | width: 16px;
52 | float: left;
53 | height: 16px;
54 | }
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/components/general/generalSettings.less:
--------------------------------------------------------------------------------
1 | @import "~@dnnsoftware/dnn-react-common/styles/index";
2 | .dnn-azuread-b2c-generalSettings {
3 | box-sizing: border-box;
4 | padding: 35px 25px;
5 |
6 | * {
7 | box-sizing: border-box;
8 | }
9 |
10 | h1 {
11 | margin-top: 30px;
12 | margin-bottom: 15px;
13 | text-transform: uppercase;
14 | }
15 |
16 | .panel-description {
17 | margin-bottom: 30px;
18 | }
19 |
20 | .logo {
21 | float: right;
22 | background-image: url(img/AADB2C.png);
23 | background-repeat: no-repeat;
24 | background-size: 70px;
25 | width: 80px;
26 | height: 80px;
27 | }
28 |
29 | p {
30 | margin-bottom: 20px;
31 | }
32 |
33 | .dnn-switch-container {
34 | width: 90%;
35 | }
36 |
37 | .directory-section {
38 | margin-top: 10px;
39 | }
40 |
41 | .editor-row {
42 | display: inline-block;
43 | width: 90%;
44 | }
45 |
46 | .input-full-row {
47 | width: 95%;
48 | }
49 |
50 | .dnn-single-line-input-with-error {
51 | width: 100%;
52 | padding-bottom: 15px;
53 | }
54 |
55 | .dnn-ui-common-single-line-input.small {
56 | margin-bottom: 0px !important;
57 | }
58 |
59 | .buttons-box {
60 | margin-top: 50px;
61 | margin-bottom: 30px;
62 |
63 | button.dnn-ui-common-button[role=primary] {
64 | margin-left: 10px;
65 | }
66 | }
67 |
68 | .dnn-ui-common-input-group .sectionLabel {
69 | border-top: 1px solid #C8C8C8;
70 | padding-top: 20px;
71 | margin-top: 20px;
72 | }
73 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/components/sync/syncSettings.less:
--------------------------------------------------------------------------------
1 | @import "~@dnnsoftware/dnn-react-common/styles/index";
2 | .dnn-azuread-b2c-syncSettings {
3 | box-sizing: border-box;
4 | padding: 35px 25px;
5 | * {
6 | box-sizing: border-box;
7 | }
8 | h1 {
9 | margin-top: 10px;
10 | margin-bottom: 10px;
11 | text-transform: uppercase;
12 | }
13 | p {
14 | margin-bottom: 20px;
15 | }
16 | .dnn-switch-container {
17 | width: 90%;
18 | }
19 | .editor-row {
20 | display: inline-block;
21 | width: 90%;
22 | }
23 | .dnn-single-line-input-with-error {
24 | width: 100%;
25 | padding-bottom: 15px;
26 | }
27 | .dnn-ui-common-single-line-input.small {
28 | margin-bottom: 0px!important;
29 | }
30 | .buttons-box {
31 | margin-top: 50px;
32 | margin-bottom: 30px;
33 | button.dnn-ui-common-button[role=primary] {
34 | margin-left: 10px;
35 | }
36 | }
37 | .warning-container {
38 | width: 100%;
39 | float: left;
40 | margin: 10px 0 15px 0;
41 | font-weight: bolder;
42 | color: @alizarinCrimson;
43 | .collapsible-content {
44 | margin-top: 5px;
45 | > div {
46 | border: solid 1px;
47 | }
48 | }
49 | .warning-icon {
50 | > svg {
51 | width: 17px;
52 | float: left;
53 | height: 17px;
54 | margin: 0 10px 0 0;
55 | }
56 | }
57 | .warning-msg {
58 | margin-left: 30px;
59 | }
60 | }
61 | h1.spacer {
62 | margin-top: 25px;
63 | }
64 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Images/amazon.svg:
--------------------------------------------------------------------------------
1 | ODl4W2.tif (2)
--------------------------------------------------------------------------------
/samples/ChromeExtension/src/favicon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Icon-identity-228
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Components/Models/ProfileMapping.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Web.Caching;
3 | using DotNetNuke.ComponentModel.DataAnnotations;
4 |
5 | namespace DotNetNuke.Authentication.Azure.B2C.Components.Models
6 | {
7 | [TableName("AzureB2C_ProfileMappings")]
8 | //setup the primary key for table
9 | [PrimaryKey("ProfileMappingId", AutoIncrement = true)]
10 | //configure caching using PetaPoco
11 | [Cacheable("ProfileMapping", CacheItemPriority.Default, 20)]
12 | public class ProfileMapping
13 | {
14 | public int ProfileMappingId { get; set; }
15 |
16 | public string DnnProfilePropertyName { get; set; }
17 | public string B2cClaimName { get; set; }
18 | public int PortalId { get; set; }
19 | public int CreatedByUserId { get; set; }
20 | public DateTime CreatedOnDate { get; set; }
21 | public int LastModifiedByUserId { get; set; }
22 | public DateTime LastModifiedOnDate { get; set; }
23 |
24 | public string GetB2cCustomClaimName()
25 | {
26 | if (B2cClaimName.StartsWith("extension_"))
27 | return B2cClaimName;
28 | return string.IsNullOrEmpty(B2cClaimName)
29 | ? ""
30 | : $"extension_{B2cClaimName}";
31 | }
32 |
33 | public string GetB2cCustomAttributeName(int portalId)
34 | {
35 | if (B2cClaimName.StartsWith("extension_"))
36 | return B2cClaimName;
37 | var settings = new AzureConfig(AzureConfig.ServiceName, portalId);
38 | return string.IsNullOrEmpty(settings.B2cApplicationId) || string.IsNullOrEmpty(B2cClaimName)
39 | ? ""
40 | : $"extension_{settings.B2cApplicationId.Replace("-", "")}_{B2cClaimName}";
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/components/advanced/advancedSettings.less:
--------------------------------------------------------------------------------
1 | @import "~@dnnsoftware/dnn-react-common/styles/index";
2 | .dnn-azuread-aad-advancedSettings {
3 | box-sizing: border-box;
4 | padding: 35px 25px;
5 | * {
6 | box-sizing: border-box;
7 | }
8 | h1 {
9 | margin-top: 10px;
10 | margin-bottom: 10px;
11 | text-transform: uppercase;
12 | }
13 | p {
14 | margin-bottom: 20px;
15 | }
16 | .dnn-switch-container {
17 | width: 90%;
18 | }
19 | .editor-row {
20 | display: inline-block;
21 | width: 90%;
22 | }
23 | .dnn-single-line-input-with-error {
24 | width: 100%;
25 | padding-bottom: 15px;
26 | }
27 | .dnn-ui-common-single-line-input.small {
28 | margin-bottom: 0px!important;
29 | }
30 | .dnn-dropdown-with-error {
31 | width: 90%;
32 | }
33 | .buttons-box {
34 | margin-top: 50px;
35 | margin-bottom: 30px;
36 | button.dnn-ui-common-button[role=primary] {
37 | margin-left: 10px;
38 | }
39 | }
40 | .warning-container {
41 | width: 100%;
42 | float: left;
43 | margin: 10px 0 15px 0;
44 | font-weight: bolder;
45 | color: @alizarinCrimson;
46 | .collapsible-content {
47 | margin-top: 5px;
48 | > div {
49 | border: solid 1px;
50 | }
51 | }
52 | .warning-icon {
53 | > svg {
54 | width: 17px;
55 | float: left;
56 | height: 17px;
57 | margin: 0 10px 0 0;
58 | }
59 | }
60 | .warning-msg {
61 | margin-left: 30px;
62 | }
63 | }
64 | h1.spacer {
65 | margin-top: 25px;
66 | }
67 | }
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/Views/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Views/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Utils/Constants.cs:
--------------------------------------------------------------------------------
1 | /************************************************************************************************
2 | The MIT License (MIT)
3 |
4 | Copyright (c) 2015 Microsoft Corporation
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
23 | ***********************************************************************************************/
24 |
25 | namespace TaskWebApp.Utils
26 | {
27 | ///
28 | /// claim keys constants
29 | ///
30 | public static class ClaimConstants
31 | {
32 | public const string ObjectId = "http://schemas.microsoft.com/identity/claims/objectidentifier";
33 | public const string TenantId = "http://schemas.microsoft.com/identity/claims/tenantid";
34 | public const string tid = "tid";
35 | }
36 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Components/Models/UserMapping.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Web.Caching;
3 | using DotNetNuke.ComponentModel.DataAnnotations;
4 |
5 | namespace DotNetNuke.Authentication.Azure.B2C.Components.Models
6 | {
7 | [TableName("AzureB2C_UserMappings")]
8 | //setup the primary key for table
9 | [PrimaryKey("UserMappingId", AutoIncrement = true)]
10 | //configure caching using PetaPoco
11 | [Cacheable("UserMapping", CacheItemPriority.Default, 20)]
12 | public class UserMapping
13 | {
14 | public int UserMappingId { get; set; }
15 |
16 | public string DnnPropertyName { get; set; }
17 | public string B2cClaimName { get; set; }
18 | public int PortalId { get; set; }
19 | public int CreatedByUserId { get; set; }
20 | public DateTime CreatedOnDate { get; set; }
21 | public int LastModifiedByUserId { get; set; }
22 | public DateTime LastModifiedOnDate { get; set; }
23 |
24 | public string GetB2cCustomClaimName()
25 | {
26 | if (B2cClaimName.StartsWith("extension_"))
27 | return B2cClaimName;
28 | return string.IsNullOrEmpty(B2cClaimName)
29 | ? ""
30 | : $"extension_{B2cClaimName}";
31 | }
32 |
33 | public string GetB2cCustomAttributeName(int portalId)
34 | {
35 | var b2cAttName = B2cClaimName;
36 | if (b2cAttName.StartsWith("extension_"))
37 | b2cAttName = b2cAttName.Substring(10);
38 | var settings = new AzureConfig(AzureConfig.ServiceName, portalId);
39 | return string.IsNullOrEmpty(settings.B2cApplicationId) || string.IsNullOrEmpty(B2cClaimName)
40 | ? ""
41 | : $"extension_{settings.B2cApplicationId.Replace("-", "")}_{b2cAttName}";
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewBag.Title - My ASP.NET Application
7 | @Styles.Render("~/Content/css")
8 | @Scripts.Render("~/bundles/modernizr")
9 |
10 |
11 |
12 |
13 |
21 |
22 |
23 | @Html.ActionLink("Home", "Index", "Home")
24 | @Html.ActionLink("Claims", "Claims", "Home")
25 | @Html.ActionLink("To-Do List", "Index", "Tasks")
26 |
27 | @Html.Partial("_LoginPartial")
28 |
29 |
30 |
31 |
32 | @RenderBody()
33 |
34 |
37 |
38 |
39 | @Scripts.Render("~/bundles/jquery")
40 | @Scripts.Render("~/bundles/bootstrap")
41 | @RenderSection("scripts", required: false)
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/B2C-WebAPI-DotNet.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskWebApp", "TaskWebApp\TaskWebApp.csproj", "{07D1C353-4626-4D20-A804-531517BCF3F5}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskService", "TaskService\TaskService.csproj", "{FEBD0A38-D884-403D-89C5-1FEFE80BB550}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{84AE09B1-A124-4886-B44D-B68ABF36AB67}"
11 | ProjectSection(SolutionItems) = preProject
12 | .nuget\NuGet.Config = .nuget\NuGet.Config
13 | .nuget\NuGet.exe = .nuget\NuGet.exe
14 | .nuget\NuGet.targets = .nuget\NuGet.targets
15 | EndProjectSection
16 | EndProject
17 | Global
18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
19 | Debug|Any CPU = Debug|Any CPU
20 | Release|Any CPU = Release|Any CPU
21 | EndGlobalSection
22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
23 | {FEBD0A38-D884-403D-89C5-1FEFE80BB550}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 | {FEBD0A38-D884-403D-89C5-1FEFE80BB550}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 | {FEBD0A38-D884-403D-89C5-1FEFE80BB550}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {FEBD0A38-D884-403D-89C5-1FEFE80BB550}.Release|Any CPU.Build.0 = Release|Any CPU
27 | {07D1C353-4626-4D20-A804-531517BCF3F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28 | {07D1C353-4626-4D20-A804-531517BCF3F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
29 | {07D1C353-4626-4D20-A804-531517BCF3F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
30 | {07D1C353-4626-4D20-A804-531517BCF3F5}.Release|Any CPU.Build.0 = Release|Any CPU
31 | EndGlobalSection
32 | GlobalSection(SolutionProperties) = preSolution
33 | HideSolutionNode = FALSE
34 | EndGlobalSection
35 | EndGlobal
36 |
--------------------------------------------------------------------------------
/samples/CustomPolicies/Impersonation/LocalAccounts/Impersonation.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 | YOURTENANTNAME.onmicrosoft.com
13 | B2C_1A_Impersonation_TrustFrameworkExtensions
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | PolicyProfile
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/App_Start/Startup.Auth.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.IdentityModel.Tokens;
2 | using Microsoft.Owin.Security.Jwt;
3 | using Microsoft.Owin.Security.OAuth;
4 | using Owin;
5 | using System;
6 | using System.Configuration;
7 | using System.Linq;
8 | using TaskService.App_Start;
9 |
10 | namespace TaskService
11 | {
12 | public partial class Startup
13 | {
14 | // These values are pulled from web.config
15 | public static string AadInstance = ConfigurationManager.AppSettings["ida:AadInstance"];
16 | public static string Tenant = ConfigurationManager.AppSettings["ida:Tenant"];
17 | public static string ClientId = ConfigurationManager.AppSettings["ida:ClientId"];
18 | public static string SignUpSignInPolicy = ConfigurationManager.AppSettings["ida:SignUpSignInPolicyId"];
19 | public static string DefaultPolicy = SignUpSignInPolicy;
20 |
21 | /*
22 | * Configure the authorization OWIN middleware
23 | */
24 | public void ConfigureAuth(IAppBuilder app)
25 | {
26 | var audiences = ClientId.Split(new [] {","}, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
27 |
28 | var tvps = new TokenValidationParameters
29 | {
30 | // Accept only those tokens where the audience of the token is equal to the client ID of this app
31 | ValidAudiences = audiences.ToArray(),
32 | AuthenticationType = Startup.DefaultPolicy
33 | };
34 |
35 | app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions
36 | {
37 | // This SecurityTokenProvider fetches the Azure AD B2C metadata & signing keys from the OpenIDConnect metadata endpoint
38 | AccessTokenFormat = new JwtFormat(tvps, new OpenIdConnectCachingSecurityTokenProvider(String.Format(AadInstance, Tenant, DefaultPolicy)))
39 | });
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Content/Site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Set padding to keep content from hitting the edges */
7 | .body-content {
8 | padding-left: 15px;
9 | padding-right: 15px;
10 | }
11 |
12 | /* Set width on the form input elements since they're 100% wide by default */
13 | input,
14 | select,
15 | textarea {
16 | max-width: 280px;
17 | }
18 |
19 | /* styles for validation helpers */
20 | .field-validation-error {
21 | color: #b94a48;
22 | }
23 |
24 | .field-validation-valid {
25 | display: none;
26 | }
27 |
28 | input.input-validation-error {
29 | border: 1px solid #b94a48;
30 | }
31 |
32 | input[type="checkbox"].input-validation-error {
33 | border: 0 none;
34 | }
35 |
36 | .validation-summary-errors {
37 | color: #b94a48;
38 | }
39 |
40 | .validation-summary-valid {
41 | display: none;
42 | }
43 |
44 | #profile-options {
45 | display:none;
46 | z-index:100;
47 | background-color: rgb(238, 238, 238);
48 | position:absolute;
49 | border:solid;
50 | border-color: rgb(128, 128, 128);
51 | border-width:thin;
52 | }
53 |
54 | .profile-link {
55 | /*display:table-cell;*/
56 | white-space:nowrap;
57 |
58 | }
59 |
60 | .profile-links {
61 | list-style-type:none;
62 | padding-left:10px;
63 | padding-right:10px;
64 | /*display:table-row;*/
65 | }
66 |
67 | #profile-link {
68 | cursor:pointer;
69 | }
70 |
71 | .claim-table, table, td, th {
72 | margin-bottom:30px;
73 | border: solid;
74 | border-width:thin;
75 | border-color:rgb(187, 187, 187);
76 | background-color:rgb(238,238,238);
77 | width:100%;
78 | table-layout:fixed;
79 | }
80 |
81 | .claim-type {
82 | padding-right: 30px;
83 | text-align:left;
84 | }
85 |
86 | .claim-data {
87 | padding-left:5px;
88 | overflow-x:hidden;
89 | text-overflow:ellipsis;
90 | }
91 |
92 | .claim-head {
93 | background-color:rgb(157, 201, 212);
94 | }
--------------------------------------------------------------------------------
/samples/CustomPolicies/SignInWithForcePasswordReset/LocalAccounts/ForcePasswordReset_Signin.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 | YOURTENANTNAME.onmicrosoft.com
15 | B2C_1A_ForcePasswordReset_TrustFrameworkExtensions
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | PolicyProfile
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Login.ascx:
--------------------------------------------------------------------------------
1 | <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Login.ascx.cs" Inherits="DotNetNuke.Authentication.Azure.B2C.Login" %>
2 | <%@ Register TagPrefix="dnnC" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>
3 |
4 |
5 |
6 |
7 |
8 | <%=LocalizeString("LoginAzureB2C")%>
9 |
10 |
11 |
12 |
13 | <%=LocalizeString("RegisterAzureB2C") %>
14 |
15 |
16 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Components/Graph/Models/NewUser.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Graph;
2 | using Newtonsoft.Json;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 |
6 | namespace DotNetNuke.Authentication.Azure.B2C.Components.Graph.Models
7 | {
8 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
9 | public class NewUser : User
10 | {
11 | public NewUser()
12 | {
13 | Initialize();
14 | }
15 |
16 | public NewUser(User user, bool initializeForAdd = true)
17 | {
18 | //Get the list of properties available in base class
19 | var properties = user.GetType().GetProperties();
20 |
21 | properties.ToList().ForEach(property =>
22 | {
23 | //Check whether that property is present in derived class
24 | var isPresent = this.GetType().GetProperty(property.Name);
25 | if (isPresent != null)
26 | {
27 | //If present get the value and map it
28 | var value = user.GetType().GetProperty(property.Name).GetValue(user, null);
29 | this.GetType().GetProperty(property.Name).SetValue(this, value, null);
30 | }
31 | });
32 |
33 | Initialize(initializeForAdd);
34 | }
35 |
36 | private void Initialize(bool initializeForAdd = true)
37 | {
38 | if (AdditionalData == null)
39 | {
40 | AdditionalData = new Dictionary();
41 | }
42 | if (initializeForAdd)
43 | {
44 | AccountEnabled = true;
45 | if (Identities == null)
46 | {
47 | Identities = new List();
48 | }
49 | }
50 | PasswordPolicies = "DisablePasswordExpiration";
51 | PasswordProfile = new PasswordProfile()
52 | {
53 | ForceChangePasswordNextSignIn = false
54 | };
55 | }
56 |
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/samples/ChromeExtension/src/ui.js:
--------------------------------------------------------------------------------
1 | // UI elements to work with
2 | const signInButton = document.getElementById('signIn');
3 | const signOutButton = document.getElementById('signOut');
4 | const editProfileButton = document.getElementById('editProfileButton');
5 | const label = document.getElementById('label');
6 | const responseLog = document.getElementById("responseLog");
7 | const welcome = document.getElementById("welcome");
8 | const itemsForm = document.getElementById("itemsForm");
9 | const items = document.getElementById("items");
10 | const itemsTable = document.getElementById("itemsTable");
11 | var viewmodel = null;
12 |
13 | // updates the UI post login/token acquisition
14 | function updateUI() {
15 |
16 | if (myMSALObj.account != null) {
17 | const userName = myMSALObj.getAccount().name;
18 | logMessage("User '" + userName + "' logged-in");
19 | signInButton.classList.add('d-none');
20 | signOutButton.classList.remove('d-none');
21 | // greet the user - specifying login
22 | label.innerText = "Hello " + userName;
23 | editProfileButton.classList.remove('d-none');
24 | welcome.classList.add('d-none');
25 | itemsForm.classList.remove('d-none');
26 | refreshItems();
27 | }
28 | else {
29 | logMessage("No user logged in");
30 | signInButton.classList.remove('d-none');
31 | signOutButton.classList.add('d-none');
32 | label.innerText = "Sign-in with Microsoft Azure AD B2C";
33 | editProfileButton.classList.add('d-none');
34 | welcome.classList.remove('d-none');
35 | itemsForm.classList.add('d-none');
36 | }
37 | }
38 |
39 | // debug helper
40 | function logMessage(s) {
41 | responseLog.appendChild(document.createTextNode('\n' + s + '\n'));
42 | }
43 |
44 | $(function() {
45 | $('#signIn').click(signIn);
46 | $('#signOut').click(logout);
47 | $('#editProfileButton').click(editProfile);
48 | $('#addItem').click(function() {
49 | viewmodel.addItem(document.getElementById('txtNewItem').value);
50 | });
51 |
52 | refreshItems();
53 | updateUI();
54 | });
55 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/Utils/Globals.cs:
--------------------------------------------------------------------------------
1 | using System.Configuration;
2 |
3 | namespace TaskWebApp.Utils
4 | {
5 | public static class Globals
6 | {
7 | // App config settings
8 | public static string ClientId = ConfigurationManager.AppSettings["ida:ClientId"];
9 | public static string ClientSecret = ConfigurationManager.AppSettings["ida:ClientSecret"];
10 | public static string AadInstance = ConfigurationManager.AppSettings["ida:AadInstance"];
11 | public static string Tenant = ConfigurationManager.AppSettings["ida:Tenant"];
12 | public static string TenantId = ConfigurationManager.AppSettings["ida:TenantId"];
13 | public static string RedirectUri = ConfigurationManager.AppSettings["ida:RedirectUri"];
14 | public static string ServiceUrl = ConfigurationManager.AppSettings["api:TaskServiceUrl"];
15 |
16 | // B2C policy identifiers
17 | public static string SignUpSignInPolicyId = ConfigurationManager.AppSettings["ida:SignUpSignInPolicyId"];
18 | public static string EditProfilePolicyId = ConfigurationManager.AppSettings["ida:EditProfilePolicyId"];
19 | public static string ResetPasswordPolicyId = ConfigurationManager.AppSettings["ida:ResetPasswordPolicyId"];
20 |
21 | public static string DefaultPolicy = SignUpSignInPolicyId;
22 |
23 | // API Scopes
24 | public static string ApiIdentifier = ConfigurationManager.AppSettings["api:ApiIdentifier"];
25 | public static string ReadTasksScope = ApiIdentifier + ConfigurationManager.AppSettings["api:ReadScope"];
26 | public static string WriteTasksScope = ApiIdentifier + ConfigurationManager.AppSettings["api:WriteScope"];
27 | public static string[] Scopes = new string[] { ReadTasksScope, WriteTasksScope };
28 |
29 | // OWIN auth middleware constants
30 | public const string ObjectIdElement = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier";
31 |
32 | // Authorities
33 | public static string B2CAuthority = string.Format(AadInstance, Tenant, DefaultPolicy);
34 | public static string WellKnownMetadata = $"{AadInstance}/v2.0/.well-known/openid-configuration";
35 |
36 | }
37 | }
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskWebApp/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/samples/SPA-WebAPI-Client/module.css:
--------------------------------------------------------------------------------
1 | .items-table {
2 | width: 100%;
3 | margin-top: 10px;
4 | }
5 |
6 | .items-table th {
7 | border: 1px solid #333;
8 | padding: 10px;
9 | background-color: #ddd;
10 | }
11 |
12 | .items-table td {
13 | padding: 5px;
14 | }
15 |
16 | .dnnFormItem label,
17 | .dnnFormItem .dnnFormLabel,
18 | .dnnFormItem .dnnTooltip {
19 | display: block;
20 | width: 30%;
21 | text-align: right;
22 | margin-right: 16px;
23 | font-weight: bold;
24 | float: left;
25 | margin-top: 3px;
26 | }
27 |
28 | .dnnFormItem .dnnTooltip label {
29 | width: 100%;
30 | padding: 0;
31 | margin: 0;
32 | }
33 |
34 | .dnnForm .dnnFormSecondItem label {
35 | float: none
36 | }
37 |
38 | .dnnFormItem span.inline label {
39 | display: inline;
40 | width: auto;
41 | }
42 |
43 | .dnnFormItem input[type="text"],
44 | .dnnFormItem .dnnFormInput,
45 | .dnnFormItem textarea {
46 | float: left;
47 | -moz-border-radius: 3px;
48 | border-radius: 3px;
49 | padding: 5px;
50 | background: #fffff5;
51 | -moz-box-shadow: inset 0 0 3px 3px #fffbe1;
52 | -webkit-box-shadow: inset 0 0 3px 3px #fffbe1;
53 | box-shadow: inset 0 0 3px 3px #fffbe1;
54 | border-color: #bcb691;
55 | border-width: 1px;
56 | margin: 0;
57 | width: auto;
58 | font-family: Helvetica, Arial, Verdana, sans-serif;
59 | }
60 |
61 | .dnnFormItem select {
62 | width: auto;
63 | padding: 0;
64 | }
65 |
66 | .dnnFormItem input[type="text"],
67 | .dnnFormItem textarea {
68 | min-width: 35%
69 | }
70 |
71 | .dnnFormItem textarea {
72 | min-height: 80px
73 | }
74 |
75 | .dnnForm input.dnnFormRequired,
76 | .dnnForm textarea.dnnFormRequired,
77 | .dnnForm select.dnnFormRequired {
78 | border-left: 5px #F00 solid
79 | }
80 |
81 | .dnnFormRadioButtons {
82 | float: left;
83 | width: auto;
84 | display: block;
85 | }
86 |
87 | .dnnFormRadioButtons input[type=radio] {
88 | clear: both
89 | }
90 |
91 | .dnnFormRadioButtons label {
92 | font-weight: normal;
93 | margin: 0 10px 0 4px;
94 | width: auto;
95 | text-align: left;
96 | padding-right: 0;
97 | }
98 | .dnnFormError {
99 | margin-top: 10px;
100 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Settings.ascx.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 |
3 | //
4 | // Intelequia Software solutions - https://intelequia.com
5 | // Copyright (c) 2019
6 | // by Intelequia Software Solutions
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11 | // to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 | // of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 |
22 | #endregion
23 |
24 | #region Usings
25 |
26 | using System;
27 | using DotNetNuke.Authentication.Azure.B2C.Components;
28 | using DotNetNuke.Services.Authentication.OAuth;
29 |
30 | #endregion
31 |
32 | namespace DotNetNuke.Authentication.Azure.B2C
33 | {
34 | public partial class Settings : OAuthSettingsBase
35 | {
36 | protected override string AuthSystemApplicationName => AzureConfig.ServiceName;
37 |
38 | public override void UpdateSettings()
39 | {
40 | if (SettingsEditor.IsValid && SettingsEditor.IsDirty)
41 | {
42 | var config = (AzureConfig)SettingsEditor.DataSource;
43 | AzureConfig.UpdateConfig(config);
44 | }
45 | }
46 |
47 | protected override void OnLoad(EventArgs e)
48 | {
49 | base.OnLoad(e);
50 | OAuthConfigBase.ClearConfig(AuthSystemApplicationName, PortalId);
51 | var config = AzureConfig.GetConfig(AuthSystemApplicationName, PortalId);
52 | SettingsEditor.DataSource = config;
53 | SettingsEditor.DataBind();
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Data/RolesRepository.cs:
--------------------------------------------------------------------------------
1 | using DotNetNuke.Authentication.Azure.B2C.Components.Models;
2 | using DotNetNuke.Framework;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Data.SqlClient;
6 | using System.Data;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Configuration;
11 |
12 | namespace DotNetNuke.Authentication.Azure.B2C.Data
13 | {
14 | public class RolesRepository : ServiceLocator, IRolesRepository
15 | {
16 | private static readonly string connectionString = ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString;
17 |
18 | protected override Func GetFactory()
19 | {
20 | return () => new RolesRepository();
21 | }
22 |
23 | public List GetExpiredUserRoles(int portalId)
24 | {
25 | List expiredRoles = new List();
26 |
27 | using (SqlConnection connection = new SqlConnection(connectionString))
28 | {
29 | connection.Open();
30 |
31 | using (SqlCommand command = new SqlCommand("AzureB2C_GetExpiredUserRoles", connection))
32 | {
33 | command.CommandType = CommandType.StoredProcedure;
34 | command.Parameters.Add(new SqlParameter("@PortalId", portalId));
35 |
36 | SqlDataReader reader = command.ExecuteReader();
37 |
38 | while (reader.Read())
39 | {
40 | ExpiredUserRoleInfo roleInfo = new ExpiredUserRoleInfo
41 | {
42 | UserID = reader.GetInt32(reader.GetOrdinal("UserID")),
43 | Email = reader.GetString(reader.GetOrdinal("Email")),
44 | RoleID = reader.GetInt32(reader.GetOrdinal("RoleID")),
45 | RoleName = reader.GetString(reader.GetOrdinal("RoleName")),
46 | ExpiryDate = reader.GetDateTime(reader.GetOrdinal("ExpiryDate")).ToString("yyyy-MM-dd")
47 | };
48 |
49 | expiredRoles.Add(roleInfo);
50 | }
51 | }
52 |
53 | connection.Close();
54 | }
55 |
56 | return expiredRoles;
57 | }
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dnn-azure-ad-b2c",
3 | "version": "1.6.0",
4 | "private": true,
5 | "description": "DNN Azure AD B2C persona bar settings",
6 | "repository": {
7 | "type": "git",
8 | "url": "https://github.com/intelequia/dnn.azureadb2cprovider.git"
9 | },
10 | "license": "MIT",
11 | "keywords": [
12 | "DNN",
13 | "React",
14 | "DNN Module",
15 | "Persona Bar",
16 | "Intelequia",
17 | "Azure AD",
18 | "B2C"
19 | ],
20 | "scripts": {
21 | "build": "set NODE_ENV=production&&webpack --mode production",
22 | "test": "jest",
23 | "test:watch": "jest --watch",
24 | "debug": "set NODE_ENV=debug&&webpack -p",
25 | "webpack": "webpack-dev-server --mode development --host localhost --port 8080 --hot --history-api-fallback",
26 | "watch": "set NODE_ENV=debug & webpack --mode=development --progress --colors --watch",
27 | "analyze": "set NODE_ENV=production&&webpack -p --json | webpack-bundle-size-analyzer",
28 | "lint": "eslint --fix"
29 | },
30 | "devDependencies": {
31 | "@babel/core": "^7.1.6",
32 | "@babel/plugin-proposal-object-rest-spread": "^7.2.0",
33 | "@babel/plugin-transform-react-jsx": "^7.2.0",
34 | "@babel/preset-env": "^7.1.6",
35 | "@babel/preset-react": "^7.0.0",
36 | "@dnnsoftware/dnn-react-common": "9.11.0",
37 | "array.prototype.find": "2.0.4",
38 | "array.prototype.findindex": "2.0.2",
39 | "babel-loader": "^8.0.6",
40 | "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
41 | "create-react-class": "^15.6.3",
42 | "css-loader": "2.1.1",
43 | "eslint": "7.32.0",
44 | "eslint-loader": "4.0.2",
45 | "eslint-plugin-jest": "^22.0.0",
46 | "eslint-plugin-react": "7.11.1",
47 | "eslint-plugin-spellcheck": "0.0.11",
48 | "file-loader": "3.0.1",
49 | "jest": "^28.1.2",
50 | "jwt-decode": "2.2.0",
51 | "less": "4.1.2",
52 | "less-loader": "5.0.0",
53 | "prop-types": "^15.6.2",
54 | "raw-loader": "2.0.0",
55 | "react": "^16.6.3",
56 | "react-custom-scrollbars": "4.2.1",
57 | "react-dom": "^16.6.3",
58 | "react-hot-loader": "4.8.5",
59 | "react-modal": "3.6.1",
60 | "react-redux": "^6.0.0",
61 | "redux": "^4.0.1",
62 | "redux-immutable-state-invariant": "^2.1.0",
63 | "redux-thunk": "^2.3.0",
64 | "source-map-loader": "^0.2.3",
65 | "style-loader": "^0.23.1",
66 | "url-loader": "1.1.2",
67 | "webpack": "^4.31.0",
68 | "webpack-bundle-size-analyzer": "3.0.0",
69 | "webpack-cli": "4.10.0",
70 | "webpack-dev-server": "4.11.1"
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/.eslintskipwords.js:
--------------------------------------------------------------------------------
1 | module.exports = [
2 | "dnn",
3 | "evoq",
4 | "eslint",
5 | "fetch-ie8",
6 | "react-dom",
7 | "lodash",
8 | "bool",
9 | "func",
10 | "dropdown",
11 | "globals",
12 | "init",
13 | "cors",
14 | "api",
15 | "integrations",
16 | "const",
17 | "dom",
18 | "stringify",
19 | "debounce",
20 | "debounced",
21 | "unmount",
22 | "ceil",
23 | "px",
24 | "rgba",
25 | "svg",
26 | "html",
27 | "src",
28 | "calc",
29 | "img",
30 | "jpg",
31 | "nowrap",
32 | "js",
33 | "dropzone",
34 | "ondropactivate",
35 | "ondragenter",
36 | "draggable",
37 | "ondrop",
38 | "ondragleave",
39 | "ondropdeactivate",
40 | "droppable",
41 | "onmove",
42 | "onend",
43 | "interactable",
44 | "webkit",
45 | "rect",
46 | "concat",
47 | "resize",
48 | "sortable",
49 | "socialpanelheader",
50 | "socialpanelbody",
51 | "asc",
52 | "dx",
53 | "dy",
54 | "num",
55 | "reactid",
56 | "currentcolor",
57 | "ui",
58 | "checkbox",
59 | "tooltip",
60 | "scrollbar",
61 | "unshift",
62 | "dragstart",
63 | "contenteditable",
64 | "addons",
65 | "tbody",
66 | "resizable",
67 | "resizemove",
68 | "resizestart",
69 | "resizeend",
70 | "resizing",
71 | "resized",
72 | "ondropmove",
73 | "moz",
74 | "evq",
75 | "btn",
76 | "addon",
77 | "substring",
78 | "jpeg",
79 | "gif",
80 | "pdf",
81 | "png",
82 | "ppt",
83 | "txt",
84 | "autocomplete",
85 | "utils",
86 | "js-htmlencode",
87 | "webpack",
88 | "undef",
89 | "analytics",
90 | "dataset",
91 | "checkmark",
92 | "li",
93 | "br",
94 | "localizations",
95 | "javascript",
96 | "ie",
97 | "pikaday",
98 | "na",
99 | "searchable",
100 | "clearable",
101 | "http",
102 | "decrement",
103 | "ok",
104 | "checkboxes",
105 | "ddmmyy",
106 | "mmddyy",
107 | "ddmmyyyy",
108 | "mmddyyyy",
109 | "yyyymmdd",
110 | "td",
111 | "th",
112 | "marketo",
113 | "salesforce",
114 | "captcha",
115 | "rgb",
116 | "sunday",
117 | "xxxx",
118 | "typeof",
119 | "popup",
120 | "ccc",
121 | "aaf",
122 | "dddd",
123 | "redux",
124 | "middleware",
125 | "dev",
126 | "util",
127 | "searchpanel",
128 | "uncollapse",
129 | "dev",
130 | "ctrl"
131 | ]
132 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Services/HelloController.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 |
3 | //
4 | // Intelequia Software solutions - https://intelequia.com
5 | // Copyright (c) 2019
6 | // by Intelequia Software Solutions
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11 | // to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 | // of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 |
22 | #endregion
23 |
24 | using DotNetNuke.Instrumentation;
25 | using DotNetNuke.Web.Api;
26 | using System;
27 | using System.Net;
28 | using System.Net.Http;
29 | using System.Web.Http;
30 |
31 | namespace DotNetNuke.Authentication.Azure.B2C.Services
32 | {
33 | public class RouterMapper : IServiceRouteMapper
34 | {
35 | public void RegisterRoutes(IMapRoute mapRouteManager)
36 | {
37 | mapRouteManager.MapHttpRoute("DotNetNuke.Authentication.Azure.B2C.Services", "default", "{controller}/{action}", new[] { "DotNetNuke.Authentication.Azure.B2C.Services" });
38 | }
39 | }
40 |
41 | public class HelloController : DnnApiController
42 | {
43 | private static readonly ILog _logger = LoggerSource.Instance.GetLogger(typeof(HelloController));
44 |
45 | [HttpGet]
46 | [DnnAuthorize(AuthTypes = "JWT")]
47 | public HttpResponseMessage Test()
48 | {
49 | try
50 | {
51 | return Request.CreateResponse(HttpStatusCode.OK, $"Hello {UserInfo.DisplayName}");
52 | }
53 | catch (Exception ex)
54 | {
55 | _logger.Error(ex);
56 | return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);
57 | }
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Login.ascx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Este código fue generado por una herramienta.
4 | //
5 | // Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
6 | // se vuelve a generar el código.
7 | //
8 | //------------------------------------------------------------------------------
9 |
10 | namespace DotNetNuke.Authentication.Azure.B2C {
11 |
12 |
13 | public partial class Login {
14 |
15 | ///
16 | /// Control AzureCss.
17 | ///
18 | ///
19 | /// Campo generado automáticamente.
20 | /// Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
21 | ///
22 | protected global::DotNetNuke.Web.Client.ClientResourceManagement.DnnCssInclude AzureCss;
23 |
24 | ///
25 | /// Control loginItem.
26 | ///
27 | ///
28 | /// Campo generado automáticamente.
29 | /// Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
30 | ///
31 | protected global::System.Web.UI.HtmlControls.HtmlGenericControl loginItem;
32 |
33 | ///
34 | /// Control loginButton.
35 | ///
36 | ///
37 | /// Campo generado automáticamente.
38 | /// Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
39 | ///
40 | protected global::System.Web.UI.WebControls.LinkButton loginButton;
41 |
42 | ///
43 | /// Control registerItem.
44 | ///
45 | ///
46 | /// Campo generado automáticamente.
47 | /// Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
48 | ///
49 | protected global::System.Web.UI.HtmlControls.HtmlGenericControl registerItem;
50 |
51 | ///
52 | /// Control registerButton.
53 | ///
54 | ///
55 | /// Campo generado automáticamente.
56 | /// Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
57 | ///
58 | protected global::System.Web.UI.WebControls.LinkButton registerButton;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Components/FeatureController.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 |
3 | //
4 | // Intelequia Software solutions - https://intelequia.com
5 | // Copyright (c) 2019
6 | // by Intelequia Software Solutions
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11 | // to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 | // of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 |
22 | #endregion
23 |
24 | using DotNetNuke.Entities.Modules;
25 | using System;
26 | using System.Linq;
27 |
28 | namespace DotNetNuke.Authentication.Azure.B2C.Components
29 | {
30 | public class FeatureController : IUpgradeable
31 | {
32 | public string UpgradeModule(string version)
33 | {
34 | try
35 | {
36 | var task = DotNetNuke.Services.Scheduling.SchedulingController.GetSchedule().FirstOrDefault(x => x.TypeFullName == "DotNetNuke.Authentication.Azure.B2C.ScheduledTasks.SyncSchedule, DotNetNuke.Authentication.Azure.B2C");
37 | if (task != null)
38 | {
39 | DotNetNuke.Services.Scheduling.SchedulingController.UpdateSchedule(task.ScheduleID,
40 | task.TypeFullName,
41 | task.TimeLapse, task.TimeLapseMeasurement, task.RetryTimeLapse, task.RetryTimeLapseMeasurement,
42 | task.RetainHistoryNum, task.AttachToEvent, task.CatchUpEnabled, true, task.ObjectDependencies,
43 | "," + Environment.MachineName + ",", task.FriendlyName);
44 | }
45 | return "Success";
46 | }
47 | catch (Exception ex)
48 | {
49 | return "Failed: " + ex.Message;
50 | }
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/DotNetNuke.Authentication.Azure.B2C.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.2.32616.157
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetNuke.Authentication.Azure.B2C", "DotNetNuke.Authentication.Azure.B2C.csproj", "{F5BB1B82-D843-4709-A57E-3A9CC290403F}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{30168D48-BC63-47D3-9C90-75F0C902C8D2}"
9 | ProjectSection(SolutionItems) = preProject
10 | ..\.build\ModulePackage.targets = ..\.build\ModulePackage.targets
11 | ..\.build\MSBuild.Community.Tasks.targets = ..\.build\MSBuild.Community.Tasks.targets
12 | EndProjectSection
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetNuke.Authentication.Azure.B2C.Extensibility", "..\DotNetNuke.Authentication.Azure.B2C.Extensibility\DotNetNuke.Authentication.Azure.B2C.Extensibility.csproj", "{42445032-9098-4160-930D-4127DC292695}"
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|Any CPU = Debug|Any CPU
19 | Release Legacy|Any CPU = Release Legacy|Any CPU
20 | Release|Any CPU = Release|Any CPU
21 | EndGlobalSection
22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
23 | {F5BB1B82-D843-4709-A57E-3A9CC290403F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 | {F5BB1B82-D843-4709-A57E-3A9CC290403F}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 | {F5BB1B82-D843-4709-A57E-3A9CC290403F}.Release Legacy|Any CPU.ActiveCfg = Release Legacy|Any CPU
26 | {F5BB1B82-D843-4709-A57E-3A9CC290403F}.Release Legacy|Any CPU.Build.0 = Release Legacy|Any CPU
27 | {F5BB1B82-D843-4709-A57E-3A9CC290403F}.Release|Any CPU.ActiveCfg = Release|Any CPU
28 | {F5BB1B82-D843-4709-A57E-3A9CC290403F}.Release|Any CPU.Build.0 = Release|Any CPU
29 | {42445032-9098-4160-930D-4127DC292695}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30 | {42445032-9098-4160-930D-4127DC292695}.Debug|Any CPU.Build.0 = Debug|Any CPU
31 | {42445032-9098-4160-930D-4127DC292695}.Release Legacy|Any CPU.ActiveCfg = Release Legacy|Any CPU
32 | {42445032-9098-4160-930D-4127DC292695}.Release Legacy|Any CPU.Build.0 = Release Legacy|Any CPU
33 | {42445032-9098-4160-930D-4127DC292695}.Release|Any CPU.ActiveCfg = Release|Any CPU
34 | {42445032-9098-4160-930D-4127DC292695}.Release|Any CPU.Build.0 = Release|Any CPU
35 | EndGlobalSection
36 | GlobalSection(SolutionProperties) = preSolution
37 | HideSolutionNode = FALSE
38 | EndGlobalSection
39 | GlobalSection(ExtensibilityGlobals) = postSolution
40 | SolutionGuid = {CF2AE640-C05D-4B31-8048-8B40EC7CD7E4}
41 | EndGlobalSection
42 | EndGlobal
43 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/admin/personaBar/scripts/AzureADB2C.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | define(['jquery',
3 | 'main/config',
4 | 'main/loader'
5 | ],
6 | function ($, cf, loader) {
7 | var initCallback;
8 | var utility;
9 | var settings;
10 | var config = cf.init();
11 |
12 | function loadScript(basePath) {
13 | var normalizedCulture = config.culture.split("-")[0];
14 | var language = getBundleLanguage(normalizedCulture);
15 | var url = basePath + "/bundle-" + language + ".js";
16 | $.ajax({
17 | dataType: "script",
18 | cache: true,
19 | url: url
20 | });
21 | }
22 |
23 | function getBundleLanguage(culture) {
24 | var fallbackLanguage = "en";
25 | var availableLanguages = ["en"];
26 | return availableLanguages.indexOf(culture) > 0 ? culture : fallbackLanguage;
27 | }
28 |
29 |
30 | return {
31 | init: function (wrapper, util, params, callback) {
32 | initCallback = callback;
33 | utility = util;
34 | settings = params.settings;
35 |
36 | if (!settings) {
37 | throw new Error("Azure AD B2C settings are not defined in persona bar customSettings");
38 | }
39 |
40 | var publicPath = settings.uiUrl + "/scripts/bundles/";
41 | window.dnn.initAzureADB2C = function initializeAzureADB2C() {
42 | return {
43 | publicPath: publicPath,
44 | apiServiceUrl: settings.apiUrl,
45 | libraryVersion: settings.libraryVersion,
46 | loader: loader,
47 | utility: util,
48 | moduleName: 'AzureADB2C',
49 | notifier: {
50 | confirm: util.confirm,
51 | notify: util.notify,
52 | notifyError: util.notifyError
53 | }
54 | };
55 | }
56 | loadScript(publicPath);
57 |
58 | if (typeof callback === "function") {
59 | callback();
60 | }
61 | },
62 |
63 | load: function (params, callback) {
64 | var azureADB2C = window.dnn.azureADB2C;
65 | if (azureADB2C && azureADB2C.load) {
66 | azureADB2C.load();
67 | }
68 |
69 | if (typeof callback === "function") {
70 | callback();
71 | }
72 | }
73 | };
74 | });
75 |
--------------------------------------------------------------------------------
/samples/ChromeExtension/src/authPopup.js:
--------------------------------------------------------------------------------
1 | // Create the main myMSALObj instance
2 | // configuration parameters are located at authConfig.js
3 | const myMSALObj = new Msal.UserAgentApplication(msalConfig);
4 |
5 | function signIn() {
6 | myMSALObj.loginPopup(loginRequest)
7 | .then(loginResponse => {
8 | console.log("id_token acquired at: " + new Date().toString());
9 | console.log(loginResponse);
10 |
11 | if (myMSALObj.getAccount()) {
12 | updateUI();
13 | }
14 |
15 | }).catch(error => {
16 | console.log(error);
17 |
18 | // Error handling
19 | if (error.errorMessage) {
20 | // Check for forgot password error
21 | // Learn more about AAD error codes at https://docs.microsoft.com/en-us/azure/active-directory/develop/reference-aadsts-error-codes
22 | if (error.errorMessage.indexOf("AADB2C90118") > -1) {
23 | myMSALObj.loginPopup(b2cPolicies.authorities.forgotPassword)
24 | .then(loginResponse => {
25 | console.log(loginResponse);
26 | window.alert("Password has been reset successfully. \nPlease sign-in with your new password.");
27 | })
28 | }
29 | }
30 | });
31 | }
32 |
33 | // Sign-out the user
34 | function logout() {
35 | // Removes all sessions, need to call AAD endpoint to do full logout
36 | myMSALObj.logout();
37 | updateUI();
38 | }
39 |
40 | function getTokenPopup(request) {
41 | return myMSALObj.acquireTokenSilent(request)
42 | .catch(error => {
43 | console.log("Silent token acquisition fails. Acquiring token using popup");
44 | console.log(error);
45 | // fallback to interaction when silent call fails
46 | return myMSALObj.acquireTokenPopup(request)
47 | .then(tokenResponse => {
48 | console.log("access_token acquired at: " + new Date().toString());
49 | return tokenResponse;
50 | }).catch(error => {
51 | console.log(error);
52 | });
53 | });
54 | }
55 |
56 | function editProfile() {
57 | myMSALObj.loginPopup(b2cPolicies.authorities.editProfile)
58 | .then(tokenResponse => {
59 | console.log("access_token acquired at: " + new Date().toString());
60 | console.log(tokenResponse);
61 | });
62 | }
63 |
64 | function refreshItems() {
65 | getTokenPopup(tokenRequest)
66 | .then(tokenResponse => {
67 | console.log("access_token acquired at: " + new Date().toString());
68 | try {
69 | console.log("Login success. Initializing todo list view model");
70 | viewmodel = new SPA_WebAPI_Client.itemListViewModel(apiConfig.webApi, tokenResponse.accessToken);
71 | viewmodel.init();
72 | } catch(err) {
73 | console.log(err);
74 | }
75 | });
76 | }
77 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Logoff.ascx.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 |
3 | //
4 | // Intelequia Software solutions - https://intelequia.com
5 | // Copyright (c) 2019
6 | // by Intelequia Software Solutions
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11 | // to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 | // of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 |
22 | #endregion
23 |
24 | #region Usings
25 |
26 | using System;
27 | using DotNetNuke.Authentication.Azure.B2C.Components;
28 | using DotNetNuke.Common;
29 | using DotNetNuke.Common.Utilities;
30 | using DotNetNuke.Security.Permissions;
31 | using DotNetNuke.Services.Authentication;
32 |
33 | #endregion
34 |
35 | namespace DotNetNuke.Authentication.Azure.B2C
36 | {
37 | public partial class Logoff : AuthenticationLogoffBase
38 | {
39 | protected override void OnInit(EventArgs e)
40 | {
41 | base.OnInit(e);
42 | var oauthClient = new AzureClient(PortalId, AuthMode.Login);
43 | oauthClient.Logout();
44 | OnLogOff(e);
45 | // Fix: Avoid redirecting to the B2C logout path and query
46 | if (Request.UrlReferrer != null
47 | && Request.UrlReferrer.Host == oauthClient.LogoutEndpoint.Host
48 | && PortalSettings.Registration.RedirectAfterLogout == Null.NullInteger
49 | && TabPermissionController.CanViewPage()
50 | && !(PortalSettings.ActiveTab.TabID == PortalSettings.UserTabId
51 | || PortalSettings.ActiveTab.ParentId == PortalSettings.UserTabId))
52 | {
53 | Response.Redirect(Globals.NavigateURL(PortalSettings.ActiveTab.TabID));
54 | }
55 | else
56 | {
57 | OnRedirect(e);
58 | }
59 |
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Components/MenuController.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 |
3 | //
4 | // Intelequia Software solutions - https://intelequia.com
5 | // Copyright (c) 2019
6 | // by Intelequia Software Solutions
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11 | // to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 | // of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 |
22 | #endregion
23 |
24 | using System.Collections.Generic;
25 | using Dnn.PersonaBar.Library.Controllers;
26 | using Dnn.PersonaBar.Library.Model;
27 | using DotNetNuke.Entities.Portals;
28 | using DotNetNuke.Entities.Users;
29 |
30 | namespace DotNetNuke.Authentication.Azure.B2C.Components
31 | {
32 | public class MenuController : IMenuItemController
33 | {
34 | public void UpdateParameters(MenuItem menuItem)
35 | {
36 | }
37 |
38 | public bool Visible(MenuItem menuItem)
39 | {
40 | var user = UserController.Instance.GetCurrentUserInfo();
41 | return user != null && user.IsSuperUser;
42 | }
43 |
44 | public IDictionary GetSettings(MenuItem menuItem)
45 | {
46 | return PortalSettings.Current == null ? null : GetSettings(PortalSettings.Current.PortalId);
47 | }
48 |
49 | public IDictionary GetSettings(int portalId)
50 | {
51 | #if DEBUG
52 | var uiUrl = "http://localhost:8080/dist";
53 | #else
54 | var uiUrl = "./Modules/Dnn.AzureADB2C";
55 | #endif
56 | var apiUrl = "/DesktopModules/Admin/Dnn.PersonaBar/Modules/Dnn.AzureADB2C";
57 | var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
58 |
59 | return new Dictionary
60 | {
61 | {"uiUrl", uiUrl},
62 | {"apiUrl", apiUrl},
63 | {"libraryVersion", version },
64 | };
65 | }
66 |
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/samples/active-directory-b2c-dotnet-webapp-and-webapi/TaskService/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C.Extensibility/DotNetNuke.Authentication.Azure.B2C.Extensibility.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {42445032-9098-4160-930D-4127DC292695}
8 | Library
9 | Properties
10 | DotNetNuke.Authentication.Azure.B2C.Extensibility
11 | DotNetNuke.Authentication.Azure.B2C.Extensibility
12 | v4.7.2
13 | 512
14 | true
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 | bin\Release Legacy\
35 | TRACE
36 | true
37 | pdbonly
38 | AnyCPU
39 | 7.3
40 | prompt
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/components/roleMappings/roleMappingRow/style.less:
--------------------------------------------------------------------------------
1 | @import "~@dnnsoftware/dnn-react-common/styles/index.less";
2 | .collapsible-component-item {
3 | display: block;
4 | float: left;
5 | width: 100%;
6 | cursor: auto;
7 | &:not(:last-child) {
8 | border-bottom: 1px solid @alto;
9 | }
10 | div.collapsible-item {
11 | width: 100%;
12 | float: left;
13 | position: relative;
14 | padding: 15px 0 10px 0;
15 | box-sizing: border-box;
16 | cursor: auto;
17 | .row {
18 | float: left;
19 | width: 100%;
20 | .item-row-dnnrole {
21 | width: 50%;
22 | float: left;
23 | padding-left: 15px;
24 | word-break: break-all;
25 | }
26 | .item-row-b2crole {
27 | width: 35%;
28 | float: left;
29 | white-space: nowrap;
30 | overflow: hidden;
31 | text-overflow: ellipsis;
32 | }
33 | .item-row-primary {
34 | width: 10%;
35 | float: left;
36 | text-align: center;
37 | .checkMarkIcon {
38 | width: 16px;
39 | height: 16px;
40 | margin-left: auto;
41 | margin-right: auto;
42 | > svg {
43 | fill: @thunder;
44 | }
45 | }
46 | }
47 | .item-row-actionButtons {
48 | width: 8%;
49 | margin-right: 15px;
50 | float: right;
51 | &:not(:last-child) {
52 | float: left;
53 | margin-right: 0px;
54 | }
55 | .delete-icon, .edit-icon {
56 | margin-left: 5px;
57 | float: right;
58 | display: block;
59 | cursor: pointer;
60 | > svg {
61 | width: 16px;
62 | float: left;
63 | height: 16px;
64 | &:hover {
65 | fill: @thunder;
66 | }
67 | fill: @alto;
68 | }
69 | }
70 | .delete-icon-hidden {
71 | display: none;
72 | }
73 | .edit-icon-active {
74 | > svg {
75 | width: 16px;
76 | float: right;
77 | height: 16px;
78 | fill: @curiousBlue;
79 | }
80 | }
81 | }
82 | .item-row-wrapper {
83 | padding: 0 5px 0 5px;
84 | }
85 | }
86 | }
87 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/components/userMappings/userMappingRow/style.less:
--------------------------------------------------------------------------------
1 | @import "~@dnnsoftware/dnn-react-common/styles/index.less";
2 | .collapsible-component-item {
3 | display: block;
4 | float: left;
5 | width: 100%;
6 | cursor: auto;
7 | &:not(:last-child) {
8 | border-bottom: 1px solid @alto;
9 | }
10 | div.collapsible-item {
11 | width: 100%;
12 | float: left;
13 | position: relative;
14 | padding: 15px 0 10px 0;
15 | box-sizing: border-box;
16 | cursor: auto;
17 | .row {
18 | float: left;
19 | width: 100%;
20 | .item-row-dnnproperty {
21 | width: 50%;
22 | float: left;
23 | padding-left: 15px;
24 | word-break: break-all;
25 | }
26 | .item-row-b2cproperty {
27 | width: 37%;
28 | float: left;
29 | white-space: nowrap;
30 | overflow: hidden;
31 | text-overflow: ellipsis;
32 | }
33 | .item-row-primary {
34 | width: 10%;
35 | float: left;
36 | text-align: center;
37 | .checkMarkIcon {
38 | width: 16px;
39 | height: 16px;
40 | margin-left: auto;
41 | margin-right: auto;
42 | > svg {
43 | fill: @thunder;
44 | }
45 | }
46 | }
47 | .item-row-actionButtons {
48 | width: 8%;
49 | margin-right: 15px;
50 | float: right;
51 | &:not(:last-child) {
52 | float: left;
53 | margin-right: 0px;
54 | }
55 | .delete-icon, .edit-icon {
56 | margin-left: 5px;
57 | float: right;
58 | display: block;
59 | cursor: pointer;
60 | > svg {
61 | width: 16px;
62 | float: left;
63 | height: 16px;
64 | &:hover {
65 | fill: @thunder;
66 | }
67 | fill: @alto;
68 | }
69 | }
70 | .delete-icon-hidden {
71 | display: none;
72 | }
73 | .edit-icon-active {
74 | > svg {
75 | width: 16px;
76 | float: right;
77 | height: 16px;
78 | fill: @curiousBlue;
79 | }
80 | }
81 | }
82 | .item-row-wrapper {
83 | padding: 0 5px 0 5px;
84 | }
85 | }
86 | }
87 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Components/AzureUserData.cs:
--------------------------------------------------------------------------------
1 | #region Copyright
2 |
3 | //
4 | // Intelequia Software solutions - https://intelequia.com
5 | // Copyright (c) 2019
6 | // by Intelequia Software Solutions
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11 | // to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 | // of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 |
22 | #endregion
23 |
24 | #region Usings
25 |
26 | using System.Runtime.Serialization;
27 | using DotNetNuke.Entities.Users;
28 | using DotNetNuke.Services.Authentication.OAuth;
29 |
30 | #endregion
31 |
32 | namespace DotNetNuke.Authentication.Azure.B2C.Components
33 | {
34 | [DataContract]
35 | public class AzureUserData : UserData
36 | {
37 | #region Overrides
38 |
39 | public override string FirstName
40 | {
41 | get { return AzureFirstName; }
42 | set { }
43 | }
44 |
45 | public override string LastName
46 | {
47 | get { return AzureLastName; }
48 | set { }
49 | }
50 |
51 | public override string DisplayName
52 | {
53 | get { return AzureDisplayName; }
54 | set { }
55 | }
56 |
57 | #endregion
58 |
59 | [DataMember(Name = "given_name")]
60 | public string AzureFirstName { get; set; }
61 |
62 | [DataMember(Name = "family_name")]
63 | public string AzureLastName { get; set; }
64 |
65 | [DataMember(Name = "name")]
66 | public string AzureDisplayName { get; set; }
67 |
68 | public UserInfo ToUserInfo(bool usernamePrefixEnabled)
69 | {
70 | return new UserInfo()
71 | {
72 | DisplayName = this.DisplayName,
73 | FirstName = this.FirstName,
74 | LastName = this.LastName,
75 | Email = this.Email,
76 | Username = usernamePrefixEnabled ? $"{AzureConfig.ServiceName}-{this.Id}" : this.Id
77 | };
78 | }
79 |
80 | }
81 | }
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/Providers/DataProviders/SqlDataProvider/uninstall.SqlDataProvider:
--------------------------------------------------------------------------------
1 | DELETE {databaseOwner}[{objectQualifier}PortalSettings]
2 | WHERE SettingName IN
3 | (
4 | 'AzureB2C_APIKey'
5 | , 'AzureB2C_APISecret'
6 | , 'AzureB2C_AutoRedirect'
7 | , 'AzureB2C_AutoAuthorize'
8 | , 'AzureB2C_AutoMatchExistingUsers'
9 | , 'AzureB2C_RedirectUri'
10 | , 'AzureB2C_OnErrorUri'
11 | , 'AzureB2C_Enabled'
12 | , 'AzureB2C_TenantName'
13 | , 'AzureB2C_TenantId'
14 | , 'AzureB2C_SignUpPolicy'
15 | , 'AzureB2C_ProfilePolicy'
16 | , 'AzureB2C_PasswordResetPolicy'
17 | , 'AzureB2C_AADApplicationId'
18 | , 'AzureB2C_AADApplicationKey'
19 | , 'AzureB2C_JwtAudiences'
20 | , 'AzureB2C_RoleSyncEnabled'
21 | , 'AzureB2C_ProfileSyncEnabled'
22 | , 'AzureB2C_JwtAuthEnabled'
23 | , 'AzureB2C_APIResource'
24 | , 'AzureB2C_Scopes'
25 | , 'AzureB2C_UsernamePrefixEnabled'
26 | , 'AzureB2C_GroupNamePrefixEnabled'
27 | , 'AzureB2C_B2CApplicationId'
28 | , 'AzureB2C_UserGlobalSettings'
29 | )
30 | GO
31 |
32 | DELETE {databaseOwner}[{objectQualifier}HostSettings]
33 | WHERE SettingName IN
34 | (
35 | 'AzureB2C_APIKey'
36 | , 'AzureB2C_APISecret'
37 | , 'AzureB2C_AutoRedirect'
38 | , 'AzureB2C_AutoAuthorize'
39 | , 'AzureB2C_AutoMatchExistingUsers'
40 | , 'AzureB2C_RedirectUri'
41 | , 'AzureB2C_OnErrorUri'
42 | , 'AzureB2C_Enabled'
43 | , 'AzureB2C_TenantName'
44 | , 'AzureB2C_TenantId'
45 | , 'AzureB2C_SignUpPolicy'
46 | , 'AzureB2C_ProfilePolicy'
47 | , 'AzureB2C_PasswordResetPolicy'
48 | , 'AzureB2C_AADApplicationId'
49 | , 'AzureB2C_AADApplicationKey'
50 | , 'AzureB2C_JwtAudiences'
51 | , 'AzureB2C_RoleSyncEnabled'
52 | , 'AzureB2C_ProfileSyncEnabled'
53 | , 'AzureB2C_JwtAuthEnabled'
54 | , 'AzureB2C_APIResource'
55 | , 'AzureB2C_Scopes'
56 | , 'AzureB2C_UsernamePrefixEnabled'
57 | , 'AzureB2C_GroupNamePrefixEnabled'
58 | , 'AzureB2C_B2CApplicationId'
59 | , 'AzureB2C_UserGlobalSettings'
60 | )
61 | GO
62 |
63 | DELETE FROM {databaseOwner}[{objectQualifier}Schedule]
64 | WHERE TypeFullName = 'DotNetNuke.Authentication.Azure.B2C.ScheduledTasks.SyncSchedule, DotNetNuke.Authentication.Azure.B2C'
65 | GO
66 |
67 | IF OBJECT_ID(N'{databaseOwner}[{objectQualifier}AzureB2C_UserMappings]', N'U') IS NOT NULL
68 | BEGIN
69 | DROP TABLE {databaseOwner}[{objectQualifier}AzureB2C_UserMappings]
70 | END
71 | GO
72 |
73 | IF OBJECT_ID(N'{databaseOwner}[{objectQualifier}AzureB2C_ProfileMappings]', N'U') IS NOT NULL
74 | BEGIN
75 | DROP TABLE {databaseOwner}[{objectQualifier}AzureB2C_ProfileMappings]
76 | END
77 | GO
78 |
79 | IF OBJECT_ID(N'{databaseOwner}[{objectQualifier}AzureB2C_RoleMappings]', N'U') IS NOT NULL
80 | BEGIN
81 | DROP TABLE {databaseOwner}[{objectQualifier}AzureB2C_RoleMappings]
82 | END
83 | GO
84 |
85 | IF OBJECT_ID(N'{databaseOwner}[{objectQualifier}AzureB2C_GetExpiredUserRoles]', N'P') IS NOT NULL
86 | BEGIN
87 | DROP PROCEDURE {databaseOwner}[{objectQualifier}AzureB2C_GetExpiredUserRoles]
88 | END
89 | GO
90 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/components/roleMappings/roleMappingRow/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import PropTypes from "prop-types";
3 | import { Collapsible, SvgIcons } from "@dnnsoftware/dnn-react-common";
4 | import "./style.less";
5 |
6 | class RoleMappingRow extends Component {
7 | /* eslint-disable react/no-did-mount-set-state */
8 | componentDidMount() {
9 | let opened = (this.props.openId !== "" && this.props.id === this.props.openId);
10 | this.setState({
11 | opened
12 | });
13 | }
14 |
15 | toggle() {
16 | if ((this.props.openId !== "" && this.props.id === this.props.openId)) {
17 | this.props.Collapse();
18 | }
19 | else {
20 | this.props.OpenCollapse(this.props.id);
21 | }
22 | }
23 |
24 | /* eslint-disable react/no-danger */
25 | render() {
26 | const {props} = this;
27 | let opened = (this.props.openId !== "" && this.props.id === this.props.openId);
28 | return (
29 |
30 |
31 |
32 |
33 | {props.dnnRoleName}
34 |
35 | {props.b2cRoleName}
36 |
37 | {props.deletable &&
38 |
39 | }
40 | {props.editable &&
41 |
42 | }
43 |
44 |
45 |
46 |
{opened && props.children}
47 |
48 | );
49 | }
50 | }
51 |
52 | RoleMappingRow.propTypes = {
53 | mappingId: PropTypes.string,
54 | dnnRoleName: PropTypes.string,
55 | b2cRoleName: PropTypes.string,
56 | deletable: PropTypes.bool,
57 | editable: PropTypes.bool,
58 | OpenCollapse: PropTypes.func,
59 | Collapse: PropTypes.func,
60 | onDelete: PropTypes.func,
61 | id: PropTypes.string,
62 | openId: PropTypes.string
63 | };
64 |
65 | RoleMappingRow.defaultProps = {
66 | collapsed: true,
67 | deletable: true,
68 | editable: true
69 | };
70 | export default (RoleMappingRow);
71 |
--------------------------------------------------------------------------------
/samples/SPA-WebAPI-Client/Views/Item/Index.cshtml:
--------------------------------------------------------------------------------
1 | @inherits Dnn.Modules.B2CTasksSPA_WebAPI_Client.Components.DnnB2CWebViewPage
2 |
3 | @using DotNetNuke.Web.Client.ClientResourceManagement
4 | @using DotNetNuke.Framework.JavaScriptLibraries
5 | @{
6 | JavaScript.RequestRegistration("Knockout");
7 | JavaScript.RequestRegistration("JQuery");
8 | ClientResourceManager.RegisterStyleSheet(Dnn.DnnPage, "~/DesktopModules/MVC/SPA_WebAPI_Client/module.css");
9 | ClientResourceManager.RegisterScript(Dnn.DnnPage, "~/DesktopModules/MVC/SPA_WebAPI_Client/scripts/itemView.js", 101);
10 | }
11 |
12 | @using System.Text.RegularExpressions
13 | @using DotNetNuke.Web.Mvc.Helpers
14 |
15 | To-Do List
16 |
17 | This sample module shows how to interact with an external WebAPI by using Azure AD B2C authorization. Before
18 | running this example, you need to setup the Tasks WebAPI example by following the instructions available at
19 | https://github.com/Azure-Samples/active-directory-b2c-dotnet-webapp-and-webapi .
20 | The module expects the WebAPI project available on https://localhost:44332/
21 |
22 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/DotNetNuke.Authentication.Azure.B2C/AzureADB2C.Web/src/components/userMappings/userMappingRow/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import PropTypes from "prop-types";
3 | import { Collapsible, SvgIcons } from "@dnnsoftware/dnn-react-common";
4 | import "./style.less";
5 |
6 | class UserMappingRow extends Component {
7 | /* eslint-disable react/no-did-mount-set-state */
8 | componentDidMount() {
9 | let opened = (this.props.openId !== "" && this.props.id === this.props.openId);
10 | this.setState({
11 | opened
12 | });
13 | }
14 |
15 | toggle() {
16 | if ((this.props.openId !== "" && this.props.id === this.props.openId)) {
17 | this.props.Collapse();
18 | }
19 | else {
20 | this.props.OpenCollapse(this.props.id);
21 | }
22 | }
23 |
24 | /* eslint-disable react/no-danger */
25 | render() {
26 | const {props} = this;
27 | let opened = (this.props.openId !== "" && this.props.id === this.props.openId);
28 | return (
29 |
30 |
31 |
32 |
33 | {props.dnnPropertyName}
34 |
35 | {props.b2cClaimName}
36 |
37 | {props.deletable &&
38 |
39 | }
40 | {props.editable &&
41 |
42 | }
43 |
44 |
45 |
46 |
{opened && props.children}
47 |
48 | );
49 | }
50 | }
51 |
52 | UserMappingRow.propTypes = {
53 | mappingId: PropTypes.string,
54 | dnnPropertyName: PropTypes.string,
55 | b2cClaimName: PropTypes.string,
56 | deletable: PropTypes.bool,
57 | editable: PropTypes.bool,
58 | OpenCollapse: PropTypes.func,
59 | Collapse: PropTypes.func,
60 | onDelete: PropTypes.func,
61 | id: PropTypes.string,
62 | openId: PropTypes.string
63 | };
64 |
65 | UserMappingRow.defaultProps = {
66 | collapsed: true,
67 | deletable: false,
68 | editable: true
69 | };
70 | export default (UserMappingRow);
71 |
--------------------------------------------------------------------------------