Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Nancy.Authentication.Ntlm/ModuleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@
<ItemGroup>
<Compile Include="Security\EndPoint.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Security\INtlmIdentity.cs" />
<Compile Include="Security\LittleEndian.cs" />
<Compile Include="Security\Message.cs" />
<Compile Include="ModuleExtensions.cs" />
<Compile Include="Security\BufferWrapper.cs" />
<Compile Include="Security\Common.cs" />
<Compile Include="Security\NtlmIdentity.cs" />
<Compile Include="Security\State.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions src/Nancy.Authentication.Ntlm/Security/INtlmIdentity.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}
15 changes: 15 additions & 0 deletions src/Nancy.Authentication.Ntlm/Security/NtlmIdentity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Nancy.Authentication.Ntlm.Security
{
using Nancy.Security;
using System;
using System.Collections.Generic;

public class NtlmIdentity : INtlmIdentity
{
public IEnumerable<string> Claims { get; set; }

public string UserName { get; set; }
public string Domain { get; set; }
public Common.NtlmFlags Flags { get; set; }
}
}