Updates back office auth extension methods to be explicit with specifying that it's for back office because we need to explicitly tell each provider the SignInAsAuthenticationType so that it uses the back office auth provider and not a user's own front-end one.

This commit is contained in:
Shannon
2015-03-25 12:34:43 +11:00
parent 86833aa8bf
commit b67250c3d5
4 changed files with 21 additions and 16 deletions

View File

@@ -11,5 +11,5 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.2.5")]
[assembly: AssemblyInformationalVersion("7.2.5")]
[assembly: AssemblyFileVersion("7.3.0")]
[assembly: AssemblyInformationalVersion("7.3.0")]

View File

@@ -47,10 +47,10 @@ namespace Umbraco.Web.UI
* methods to suit your needs.
*/
//app.ConfigureGoogleAuth("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
//app.ConfigureFacebookAuth("YOUR_APP_ID", "YOUR_APP_SECRET");
//app.ConfigureMicrosoftAuth("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
//app.ConfigureActiveDirectory("YOUR_TENANT", "YOUR_CLIENT_ID", "YOUR_POST_LOGIN_REDIRECT_URL", "YOUR_APP_KEY", "YOUR_AUTH_TYPE");
//app.ConfigureBackOfficeGoogleAuth("YOUR_CLIENT_ID", "YOUR_CLIENT_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

@@ -16,7 +16,7 @@ using Umbraco.Core;
namespace Umbraco.Web.UI
{
public static class IdentityAuthExtensions
public static class UmbracoBackOfficeAuthExtensions
{
/*
@@ -42,12 +42,13 @@ namespace Umbraco.Web.UI
/// http://go.microsoft.com/fwlink/?LinkID=144070
///
/// </remarks>
public static void ConfigureMicrosoftAuth(this IAppBuilder app, string clientId, string clientSecret)
public static void ConfigureBackOfficeMicrosoftAuth(this IAppBuilder app, string clientId, string clientSecret)
{
var msOptions = new MicrosoftAccountAuthenticationOptions
{
ClientId = clientId,
ClientSecret = clientSecret
ClientSecret = clientSecret,
SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType
};
//Defines styles for buttons
msOptions.Description.Properties["SocialStyle"] = "btn-microsoft";
@@ -59,7 +60,7 @@ namespace Umbraco.Web.UI
*/
/*
/// <summary>
/// Configure google sign-in
/// </summary>
@@ -80,12 +81,13 @@ namespace Umbraco.Web.UI
/// https://developers.google.com/accounts/docs/OpenIDConnect#getcredentials
///
/// </remarks>
public static void ConfigureGoogleAuth(this IAppBuilder app, string clientId, string clientSecret)
public static void ConfigureBackOfficeGoogleAuth(this IAppBuilder app, string clientId, string clientSecret)
{
var googleOptions = new GoogleOAuth2AuthenticationOptions
{
ClientId = clientId,
ClientSecret = clientSecret
ClientSecret = clientSecret,
SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType
};
//Defines styles for buttons
googleOptions.Description.Properties["SocialStyle"] = "btn-google-plus";
@@ -96,6 +98,7 @@ namespace Umbraco.Web.UI
*/
/*
/// <summary>
@@ -118,12 +121,13 @@ namespace Umbraco.Web.UI
/// https://developers.facebook.com/
///
/// </remarks>
public static void ConfigureFacebookAuth(this IAppBuilder app, string appId, string appSecret)
public static void ConfigureBackOfficeFacebookAuth(this IAppBuilder app, string appId, string appSecret)
{
var fbOptions = new FacebookAuthenticationOptions
{
AppId = appId,
AppSecret = appSecret,
SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType
};
//Defines styles for buttons
fbOptions.Description.Properties["SocialStyle"] = "btn-facebook";
@@ -167,7 +171,7 @@ namespace Umbraco.Web.UI
/// This configuration requires the NaiveSessionCache class below which will need to be un-commented
///
/// </remarks>
public static void ConfigureActiveDirectory(this IAppBuilder app,
public static void ConfigureBackOfficeActiveDirectoryAuth(this IAppBuilder app,
string tenant, string clientId, string postLoginRedirectUri, string appKey,
string authType)
{
@@ -178,6 +182,7 @@ namespace Umbraco.Web.UI
var adOptions = new OpenIdConnectAuthenticationOptions
{
AuthenticationType = authType,
SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType,
ClientId = clientId,
Authority = authority,
PostLogoutRedirectUri = postLoginRedirectUri,

View File

@@ -356,7 +356,7 @@
<Link>Properties\SolutionInfo.cs</Link>
</Compile>
<Content Include="App_Code\OwinStartup.cs" />
<Content Include="App_Code\IdentityAuthExtensions.cs" />
<Content Include="App_Code\UmbracoBackOfficeAuthExtensions.cs" />
<Compile Include="Umbraco\Install\Legacy\LoadStarterKits.ascx.cs">
<DependentUpon>loadStarterKits.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -2586,7 +2586,7 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\"
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>7300</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:7301</IISUrl>
<IISUrl>http://localhost:7300</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>