Skip to content

Commit

Permalink
feat: added role principal extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
aochmann committed Feb 15, 2021
1 parent c5457a9 commit 3dccff9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Source/Cogworks.Essentials/Extensions/RolePrincipalExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Security.Principal;

namespace Cogworks.Essentials.Extensions
{
public static class RolePrincipalExtensions
{
public static bool IsUserLoggedIn(this IPrincipal user)
=> user.HasValue() && user.Identity.HasValue() && user.Identity.Name.HasValue();

public static string GetUser(this IPrincipal user)
=> user?.Identity?.Name;
}
}

0 comments on commit 3dccff9

Please sign in to comment.