diff --git a/src/Nancy.Authentication.Ntlm/ModuleExtensions.cs b/src/Nancy.Authentication.Ntlm/ModuleExtensions.cs index 4ec5f70..c286f38 100644 --- a/src/Nancy.Authentication.Ntlm/ModuleExtensions.cs +++ b/src/Nancy.Authentication.Ntlm/ModuleExtensions.cs @@ -114,6 +114,13 @@ public static void RequiresNtlmAuthentication(this NancyModule module) Sessions[module.Request.Cookies["NTLM"]].ResetHandles(); Sessions[module.Request.Cookies["NTLM"]].UpdatePresence(); + // Create IUserIdentity and assign it to the current context + module.Context.CurrentUser = new NtlmIdentity() + { + UserName = type3Message.Username, + Domain = type3Message.Domain + }; + // Authorization successful return null; } diff --git a/src/Nancy.Authentication.Ntlm/Nancy.Authentication.Ntlm.csproj b/src/Nancy.Authentication.Ntlm/Nancy.Authentication.Ntlm.csproj index 8edbac3..227f774 100644 --- a/src/Nancy.Authentication.Ntlm/Nancy.Authentication.Ntlm.csproj +++ b/src/Nancy.Authentication.Ntlm/Nancy.Authentication.Ntlm.csproj @@ -50,11 +50,13 @@ + + diff --git a/src/Nancy.Authentication.Ntlm/Security/INtlmIdentity.cs b/src/Nancy.Authentication.Ntlm/Security/INtlmIdentity.cs new file mode 100644 index 0000000..889a8b1 --- /dev/null +++ b/src/Nancy.Authentication.Ntlm/Security/INtlmIdentity.cs @@ -0,0 +1,11 @@ +namespace Nancy.Authentication.Ntlm.Security +{ + using Nancy.Security; + using System; + + public interface INtlmIdentity : IUserIdentity + { + string Domain { get; set; } + Common.NtlmFlags Flags { get; set; } + } +} diff --git a/src/Nancy.Authentication.Ntlm/Security/NtlmIdentity.cs b/src/Nancy.Authentication.Ntlm/Security/NtlmIdentity.cs new file mode 100644 index 0000000..9311e27 --- /dev/null +++ b/src/Nancy.Authentication.Ntlm/Security/NtlmIdentity.cs @@ -0,0 +1,15 @@ +namespace Nancy.Authentication.Ntlm.Security +{ + using Nancy.Security; + using System; + using System.Collections.Generic; + + public class NtlmIdentity : INtlmIdentity + { + public IEnumerable Claims { get; set; } + + public string UserName { get; set; } + public string Domain { get; set; } + public Common.NtlmFlags Flags { get; set; } + } +}