Skip to content

Commit

Permalink
Making sure the IAuthenticationProvider is loaded when the UI starts
Browse files Browse the repository at this point in the history
[release]
  • Loading branch information
Lakritzator committed Nov 18, 2016
1 parent daef8d9 commit 6b77196
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 11 additions & 1 deletion Dapplo.CaliburnMicro/CaliburnMicroBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
using System.Windows;
using Caliburn.Micro;
using Dapplo.Addons;
using Dapplo.CaliburnMicro.Security;
using Dapplo.Log;
using Dapplo.Utils.Resolving;

Expand Down Expand Up @@ -184,7 +185,7 @@ protected override void OnStartup(object sender, StartupEventArgs e)
// Call the base, this actually currently does nothing but who knows what is added later.
base.OnStartup(sender, e);

// Warn when no IShell export is found
// Inform when no IShell export is found
var shells = ServiceLocator.GetExports<IShell>();
if (shells.Any())
{
Expand All @@ -195,6 +196,15 @@ protected override void OnStartup(object sender, StartupEventArgs e)
{
Log.Info().WriteLine("No IShell export found, if you want to have an initial window make sure you exported your ViewModel with [Export(typeof(IShell))]");
}

// Warn when no IAuthenticationProvider export is found
var authenticationProvider = ServiceLocator.GetExports<IAuthenticationProvider>().FirstOrDefault();
if (authenticationProvider != null)
{
Log.Info().WriteLine("IAuthenticationProvider to provide UI permissions: {0}", authenticationProvider.Value.GetType());
} else {
Log.Warn().WriteLine("No IAuthenticationProvider export found, UI permissions will not work.");
}
}

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions Dapplo.CaliburnMicro/Security/IAuthenticationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

#endregion

using System.ComponentModel;

namespace Dapplo.CaliburnMicro.Security
{
/// <summary>
Expand Down

0 comments on commit 6b77196

Please sign in to comment.