mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Compare commits
3 Commits
issue/8686
...
azureauth
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1494fee906 | ||
|
|
0173250b46 | ||
|
|
e1f05626c4 |
@@ -27,6 +27,10 @@
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -18,6 +18,10 @@
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -0,0 +1,6 @@
|
||||
[
|
||||
{
|
||||
"inputs": [ "Assets/Styles.less" ],
|
||||
"output": "Styles/Styles.css"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Orchard.Azure.Authentication.Constants {
|
||||
public class DefaultAzureSettings {
|
||||
public static readonly string Tenant = "mydirectory.onmicrosoft.com";
|
||||
public static readonly string ClientId = "MyClientId";
|
||||
public static readonly string ADInstance = "https://login.microsoftonline.com/{0}";
|
||||
public static readonly string LogoutRedirectUri = "http://localhost:30321/OrchardLocal/";
|
||||
public static readonly bool BearerAuthEnabled = false;
|
||||
public static readonly bool SSLEnabled = false;
|
||||
public static readonly bool AzureWebSiteProtectionEnabled = false;
|
||||
public static readonly string GraphiApiUri = "https://graph.windows.net";
|
||||
public static readonly string GraphApiKey = "XSpN3xxGE7KgjLF/3lk2PBz98eAQpIMwUQUvoB/bZXs=";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using Microsoft.Owin.Security;
|
||||
using Microsoft.Owin.Security.Cookies;
|
||||
using Microsoft.Owin.Security.OpenIdConnect;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Security;
|
||||
using Orchard.Themes;
|
||||
using System.Web;
|
||||
using System.Web.Configuration;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Azure.Authentication.Services;
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.Azure.Authentication.Controllers {
|
||||
[Themed]
|
||||
[OrchardSuppressDependency("Orchard.Users.Controllers.AccountController")]
|
||||
public class AccountController : Controller {
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
private readonly IAzureGraphiApiService _graphiApiService;
|
||||
private readonly IAzureRolesPersistence _azureRolesPersistence;
|
||||
|
||||
public AccountController(IAzureGraphiApiService graphiApiService, IAzureRolesPersistence azureRolesPersistence) {
|
||||
Logger = NullLogger.Instance;
|
||||
_graphiApiService = graphiApiService;
|
||||
_azureRolesPersistence = azureRolesPersistence;
|
||||
}
|
||||
public void LogOn() {
|
||||
if (Request.IsAuthenticated) {
|
||||
return; //TODO: redirect to home if we can?
|
||||
}
|
||||
|
||||
var redirectUri = Url.Content("~/users/account/logoncallback");
|
||||
|
||||
HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties {RedirectUri = redirectUri},
|
||||
OpenIdConnectAuthenticationDefaults.AuthenticationType);
|
||||
}
|
||||
|
||||
public void LogOff() {
|
||||
HttpContext.GetOwinContext().Authentication.SignOut(
|
||||
OpenIdConnectAuthenticationDefaults.AuthenticationType, CookieAuthenticationDefaults.AuthenticationType); //OpenID Connect sign-out request.
|
||||
}
|
||||
|
||||
public ActionResult LogonCallback() {
|
||||
var userName = HttpContext.GetOwinContext().Authentication.User.Identity.Name.Trim();
|
||||
|
||||
try {
|
||||
var groups = _graphiApiService.GetUserGroups(userName);
|
||||
_azureRolesPersistence.SyncAzureGroupsToOrchardRoles(userName, groups);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Logger.Error(ex.Message, ex);
|
||||
}
|
||||
|
||||
return Redirect(Url.Content("~/"));
|
||||
}
|
||||
|
||||
[AlwaysAccessible]
|
||||
public ActionResult AccessDenied() {
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Azure.Authentication.Models;
|
||||
|
||||
namespace Orchard.Azure.Authentication.Drivers {
|
||||
public class AzureSettingsPartDriver : ContentPartDriver<AzureSettingsPart> {
|
||||
protected override string Prefix {
|
||||
get { return "AzureSettings"; }
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(AzureSettingsPart part, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_AzureSettings_Edit", () =>
|
||||
shapeHelper.EditorTemplate(TemplateName: "Parts/AzureSettings", Model: part, Prefix: Prefix)).OnGroup("Azure");
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(AzureSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
updater.TryUpdateModel(part, Prefix, null, null);
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Data;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Azure.Authentication.Models;
|
||||
|
||||
namespace Orchard.Azure.Authentication.Handlers {
|
||||
public class AzureSettingsPartHandler : ContentHandler {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public AzureSettingsPartHandler() {
|
||||
T= NullLocalizer.Instance;
|
||||
Filters.Add(new ActivatingFilter<AzureSettingsPart>("Site"));
|
||||
Filters.Add(new TemplateFilterForPart<AzureSettingsPart>("AzureSettings", "Parts/AzureSettings", "Azure Authentication"));
|
||||
}
|
||||
|
||||
protected override void GetItemMetadata(GetContentItemMetadataContext context) {
|
||||
if (context.ContentItem.ContentType != "Site") {
|
||||
return;
|
||||
}
|
||||
|
||||
base.GetItemMetadata(context);
|
||||
context.Metadata.EditorGroupInfo.Add(new GroupInfo(T("Azure Authentication")));
|
||||
}
|
||||
}
|
||||
}
|
||||
201
src/Orchard.Web/Modules/Orchard.Azure.Authentication/LICENSE.txt
Normal file
201
src/Orchard.Web/Modules/Orchard.Azure.Authentication/LICENSE.txt
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2015 Radio Systems Corporation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,55 @@
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Azure.Authentication.Models {
|
||||
public class AzureSettingsPart : ContentPart{
|
||||
public string Tenant {
|
||||
get { return this.Retrieve(x => x.Tenant); }
|
||||
set { this.Store(x => x.Tenant, value); }
|
||||
}
|
||||
|
||||
public string ADInstance {
|
||||
get { return this.Retrieve(x => x.ADInstance); }
|
||||
set { this.Store(x => x.ADInstance, value); }
|
||||
}
|
||||
|
||||
public string ClientId {
|
||||
get { return this.Retrieve(x => x.ClientId); }
|
||||
set { this.Store(x => x.ClientId, value); }
|
||||
}
|
||||
|
||||
public string AppName {
|
||||
get { return this.Retrieve(x => x.AppName); }
|
||||
set { this.Store(x => x.AppName, value); }
|
||||
}
|
||||
|
||||
public string LogoutRedirectUri {
|
||||
get { return this.Retrieve(x => x.LogoutRedirectUri); }
|
||||
set { this.Store(x => x.LogoutRedirectUri, value); }
|
||||
}
|
||||
|
||||
public bool BearerAuthEnabled {
|
||||
get { return this.Retrieve(x => x.BearerAuthEnabled); }
|
||||
set { this.Store(x => x.BearerAuthEnabled, value); }
|
||||
}
|
||||
|
||||
public bool SSLEnabled {
|
||||
get { return this.Retrieve(x => x.SSLEnabled); }
|
||||
set { this.Store(x => x.SSLEnabled, value); }
|
||||
}
|
||||
|
||||
public bool AzureWebSiteProtectionEnabled {
|
||||
get { return this.Retrieve(x => x.AzureWebSiteProtectionEnabled); }
|
||||
set { this.Store(x => x.AzureWebSiteProtectionEnabled, value); }
|
||||
}
|
||||
|
||||
public string GraphApiUrl {
|
||||
get { return this.Retrieve(x => x.GraphApiUrl); }
|
||||
set { this.Store(x => x.GraphApiUrl, value); }
|
||||
}
|
||||
|
||||
public bool UseAzureGraphApi {
|
||||
get { return this.Retrieve(x => x.UseAzureGraphApi); }
|
||||
set { this.Store(x => x.UseAzureGraphApi, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
Name: Orchard.Azure.Authentication
|
||||
AntiForgery: enabled
|
||||
Author: Radio Systems Corp.
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.0
|
||||
OrchardVersion: 1.9.2
|
||||
Description: Description for the module
|
||||
Features:
|
||||
Orchard.Azure.Authentication:
|
||||
Description: Provides Azure Active Directory authentication.
|
||||
Category: Authentication
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{60D63D66-E88E-4D07-82EE-C1561903A73E}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Orchard.Azure.Authentication</RootNamespace>
|
||||
<AssemblyName>Orchard.Azure.Authentication</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<MvcBuildViews>false</MvcBuildViews>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>4.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<TargetFrameworkProfile />
|
||||
<UseIISExpress>false</UseIISExpress>
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Iesi.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Iesi.Collections.4.0.1.4000\lib\net40\Iesi.Collections.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Azure.ActiveDirectory.GraphClient, Version=2.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Azure.ActiveDirectory.GraphClient.2.1.0\lib\portable-net4+sl5+win+wpa+wp8\Microsoft.Azure.ActiveDirectory.GraphClient.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Data.Edm, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Data.Services.Client, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.19.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.19.208020213\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms, Version=2.19.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.19.208020213\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.IdentityModel.Logging, Version=1.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Logging.1.0.0\lib\net451\Microsoft.IdentityModel.Logging.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.IdentityModel.Protocol.Extensions, Version=1.0.2.33, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Protocol.Extensions.1.0.2.206221351\lib\net45\Microsoft.IdentityModel.Protocol.Extensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.IdentityModel.Tokens, Version=5.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Tokens.5.0.0\lib\net451\Microsoft.IdentityModel.Tokens.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.SystemWeb, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Security, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Security.ActiveDirectory, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Owin.Security.ActiveDirectory.3.0.1\lib\net45\Microsoft.Owin.Security.ActiveDirectory.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Security.Cookies, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Owin.Security.Cookies.3.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Security.Jwt, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Owin.Security.Jwt.3.0.1\lib\net45\Microsoft.Owin.Security.Jwt.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Security.OAuth, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Security.OpenIdConnect, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Owin.Security.OpenIdConnect.3.0.1\lib\net45\Microsoft.Owin.Security.OpenIdConnect.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=4.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.4.0.1.4000\lib\net40\NHibernate.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.IdentityModel" />
|
||||
<Reference Include="System.IdentityModel.Tokens.Jwt, Version=5.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.IdentityModel.Tokens.Jwt.5.0.0\lib\net451\System.IdentityModel.Tokens.Jwt.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Spatial, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets.json" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Scripts\Web.config" />
|
||||
<Content Include="Module.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Roles\Orchard.Roles.csproj">
|
||||
<Project>{d10ad48f-407d-4db5-a328-173ec7cb010f}</Project>
|
||||
<Name>Orchard.Roles</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Users\Orchard.Users.csproj">
|
||||
<Project>{79aed36e-abd0-4747-93d3-8722b042454b}</Project>
|
||||
<Name>Orchard.Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Constants\DefaultAzureSettings.cs" />
|
||||
<Compile Include="Controllers\AccountController.cs" />
|
||||
<Compile Include="Drivers\AzureSettingsPartDriver.cs" />
|
||||
<Compile Include="Handlers\AzureSettingsPartHandler.cs" />
|
||||
<Compile Include="Models\AzureSettingsPart.cs" />
|
||||
<Compile Include="OwinMiddlewares.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Routes.cs" />
|
||||
<Compile Include="Security\MachineKeyDataProtector.cs" />
|
||||
<Compile Include="Services\AzureActiveDirectoryService.cs" />
|
||||
<Compile Include="Services\AzureAuthenticationService.cs" />
|
||||
<Compile Include="Services\AzureGraphiApiService.cs" />
|
||||
<Compile Include="Services\AzureRolesPersistence.cs" />
|
||||
<Compile Include="Services\IAzureGraphiApiService.cs" />
|
||||
<Compile Include="Services\IAzureRolesPersistence.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="placement.info" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\EditorTemplates\Parts\AzureSettings.cshtml" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target> -->
|
||||
<Target Name="AfterBuild" DependsOnTargets="AfterBuildCompiler">
|
||||
<PropertyGroup>
|
||||
<AreasManifestDir>$(ProjectDir)\..\Manifests</AreasManifestDir>
|
||||
</PropertyGroup>
|
||||
<!-- If this is an area child project, uncomment the following line:
|
||||
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Child" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
|
||||
-->
|
||||
<!-- If this is an area parent project, uncomment the following lines:
|
||||
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Parent" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
|
||||
<CopyAreaManifests ManifestPath="$(AreasManifestDir)" CrossCopy="false" RenameViews="true" />
|
||||
-->
|
||||
</Target>
|
||||
<Target Name="AfterBuildCompiler" Condition="'$(MvcBuildViews)'=='true'">
|
||||
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
|
||||
</Target>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>45979</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>
|
||||
</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>True</UseCustomServer>
|
||||
<CustomServerUrl>http://orchard.codeplex.com</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -0,0 +1,134 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Security.Claims;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.WebPages;
|
||||
using Microsoft.IdentityModel.Clients.ActiveDirectory;
|
||||
using Microsoft.Owin.Security;
|
||||
using Microsoft.Owin.Security.Cookies;
|
||||
using Microsoft.Owin.Security.DataProtection;
|
||||
using Microsoft.Owin.Security.OpenIdConnect;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Owin;
|
||||
using Orchard.Settings;
|
||||
using Owin;
|
||||
using Orchard.Azure.Authentication.Constants;
|
||||
using Orchard.Azure.Authentication.Models;
|
||||
using Orchard.Azure.Authentication.Security;
|
||||
using Orchard.Azure.Authentication.Services;
|
||||
using AuthenticationContext = Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext;
|
||||
using LogLevel = Orchard.Logging.LogLevel;
|
||||
|
||||
namespace Orchard.Azure.Authentication {
|
||||
public class OwinMiddlewares : IOwinMiddlewareProvider {
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
private readonly string _azureClientId = DefaultAzureSettings.ClientId;
|
||||
private readonly string _azureTenant = DefaultAzureSettings.Tenant;
|
||||
private readonly string _logoutRedirectUri = DefaultAzureSettings.LogoutRedirectUri;
|
||||
private readonly string _azureAdInstance = DefaultAzureSettings.ADInstance;
|
||||
private readonly bool _azureWebSiteProtectionEnabled = DefaultAzureSettings.AzureWebSiteProtectionEnabled;
|
||||
private readonly string _azureGraphiApiUri = DefaultAzureSettings.GraphiApiUri;
|
||||
private readonly string _azureGraphApiKey = DefaultAzureSettings.GraphApiKey;
|
||||
|
||||
|
||||
public OwinMiddlewares(ISiteService siteService) {
|
||||
Logger = NullLogger.Instance;
|
||||
|
||||
try {
|
||||
var settings = siteService.GetSiteSettings().As<AzureSettingsPart>();
|
||||
|
||||
if (settings == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
_azureClientId = string.IsNullOrEmpty(settings.ClientId) ? _azureClientId : settings.ClientId;
|
||||
_azureTenant = string.IsNullOrEmpty(settings.Tenant) ? _azureTenant : settings.Tenant;
|
||||
_azureAdInstance = string.IsNullOrEmpty(settings.ADInstance) ? _azureAdInstance : settings.ADInstance;
|
||||
_logoutRedirectUri = string.IsNullOrEmpty(settings.LogoutRedirectUri) ? _logoutRedirectUri : settings.LogoutRedirectUri;
|
||||
_azureWebSiteProtectionEnabled = settings.AzureWebSiteProtectionEnabled;
|
||||
_azureGraphiApiUri = string.IsNullOrEmpty(settings.GraphApiUrl) ? _azureGraphiApiUri : settings.GraphApiUrl;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Logger.Log(LogLevel.Debug, ex, "An error occured while accessing azure settings: {0}");
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<OwinMiddlewareRegistration> GetOwinMiddlewares() {
|
||||
var middlewares = new List<OwinMiddlewareRegistration>();
|
||||
|
||||
AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;
|
||||
|
||||
var openIdOptions = new OpenIdConnectAuthenticationOptions {
|
||||
ClientId = _azureClientId,
|
||||
Authority = string.Format(CultureInfo.InvariantCulture, _azureAdInstance, _azureTenant), // e.g. "https://login.windows.net/azurefridays.onmicrosoft.com/"
|
||||
PostLogoutRedirectUri = _logoutRedirectUri,
|
||||
Notifications = new OpenIdConnectAuthenticationNotifications()
|
||||
};
|
||||
|
||||
var cookieOptions = new CookieAuthenticationOptions();
|
||||
|
||||
if (_azureWebSiteProtectionEnabled) {
|
||||
middlewares.Add(new OwinMiddlewareRegistration {
|
||||
Priority = "9",
|
||||
Configure = app => { app.SetDataProtectionProvider(new MachineKeyProtectionProvider()); }
|
||||
});
|
||||
}
|
||||
|
||||
middlewares.Add(new OwinMiddlewareRegistration {
|
||||
Priority = "10",
|
||||
Configure = app => {
|
||||
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
|
||||
|
||||
app.UseCookieAuthentication(cookieOptions);
|
||||
|
||||
app.UseOpenIdConnectAuthentication(openIdOptions);
|
||||
}
|
||||
});
|
||||
|
||||
middlewares.Add(new OwinMiddlewareRegistration {
|
||||
Priority = "11",
|
||||
Configure = app => app.Use(async (context, next) => {
|
||||
try {
|
||||
if (AzureActiveDirectoryService.token == null && AzureActiveDirectoryService.token.IsEmpty()) {
|
||||
RegenerateAzureGraphApiToken();
|
||||
}
|
||||
else {
|
||||
if (DateTimeOffset.Compare(DateTimeOffset.UtcNow, AzureActiveDirectoryService.tokenExpiresOn) > 0) {
|
||||
RegenerateAzureGraphApiToken();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Logger.Log(LogLevel.Error, ex, "An error occured generating azure api credential {0}", ex.Message);
|
||||
}
|
||||
|
||||
await next.Invoke();
|
||||
})
|
||||
});
|
||||
|
||||
return middlewares;
|
||||
}
|
||||
|
||||
private void RegenerateAzureGraphApiToken() {
|
||||
var result = GetAuthContext().AcquireToken(_azureGraphiApiUri, GetClientCredential());
|
||||
|
||||
AzureActiveDirectoryService.tokenExpiresOn = result.ExpiresOn;
|
||||
AzureActiveDirectoryService.token = result.AccessToken;
|
||||
AzureActiveDirectoryService.azureGraphApiUri = _azureGraphiApiUri;
|
||||
AzureActiveDirectoryService.azureTenant = _azureTenant;
|
||||
}
|
||||
|
||||
private ClientCredential GetClientCredential() {
|
||||
return new ClientCredential(_azureClientId, _azureGraphApiKey);
|
||||
}
|
||||
|
||||
private AuthenticationContext GetAuthContext() {
|
||||
var authority = string.Format(CultureInfo.InvariantCulture, _azureAdInstance, _azureTenant);
|
||||
|
||||
return new AuthenticationContext(authority, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Orchard.Azure.Authentication")]
|
||||
[assembly: AssemblyDescription("Orchard module that enables authentication with Windows Azure Active Directory")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Orchard.Azure.Authentication")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("ff308bcd-8cf0-4103-b8aa-f7444985ca56")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,15 @@
|
||||
# Orchard Azure Authentication Module
|
||||
|
||||
Orchard Azure Authentication is a module that enables Azure Authentication to Orchard using Azure Active Directory and OpenID connect. The module overrides the default login and integrates into the standard pipeline for Orchard.
|
||||
|
||||
## How to use
|
||||
|
||||
1. If you don't have an Azure Active Directory, get more info [here](https://azure.microsoft.com/en-us/documentation/articles/active-directory-whatis/). Create an application in Azure that will correspond to your Orchard instance. The settings you will need to configure Orchard Azure Active Directory Authentication will be on the configure tab of the created application.
|
||||
2. Before enabling the module, your must add an admin user to Orchard via the Orchard admin. Ensure that the user name matches the Azure Active Directory user name for the user you wish to have admin privileges.
|
||||
3. After enabling the module, before navigating away from the admin, go to site settings under the **Azure Authentication** group. Fill in the information from your Azure Active Directory. Tenant, AppName, and ClientId must be set. Other fields can be left as defaults.
|
||||
4. You will have to restart your Orchard site for the new settings to take effect.
|
||||
5. Navigate to the Orchard home screen. Clear site cookies, and watch Azure Authentication take over!
|
||||
|
||||
## License
|
||||
|
||||
This module is licensed under the Apache 2.0 license, a copy is included in the repository.
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.Mvc.Routes;
|
||||
|
||||
namespace Orchard.Azure.Authentication {
|
||||
public class Routes : IRouteProvider {
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"Users/Account/{action}",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Azure.Authentication"},
|
||||
{"controller", "Account"}
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Azure.Authentication"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var route in GetRoutes()) {
|
||||
routes.Add(route);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<system.webServer>
|
||||
<staticContent>
|
||||
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
|
||||
</staticContent>
|
||||
|
||||
<handlers accessPolicy="Script,Read">
|
||||
<!--
|
||||
iis7 - for any request to a file exists on disk, return it via native http module.
|
||||
accessPolicy 'Script' is to allow for a managed 404 page.
|
||||
-->
|
||||
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Web.Security;
|
||||
using Microsoft.Owin.Security.DataProtection;
|
||||
|
||||
namespace Orchard.Azure.Authentication.Security {
|
||||
public class MachineKeyProtectionProvider : IDataProtectionProvider {
|
||||
public IDataProtector Create(params string[] purposes) {
|
||||
return new MachineKeyDataProtector(purposes);
|
||||
}
|
||||
}
|
||||
|
||||
public class MachineKeyDataProtector : IDataProtector {
|
||||
private readonly string[] _purposes;
|
||||
|
||||
public MachineKeyDataProtector(string[] purposes) {
|
||||
_purposes = purposes;
|
||||
}
|
||||
|
||||
public byte[] Protect(byte[] userData) {
|
||||
return MachineKey.Protect(userData, _purposes);
|
||||
}
|
||||
|
||||
public byte[] Unprotect(byte[] protectedData) {
|
||||
return MachineKey.Unprotect(protectedData, _purposes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.WebPages;
|
||||
using Microsoft.Azure.ActiveDirectory.GraphClient;
|
||||
using Orchard.Azure.Authentication.Constants;
|
||||
|
||||
namespace Orchard.Azure.Authentication.Services {
|
||||
public class AzureActiveDirectoryService {
|
||||
public static string token;
|
||||
public static DateTimeOffset tokenExpiresOn;
|
||||
public static string azureGraphApiUri = DefaultAzureSettings.GraphiApiUri;
|
||||
public static string azureTenant = DefaultAzureSettings.Tenant;
|
||||
|
||||
public static async Task<string> AcquireTokenAsync() {
|
||||
if (token == null || token.IsEmpty()) {
|
||||
throw new Exception("Authorization Required.");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
public static ActiveDirectoryClient GetActiveDirectoryClient() {
|
||||
var baseServiceUri = new Uri("https://graph.windows.net/");
|
||||
|
||||
var activeDirectoryClient = new ActiveDirectoryClient(new Uri(baseServiceUri, azureTenant),
|
||||
async () => await AcquireTokenAsync());
|
||||
|
||||
return activeDirectoryClient;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.Security;
|
||||
|
||||
namespace Orchard.Azure.Authentication.Services {
|
||||
public class AzureAuthenticationService : IAuthenticationService {
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IMembershipService _membershipService;
|
||||
private IUser _localAuthenticationUser;
|
||||
|
||||
public AzureAuthenticationService(IHttpContextAccessor httpContextAccessor, IMembershipService membershipService) {
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_membershipService = membershipService;
|
||||
}
|
||||
|
||||
public void SignIn(IUser user, bool createPersistentCookie) {}
|
||||
|
||||
public void SignOut() {}
|
||||
|
||||
public void SetAuthenticatedUserForRequest(IUser user) { }
|
||||
|
||||
public IUser GetAuthenticatedUser() {
|
||||
var azureUser = _httpContextAccessor.Current().GetOwinContext().Authentication.User;
|
||||
|
||||
if (!azureUser.Identity.IsAuthenticated) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// In memory caching of sorts since this method gets called many times per request
|
||||
if (_localAuthenticationUser != null) {
|
||||
return _localAuthenticationUser;
|
||||
}
|
||||
|
||||
var userName = azureUser.Identity.Name.Trim();
|
||||
|
||||
//Get the local user, if local user account doesn't exist, create it
|
||||
var localUser = _membershipService.GetUser(userName) ?? _membershipService.CreateUser(new CreateUserParams(
|
||||
userName, Membership.GeneratePassword(16, 1), userName, string.Empty, string.Empty, true
|
||||
));
|
||||
|
||||
return _localAuthenticationUser = localUser;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Microsoft.Azure.ActiveDirectory.GraphClient;
|
||||
|
||||
namespace Orchard.Azure.Authentication.Services {
|
||||
public class AzureGraphiApiService : IAzureGraphiApiService {
|
||||
private readonly ActiveDirectoryClient _client;
|
||||
|
||||
public AzureGraphiApiService() {
|
||||
_client = AzureActiveDirectoryService.GetActiveDirectoryClient();
|
||||
}
|
||||
|
||||
public IUser GetUser(string userName) {
|
||||
var azureUser = _client.Users.Where(x => x.UserPrincipalName == userName)
|
||||
.ExecuteAsync().Result.CurrentPage.FirstOrDefault();
|
||||
return azureUser;
|
||||
}
|
||||
|
||||
public IList<Group> GetUserGroups(string userName) {
|
||||
var user = GetUser(userName);
|
||||
var userFetcher = (IUserFetcher) user;
|
||||
var groups = userFetcher.MemberOf.ExecuteAsync()
|
||||
.Result.CurrentPage.Select(x => x as Group).ToList();
|
||||
groups.RemoveAll(x => x == null);
|
||||
return groups;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Azure.ActiveDirectory.GraphClient;
|
||||
using NHibernate;
|
||||
using Orchard.Data;
|
||||
using Orchard.Roles.Models;
|
||||
using Orchard.Roles.Services;
|
||||
using Orchard.Security;
|
||||
|
||||
namespace Orchard.Azure.Authentication.Services {
|
||||
public class AzureRolesPersistence : IAzureRolesPersistence {
|
||||
private readonly IRoleService _roleService;
|
||||
private readonly IMembershipService _membershipService;
|
||||
private readonly ISession _session;
|
||||
|
||||
public AzureRolesPersistence(IRoleService roleService, IMembershipService membershipService,
|
||||
ITransactionManager transactionManager) {
|
||||
_roleService = roleService;
|
||||
_membershipService = membershipService;
|
||||
_session = transactionManager.GetSession();
|
||||
}
|
||||
|
||||
public void SyncAzureGroupsToOrchardRoles(string userName, IList<Group> azureGroups) {
|
||||
var user = _membershipService.GetUser(userName);
|
||||
|
||||
var matchingOrchardRoles = azureGroups.Select(@group => _roleService.GetRoleByName(@group.DisplayName))
|
||||
.Where(orchardRole => orchardRole != null).ToList();
|
||||
|
||||
foreach (var role in matchingOrchardRoles) {
|
||||
var existingUserRole = _session.QueryOver<UserRolesPartRecord>()
|
||||
.Where(x => x.UserId == user.Id).And(x => x.Role.Id == role.Id).List().FirstOrDefault();
|
||||
|
||||
if (existingUserRole == null) {
|
||||
_session.SaveOrUpdate(new UserRolesPartRecord {
|
||||
Role = role,
|
||||
UserId = user.Id
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Azure.ActiveDirectory.GraphClient;
|
||||
|
||||
namespace Orchard.Azure.Authentication.Services {
|
||||
public interface IAzureGraphiApiService : IDependency {
|
||||
IUser GetUser(string userName);
|
||||
IList<Group> GetUserGroups(string userObjectId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Azure.ActiveDirectory.GraphClient;
|
||||
|
||||
namespace Orchard.Azure.Authentication.Services {
|
||||
public interface IAzureRolesPersistence : IDependency {
|
||||
void SyncAzureGroupsToOrchardRoles(string userName, IList<Group> azureGroups);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
@model Orchard.Azure.Authentication.Models.AzureSettingsPart
|
||||
|
||||
<fieldset>
|
||||
<legend>Azure Active Directory Settings</legend>
|
||||
@Html.LabelFor(m => m.Tenant, T("Tenant"))
|
||||
@Html.TextBoxFor(m => m.Tenant)
|
||||
<span class="hint">@T("Azure Active Directory tenant (e.g. mysite.onmicrosoft.com)")</span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.ADInstance, T("Active Directory Instance"))
|
||||
@Html.TextBoxFor(m => m.ADInstance)
|
||||
<span class="hint">@T("Default instance is https://login.microsoftonline.com/{your-tenant-name}")</span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.ClientId)
|
||||
@Html.TextBoxFor(m => m.ClientId)
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.AppName)
|
||||
@Html.TextBoxFor(m => m.AppName)
|
||||
<span class="hint">@T("Application name you wish to give active directly login rights to")</span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.LogoutRedirectUri, T("Logout Redirect"))
|
||||
@Html.TextBoxFor(m => m.LogoutRedirectUri)
|
||||
<span class="hint">@T("Redirect url after azure logout, default is http://localhost:30321/OrchardLocal/")</span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.BearerAuthEnabled, T("Enable Bearer Token Authentication"))
|
||||
@Html.CheckBoxFor(m => m.BearerAuthEnabled)
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.SSLEnabled, T("Use SSL Protocol for valid audience"))
|
||||
@Html.CheckBoxFor(m => m.SSLEnabled)
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.AzureWebSiteProtectionEnabled, T("Enable Machine Key Data Protection for Azure Web Site"))
|
||||
@Html.CheckBoxFor(m => m.AzureWebSiteProtectionEnabled)
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.GraphApiUrl)
|
||||
@Html.TextBoxFor(m => m.GraphApiUrl)
|
||||
<span class="hint">@T("Typically https://graph.windows.net")</span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(m => m.UseAzureGraphApi)
|
||||
@Html.CheckBoxFor(m => m.UseAzureGraphApi)
|
||||
<span class="hint">@T("Check this box to enable syncing Orchard Role membership to Azure Graph API Group Membership. This module will not create new Orchard Roles for you, but it will sync up user membership of existing Orchard Roles with AD Group membership for Role names that match a group name")</span>
|
||||
</fieldset>
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<remove name="host" />
|
||||
<remove name="pages" />
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc" />
|
||||
<add namespace="System.Web.Mvc.Ajax" />
|
||||
<add namespace="System.Web.Mvc.Html" />
|
||||
<add namespace="System.Web.Routing" />
|
||||
<add namespace="System.Web.WebPages" />
|
||||
<add namespace="System.Linq" />
|
||||
<add namespace="System.Collections.Generic" />
|
||||
<add namespace="Orchard.Mvc.Html" />
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web.webPages.razor>
|
||||
<!--
|
||||
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
|
||||
|
||||
The following attributes can be set on the <httpRuntime> tag.
|
||||
<system.Web>
|
||||
<httpRuntime targetFramework="4.5.2" />
|
||||
</system.Web>
|
||||
-->
|
||||
<system.web>
|
||||
<compilation targetFramework="4.5.2" debug="true">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
||||
<add assembly="System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
</system.web>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.127" newVersion="5.0.0.127" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.IdentityModel.Protocol.Extensions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.2.33" newVersion="1.0.2.33" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Iesi.Collections" version="4.0.1.4000" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net451" />
|
||||
<package id="Microsoft.Azure.ActiveDirectory.GraphClient" version="2.1.0" targetFramework="net452" />
|
||||
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="net452" />
|
||||
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="net452" />
|
||||
<package id="Microsoft.Data.Services.Client" version="5.6.4" targetFramework="net452" />
|
||||
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.19.208020213" targetFramework="net452" />
|
||||
<package id="Microsoft.IdentityModel.Logging" version="1.0.0" targetFramework="net451" />
|
||||
<package id="Microsoft.IdentityModel.Protocol.Extensions" version="1.0.2.206221351" targetFramework="net451" />
|
||||
<package id="Microsoft.IdentityModel.Tokens" version="5.0.0" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.Security.ActiveDirectory" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.Security.Jwt" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.Security.OpenIdConnect" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net451" />
|
||||
<package id="NHibernate" version="4.0.1.4000" targetFramework="net452" />
|
||||
<package id="Owin" version="1.0" targetFramework="net451" />
|
||||
<package id="System.IdentityModel.Tokens.Jwt" version="5.0.0" targetFramework="net451" />
|
||||
<package id="System.Spatial" version="5.6.4" targetFramework="net452" />
|
||||
</packages>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Placement>
|
||||
<Place Parts_AzureSettings_Edit="Content:1"/>
|
||||
</Placement>
|
||||
@@ -58,12 +58,12 @@
|
||||
<HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.0\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.SystemWeb, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.0.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin.Host.SystemWeb, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
||||
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add assembly="Microsoft.Owin.Host.SystemWeb, Version=3.0.0.0" />
|
||||
<add assembly="Microsoft.Owin.Host.SystemWeb, Version=3.0.1.0" />
|
||||
<add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add assembly="System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add assembly="System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
@@ -233,6 +233,26 @@
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin.Host.SystemWeb" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.IdentityModel.Protocol.Extensions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.2.33" newVersion="1.0.2.33" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="4.0.20622.1351" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.IdentityModel.Protocol.Extensions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.2.33" newVersion="1.0.2.33" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin" version="3.0.0" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.0" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
|
||||
<package id="MySql.Data" version="6.7.9" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
||||
|
||||
@@ -278,6 +278,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Resources", "Orchar
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure.Tests", "Orchard.Azure.Tests\Orchard.Azure.Tests.csproj", "{1CC62F45-E6FF-43D5-84BF-509A1085D994}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure.Authentication", "Orchard.Web\Modules\Orchard.Azure.Authentication\Orchard.Azure.Authentication.csproj", "{60D63D66-E88E-4D07-82EE-C1561903A73E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CodeCoverage|Any CPU = CodeCoverage|Any CPU
|
||||
@@ -1114,6 +1116,16 @@ Global
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994}.FxCop|Any CPU.Build.0 = Release|Any CPU
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{60D63D66-E88E-4D07-82EE-C1561903A73E}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{60D63D66-E88E-4D07-82EE-C1561903A73E}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{60D63D66-E88E-4D07-82EE-C1561903A73E}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{60D63D66-E88E-4D07-82EE-C1561903A73E}.Coverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{60D63D66-E88E-4D07-82EE-C1561903A73E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{60D63D66-E88E-4D07-82EE-C1561903A73E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{60D63D66-E88E-4D07-82EE-C1561903A73E}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{60D63D66-E88E-4D07-82EE-C1561903A73E}.FxCop|Any CPU.Build.0 = Release|Any CPU
|
||||
{60D63D66-E88E-4D07-82EE-C1561903A73E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{60D63D66-E88E-4D07-82EE-C1561903A73E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -1202,6 +1214,7 @@ Global
|
||||
{98251EAE-A41B-47B2-AA91-E28B8482DA70} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{D4E8F7C8-2DB2-4C50-A422-DA1DF1E3CC73} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||
{60D63D66-E88E-4D07-82EE-C1561903A73E} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EnterpriseLibraryConfigurationToolBinariesPath = packages\TransientFaultHandling.Core.5.1.1209.1\lib\NET4
|
||||
|
||||
@@ -84,8 +84,8 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.0\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin" version="3.0.0" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
||||
<package id="NHibernate" version="4.0.1.4000" targetFramework="net452" />
|
||||
|
||||
Reference in New Issue
Block a user