Removes the extensibility files and build for identity stuff - that now exists in a separate github repo.

This commit is contained in:
Shannon
2015-03-31 15:27:48 +11:00
parent 439935430a
commit ad92006f54
10 changed files with 0 additions and 524 deletions

View File

@@ -56,7 +56,6 @@ REN .\_BuildOutput\WebApp\Xslt\Web.config Web.config.transform
ECHO Packing the NuGet release files
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.Core.nuspec -Version %version%
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.nuspec -Version %version%
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.Identity.nuspec
IF ERRORLEVEL 1 GOTO :showerror

View File

@@ -88,7 +88,6 @@
<WebAppFolderAbsolutePath>$(BuildFolderAbsolutePath)WebApp\</WebAppFolderAbsolutePath>
<WebPiFolderRelativeToProjects>$(BuildFolderRelativeToProjects)WebPi\</WebPiFolderRelativeToProjects>
<WebPiFolderAbsolutePath>$(BuildFolderAbsolutePath)WebPi\</WebPiFolderAbsolutePath>
<IdentityTemplatesPath>$(BuildFolderAbsolutePath)IdentityTemplates\</IdentityTemplatesPath>
</PropertyGroup>
<ItemGroup>
@@ -158,28 +157,6 @@
<Message Text="Finished zipping to build\$(BuildFolder)\$(buildDate)-$(BuildZipFileName)" Importance="high" />
</Target>
<Target Name="MakeIdentityTemplateFiles" DependsOnTargets="CreateSystemFolders" >
<Message Text="Starting to create Umbraco Identity template files" Importance="high" />
<ItemGroup>
<IdentityFiles Include="..\src\Umbraco.Web.UI\App_Start\Umbraco*.cs" />
</ItemGroup>
<!-- Copy and rename to be suffixed with .pp extension for nuget templates -->
<Copy SourceFiles="@(IdentityFiles)"
DestinationFiles="@(IdentityFiles->'$(IdentityTemplatesPath)App_Start\%(RecursiveDir)%(Filename)%(Extension).pp')" />
<!-- Replace the namespace with the token for each file for nuget templates -->
<ItemGroup>
<IdentityTemplateFiles Include="$(IdentityTemplatesPath)\**\*.pp" />
</ItemGroup>
<FileUpdate
Files="@(IdentityTemplateFiles)"
Regex=" Umbraco\.Web\.UI"
ReplacementText=" $rootnamespace$"/>
</Target>
<Target Name="CreateSystemFolders" DependsOnTargets="CopyBelleBuild" Inputs="@(SystemFolders)" Outputs="%(Identity).Dummy">
<MakeDir Directories="@(SystemFolders)" />
</Target>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.8">
<id>UmbracoCms.Identity</id>
<version>1.0.0</version>
<title>Umbraco Extensibility for ASP.Net Identity</title>
<authors>Umbraco HQ</authors>
<owners>Umbraco HQ</owners>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<projectUrl>http://umbraco.com/</projectUrl>
<iconUrl>http://umbraco.com/media/357769/100px_transparent.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Installs files/classes to help with ASP.Net Identity extensibility for Umbraco back office</description>
<summary>Installs classes to help with ASP.Net Identity extensibility for Umbraco</summary>
<language>en-US</language>
<tags>umbraco aspnet identity</tags>
<dependencies>
<dependency id="UmbracoCms" version="[7.3.0, 8.0.0)" />
</dependencies>
</metadata>
<files>
<file src="..\_BuildOutput\IdentityTemplates\App_Start\**\*.pp" target="content\App_Start" />
</files>
</package>

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoExamine.PDF</id>
<version>0.7.0</version>
<authors>Umbraco HQ</authors>
<owners>Umbraco HQ</owners>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<projectUrl>http://umbraco.com/</projectUrl>
<iconUrl>http://umbraco.com/media/357769/100px_transparent.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>UmbracoExmine.PDF</description>
<tags>umbraco</tags>
<dependencies>
<dependency id="UmbracoCms.Core" version="[7.0.0, 8.0.0)" />
<dependency id="iTextSharp" version="[5.5.3, 6.0.0)" />
</dependencies>
</metadata>
<files>
<file src="..\_BuildOutput\UmbracoExamine.PDF\UmbracoExamine.PDF.dll" target="lib\UmbracoExamine.PDF.dll" />
<file src="..\_BuildOutput\UmbracoExamine.PDF\UmbracoExamine.PDF.XML" target="lib\UmbracoExamine.PDF.XML" />
</files>
</package>

View File

@@ -1,33 +0,0 @@
_ _ __ __ ____ _____ _____ ____
| | | | \/ | _ \| __ \ /\ / ____/ __ \
| | | | \ / | |_) | |__) | / \ | | | | | |
| | | | |\/| | _ <| _ / / /\ \| | | | | |
| |__| | | | | |_) | | \ \ / ____ | |___| |__| |
\____/|_| |_|____/|_| \_/_/ \_\_____\____/
----------------------------------------------------
Umbraco extensibility code has been installed for ASP.Net Identity with Umbraco back office users
The files have been installed into your App_Start folder if you have a Web Application project
or into App_Code if you have a Website project.
All of these files include lots of code comments, documentation & notes to assist with extending
the ASP.Net Identity implementaion for back office users in Umbraco. For all 3rd party
ASP.Net providers, their dependencies will need to be manually installed. See comments in the
following files for full details:
* StandardUmbracoOwinStartup.cs Includes code snippets to enable 3rd party ASP.Net Identity
providers to work with the Umbraco back office.
To enable the 'StandardUmbracoOwinStartup', update the web.config
appSetting "owin:appStartup" to be: "StandardUmbracoOwinStartup"
* UmbracoCustomOwinStartup Includes code snippets to customize the Umbraco ASP.Net
Identity implementation for back office users as well as
snippets to enable 3rd party ASP.Net Identity providers to work.
To enable the 'UmbracoCustomOwinStartup', update the web.config
appSetting "owin:appStartup" to be: "UmbracoCustomOwinStartup"
* UmbracoBackOfficeAuthExtensions Includes extension methods snippets to enable 3rd party ASP.Net
Identity providers to work with the Umbraco back office.

View File

@@ -1,308 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using Microsoft.Owin;
using Owin;
using Umbraco.Core;
using Umbraco.Web.Security.Identity;
//using Microsoft.Owin.Security.Facebook;
//using Microsoft.Owin.Security.Google;
//using Microsoft.Owin.Security.OpenIdConnect;
//using Microsoft.Owin.Security.MicrosoftAccount;
//using Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace Umbraco.Web.UI
{
public static class UmbracoBackOfficeAuthExtensions
{
/*
/// <summary>
/// Configure microsoft account sign-in
/// </summary>
/// <param name="app"></param>
/// <param name="clientId"></param>
/// <param name="clientSecret"></param>
/// <param name="caption"></param>
/// <param name="style"></param>
/// <param name="icon"></param>
/// <remarks>
///
/// Nuget installation:
/// Microsoft.Owin.Security.MicrosoftAccount
///
/// Microsoft account documentation for ASP.Net Identity can be found:
///
/// http://www.asp.net/web-api/overview/security/external-authentication-services#MICROSOFT
/// http://blogs.msdn.com/b/webdev/archive/2012/09/19/configuring-your-asp-net-application-for-microsoft-oauth-account.aspx
///
/// Microsoft apps can be created here:
///
/// http://go.microsoft.com/fwlink/?LinkID=144070
///
/// </remarks>
public static void ConfigureBackOfficeMicrosoftAuth(this IAppBuilder app, string clientId, string clientSecret,
string caption = "Microsoft", string style = "btn-microsoft", string icon = "fa-windows")
{
var msOptions = new MicrosoftAccountAuthenticationOptions
{
ClientId = clientId,
ClientSecret = clientSecret,
SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType
};
msOptions.ForUmbracoBackOffice(style, icon);
msOptions.Caption = caption;
app.UseMicrosoftAccountAuthentication(msOptions);
}
/// <summary>
/// Configure google sign-in
/// </summary>
/// <param name="app"></param>
/// <param name="clientId"></param>
/// <param name="clientSecret"></param>
/// <param name="caption"></param>
/// <param name="style"></param>
/// <param name="icon"></param>
/// <remarks>
///
/// Nuget installation:
/// Microsoft.Owin.Security.Google
///
/// Google account documentation for ASP.Net Identity can be found:
///
/// http://www.asp.net/web-api/overview/security/external-authentication-services#GOOGLE
///
/// Google apps can be created here:
///
/// https://developers.google.com/accounts/docs/OpenIDConnect#getcredentials
///
/// </remarks>
public static void ConfigureBackOfficeGoogleAuth(this IAppBuilder app, string clientId, string clientSecret,
string caption = "Google", string style = "btn-google-plus", string icon = "fa-google-plus")
{
var googleOptions = new GoogleOAuth2AuthenticationOptions
{
ClientId = clientId,
ClientSecret = clientSecret,
//In order to allow using different google providers on the front-end vs the back office,
// these settings are very important to make them distinguished from one another.
SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType,
// By default this is '/signin-google', you will need to change that default value in your
// Google developer settings for your web-app in the "REDIRECT URIS" setting
CallbackPath = new PathString("/umbraco-google-signin")
};
googleOptions.ForUmbracoBackOffice(style, icon);
googleOptions.Caption = caption;
app.UseGoogleAuthentication(googleOptions);
}
/// <summary>
/// Configure facebook sign-in
/// </summary>
/// <param name="app"></param>
/// <param name="appId"></param>
/// <param name="appSecret"></param>
/// <param name="caption"></param>
/// <param name="style"></param>
/// <param name="icon"></param>
/// <remarks>
///
/// Nuget installation:
/// Microsoft.Owin.Security.Facebook
///
/// Facebook account documentation for ASP.Net Identity can be found:
///
/// http://www.asp.net/web-api/overview/security/external-authentication-services#FACEBOOK
///
/// Facebook apps can be created here:
///
/// https://developers.facebook.com/
///
/// </remarks>
public static void ConfigureBackOfficeFacebookAuth(this IAppBuilder app, string appId, string appSecret,
string caption = "Facebook", string style = "btn-facebook", string icon = "fa-facebook")
{
var fbOptions = new FacebookAuthenticationOptions
{
AppId = appId,
AppSecret = appSecret,
//In order to allow using different google providers on the front-end vs the back office,
// these settings are very important to make them distinguished from one another.
SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType,
// By default this is '/signin-facebook', you will need to change that default value in your
// Facebook developer settings for your app in the Advanced settings under "Client OAuth Login"
// in the "Valid OAuth redirect URIs", specify the full URL, for example: http://mysite.com/umbraco-facebook-signin
CallbackPath = new PathString("/umbraco-facebook-signin")
};
fbOptions.ForUmbracoBackOffice(style, icon);
fbOptions.Caption = caption;
app.UseFacebookAuthentication(fbOptions);
}
/// <summary>
/// Configure ActiveDirectory sign-in
/// </summary>
/// <param name="app"></param>
/// <param name="tenant"></param>
/// <param name="clientId"></param>
/// <param name="postLoginRedirectUri">
/// The URL that will be redirected to after login is successful, example: http://mydomain.com/umbraco/;
/// </param>
/// <param name="appKey"></param>
/// <param name="authType">
/// This by default is 'OpenIdConnect' but that doesn't match what ASP.Net Identity actually stores in the
/// loginProvider field in the database which looks something like this (for example):
/// https://sts.windows.net/3bb0b4c5-364f-4394-ad36-0f29f95e5ggg/
/// and is based on your AD setup. This value needs to match in order for accounts to
/// detected as linked/un-linked in the back office.
/// </param>
/// <param name="caption"></param>
/// <param name="style"></param>
/// <param name="icon"></param>
/// <remarks>
///
/// Nuget installation:
/// Install-Package Microsoft.Owin.Security.OpenIdConnect
/// Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory
///
/// ActiveDirectory account documentation for ASP.Net Identity can be found:
///
/// https://github.com/AzureADSamples/WebApp-WebAPI-OpenIDConnect-DotNet
///
/// This configuration requires the NaiveSessionCache class below which will need to be un-commented
///
/// </remarks>
public static void ConfigureBackOfficeActiveDirectoryAuth(this IAppBuilder app,
string tenant, string clientId, string postLoginRedirectUri, string appKey,
string authType,
string caption = "Active Directory", string style = "btn-microsoft", string icon = "fa-windows")
{
const string aadInstance = "https://login.windows.net/{0}";
const string graphResourceId = "https://graph.windows.net";
var authority = string.Format(CultureInfo.InvariantCulture, aadInstance, tenant);
var adOptions = new OpenIdConnectAuthenticationOptions
{
AuthenticationType = authType,
SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType,
ClientId = clientId,
Authority = authority,
PostLogoutRedirectUri = postLoginRedirectUri,
Notifications = new OpenIdConnectAuthenticationNotifications()
{
// If there is a code in the OpenID Connect response, redeem it for an access token and refresh token, and store those away.
AuthorizationCodeReceived = (context) =>
{
var credential = new ClientCredential(clientId, appKey);
var userObjectId = context.AuthenticationTicket.Identity.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
var authContext = new AuthenticationContext(authority, new NaiveSessionCache(userObjectId));
var result = authContext.AcquireTokenByAuthorizationCode(
context.Code,
//NOTE: This URL needs to match EXACTLY the same path that is configured in the AD configuration.
new Uri(
HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) +
HttpContext.Current.Request.RawUrl.EnsureStartsWith('/').EnsureEndsWith('/')),
credential,
graphResourceId);
return Task.FromResult(0);
}
}
};
adOptions.ForUmbracoBackOffice(style, icon);
adOptions.Caption = caption;
app.UseOpenIdConnectAuthentication(adOptions);
}
*/
}
/*
/// <summary>
/// A Session cache token storage which is required to initialize the AD Identity provider on startup
/// </summary>
/// <remarks>
/// Based on the examples from the AD samples:
/// https://github.com/AzureADSamples/WebApp-WebAPI-OpenIDConnect-DotNet/blob/master/TodoListWebApp/Utils/NaiveSessionCache.cs
///
/// There are some newer examples of different token storage including persistent storage here:
/// It would appear that this is better for whatever reason: https://github.com/OfficeDev/O365-WebApp-SingleTenant/blob/master/O365-WebApp-SingleTenant/Models/ADALTokenCache.cs
///
/// The type of token storage will be dependent on your requirements but this should be fine for standard installations
/// </remarks>
public class NaiveSessionCache : TokenCache
{
private static readonly object FileLock = new object();
readonly string _cacheId;
public NaiveSessionCache(string userId)
{
_cacheId = userId + "_TokenCache";
AfterAccess = AfterAccessNotification;
BeforeAccess = BeforeAccessNotification;
Load();
}
public void Load()
{
lock (FileLock)
{
Deserialize((byte[])HttpContext.Current.Session[_cacheId]);
}
}
public void Persist()
{
lock (FileLock)
{
// reflect changes in the persistent store
HttpContext.Current.Session[_cacheId] = Serialize();
// once the write operation took place, restore the HasStateChanged bit to false
HasStateChanged = false;
}
}
// Empties the persistent store.
public override void Clear()
{
base.Clear();
HttpContext.Current.Session.Remove(_cacheId);
}
public override void DeleteItem(TokenCacheItem item)
{
base.DeleteItem(item);
Persist();
}
// Triggered right before ADAL needs to access the cache.
// Reload the cache from the persistent store in case it changed since the last access.
void BeforeAccessNotification(TokenCacheNotificationArgs args)
{
Load();
}
// Triggered right after ADAL accessed the cache.
void AfterAccessNotification(TokenCacheNotificationArgs args)
{
// if the access operation resulted in a cache update
if (HasStateChanged)
{
Persist();
}
}
}
*/
}

View File

@@ -1,60 +0,0 @@
using Microsoft.Owin;
using Owin;
using Umbraco.Core;
using Umbraco.Core.Security;
using Umbraco.Web.Security.Identity;
using Umbraco.Web.UI;
[assembly: OwinStartup("CustomUmbracoOwinStartup", typeof(StandardUmbracoOwinStartup))]
namespace Umbraco.Web.UI
{
/// <summary>
/// A custom way to configure OWIN for Umbraco
/// </summary>
/// <remarks>
/// The startup type is specified in appSettings under owin:appStartup - change it to "CustomUmbracoStartup" to use this class
///
/// This startup class would allow you to customize the Identity IUserStore and/or IUserManager for the Umbraco Backoffice
/// </remarks>
public class CustomUmbracoOwinStartup
{
public void Configuration(IAppBuilder app)
{
//Configure the Identity user manager for use with Umbraco Back office
// (EXPERT: an overload accepts a custom BackOfficeUserStore implementation)
app.ConfigureUserManagerForUmbracoBackOffice(
ApplicationContext.Current,
Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider());
//Ensure owin is configured for Umbraco back office authentication
app
.UseUmbracoBackOfficeCookieAuthentication()
.UseUmbracoBackOfficeExternalCookieAuthentication();
/*
* Configure external logins for the back office:
*
* Depending on the authentication sources you would like to enable, you will need to install
* certain Nuget packages.
*
* For Google auth: Install-Package Microsoft.Owin.Security.Google
* For Facebook auth: Install-Package Microsoft.Owin.Security.Facebook
* For Microsoft auth: Install-Package Microsoft.Owin.Security.MicrosoftAccount
*
* There are many more providers such as Twitter, Yahoo, ActiveDirectory, etc... most information can
* be found here: http://www.asp.net/web-api/overview/security/external-authentication-services
*
* The source for these methods is located in ~/App_Code/IdentityAuthExtensions.cs, you will need to un-comment
* the methods that you would like to use. Each method contains documentation and links to
* documentation for reference. You can also tweak the code in those extension
* methods to suit your needs.
*/
//app.ConfigureBackOfficeGoogleAuth("YOUR_APP_ID", "YOUR_APP_SECRET");
//app.ConfigureBackOfficeFacebookAuth("YOUR_APP_ID", "YOUR_APP_SECRET");
//app.ConfigureBackOfficeMicrosoftAuth("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
//app.ConfigureBackOfficeActiveDirectoryAuth("YOUR_TENANT", "YOUR_CLIENT_ID", "YOUR_POST_LOGIN_REDIRECT_URL", "YOUR_APP_KEY", "YOUR_AUTH_TYPE");
}
}
}

View File

@@ -1,50 +0,0 @@
using Microsoft.Owin;
using Owin;
using Umbraco.Core;
using Umbraco.Core.Security;
using Umbraco.Web.Security.Identity;
using Umbraco.Web.UI;
[assembly: OwinStartup("StandardUmbracoOwinStartup", typeof(StandardUmbracoOwinStartup))]
namespace Umbraco.Web.UI
{
/// <summary>
/// The standard way to configure OWIN for Umbraco
/// </summary>
/// <remarks>
/// The startup type is specified in appSettings under owin:appStartup - change it to "StandardUmbracoStartup" to use this class
/// </remarks>
public class StandardUmbracoOwinStartup : DefaultUmbracoOwinStartup
{
public override void Configuration(IAppBuilder app)
{
//ensure the default options are configured
base.Configuration(app);
/*
* Configure external logins for the back office:
*
* Depending on the authentication sources you would like to enable, you will need to install
* certain Nuget packages.
*
* For Google auth: Install-Package Microsoft.Owin.Security.Google
* For Facebook auth: Install-Package Microsoft.Owin.Security.Facebook
* For Microsoft auth: Install-Package Microsoft.Owin.Security.MicrosoftAccount
*
* There are many more providers such as Twitter, Yahoo, ActiveDirectory, etc... most information can
* be found here: http://www.asp.net/web-api/overview/security/external-authentication-services
*
* The source for these methods is located in ~/App_Code/IdentityAuthExtensions.cs, you will need to un-comment
* the methods that you would like to use. Each method contains documentation and links to
* documentation for reference. You can also tweak the code in those extension
* methods to suit your needs.
*/
//app.ConfigureBackOfficeGoogleAuth("YOUR_APP_ID", "YOUR_APP_SECRET");
//app.ConfigureBackOfficeFacebookAuth("YOUR_APP_ID", "YOUR_APP_SECRET");
//app.ConfigureBackOfficeMicrosoftAuth("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
//app.ConfigureBackOfficeActiveDirectoryAuth("YOUR_TENANT", "YOUR_CLIENT_ID", "YOUR_POST_LOGIN_REDIRECT_URL", "YOUR_APP_KEY", "YOUR_AUTH_TYPE");
}
}
}

View File

@@ -2554,7 +2554,6 @@
<Folder Include="App_Code\" />
<Folder Include="App_Data\" />
<Folder Include="App_Plugins\" />
<Folder Include="App_Start\" />
<Folder Include="Css\" />
<Folder Include="MasterPages\" />
<Folder Include="Media\" />

View File

@@ -31,7 +31,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{227C
..\build\NuSpecs\UmbracoCms.Core.AllBinaries.nuspec = ..\build\NuSpecs\UmbracoCms.Core.AllBinaries.nuspec
..\build\NuSpecs\UmbracoCms.Core.nuspec = ..\build\NuSpecs\UmbracoCms.Core.nuspec
..\build\NuSpecs\UmbracoCms.Core.Symbols.nuspec = ..\build\NuSpecs\UmbracoCms.Core.Symbols.nuspec
..\build\NuSpecs\UmbracoCms.Identity.nuspec = ..\build\NuSpecs\UmbracoCms.Identity.nuspec
..\build\NuSpecs\UmbracoCms.nuspec = ..\build\NuSpecs\UmbracoCms.nuspec
EndProjectSection
EndProject