Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4ac2501
WIP: Add implementation of NegotiateAuthentication
filipnavara Jun 3, 2022
c7a6bce
WIP: Update error code mapping
filipnavara Jun 4, 2022
5d5c61f
Spanify input of GetOutgoingBlob
filipnavara Jun 4, 2022
d0d1bba
Update comments
filipnavara Jun 4, 2022
982e7c3
Move NegotiateStreamPal.Encrypt/Decrypt to shared sources. Unix imple…
filipnavara Jun 4, 2022
cbd24a2
Revert accidental change
filipnavara Jun 4, 2022
9d4d557
Build fixes.
filipnavara Jun 4, 2022
c371515
Fix error handling condition
filipnavara Jun 4, 2022
3306c67
Update error mapping based on HttpListener usage.
filipnavara Jun 4, 2022
065d87c
WIP: HttpListener test
filipnavara Jun 7, 2022
447020a
Move workaround from HttpListener to low-level SSPI code
filipnavara Jun 7, 2022
bed08fa
Fix build
filipnavara Jun 14, 2022
318ca06
Clean up
filipnavara Jun 14, 2022
5474811
Revert "WIP: HttpListener test"
filipnavara Jun 14, 2022
4cdb8af
Convert System.Net.Http.FunctionalTests to use NegotiateAuthenticatio…
filipnavara Jun 14, 2022
34e47c4
Dispose the identity along NegotiateAuthentication
filipnavara Jun 14, 2022
73ac446
Modify unit tests to use the new API
filipnavara Jun 14, 2022
7e85f10
Add exceptions for invalid inputs/states
filipnavara Jun 14, 2022
7c870bd
Remove tvOS unsupported marker, managed NTLM is used on tvOS
filipnavara Jun 16, 2022
1bd0cde
Apply suggestions from code review
filipnavara Jun 14, 2022
e93f073
Fix typo
filipnavara Jun 14, 2022
5aae44d
Remove reference equality checks from IsNTLM/IsKerberos
filipnavara Jun 16, 2022
b746590
Remove NTAuthentication.AssociatedName to make it more obvious which …
filipnavara Jun 16, 2022
dd7dd9a
Add comment
filipnavara Jun 16, 2022
39a43b2
Add more tests, handle unsupported protocols
filipnavara Jun 16, 2022
9a4ccdf
Handle NotSupportedException from NTAuthentication constructor
filipnavara Jun 16, 2022
e86ce79
Add workaround for linker issue
filipnavara Jun 17, 2022
ffed0be
Apply suggestions from code review
filipnavara Jun 20, 2022
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
Prev Previous commit
Next Next commit
Build fixes.
  • Loading branch information
filipnavara authored Jun 16, 2022
commit 9d4d557a83f6f9cf60f3f1146e9b574ddbe78d72
12 changes: 10 additions & 2 deletions src/libraries/Common/src/System/Net/NTAuthentication.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,23 @@ internal int Encrypt(ReadOnlySpan<byte> buffer, [NotNull] ref byte[]? output, ui
return NegotiateStreamPal.Encrypt(
_securityContext!,
buffer,
IsConfidentialityFlag,
(_contextFlags & ContextFlagsPal.Confidentiality) != 0,
IsNTLM,
ref output,
sequenceNumber);
}

internal int Decrypt(byte[] payload, int offset, int count, out int newOffset, uint expectedSeqNumber)
{
return NegotiateStreamPal.Decrypt(_securityContext!, payload, offset, count, IsConfidentialityFlag, IsNTLM, out newOffset, expectedSeqNumber);
return NegotiateStreamPal.Decrypt(
_securityContext!,
payload,
offset,
count,
(_contextFlags & ContextFlagsPal.Confidentiality) != 0,
IsNTLM,
out newOffset,
expectedSeqNumber);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ internal static partial class NegotiateStreamPal
// defined in winerror.h
private const int NTE_FAIL = unchecked((int)0x80090020);

internal static string QueryContextAssociatedName(SafeDeleteContext? securityContext)
{
throw new PlatformNotSupportedException(SR.net_nego_server_not_supported);
}

internal static string QueryContextClientSpecifiedSpn(SafeDeleteContext securityContext)
{
throw new PlatformNotSupportedException(SR.net_nego_server_not_supported);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ internal static SafeFreeCredentials AcquireCredentialsHandle(string package, boo
}
}

internal static string? QueryContextAssociatedName(SafeDeleteContext securityContext)
{
return SSPIWrapper.QueryStringContextAttributes(GlobalSSPI.SSPIAuth, securityContext, Interop.SspiCli.ContextAttribute.SECPKG_ATTR_NAMES);
}

internal static string? QueryContextClientSpecifiedSpn(SafeDeleteContext securityContext)
{
return SSPIWrapper.QueryStringContextAttributes(GlobalSSPI.SSPIAuth, securityContext, Interop.SspiCli.ContextAttribute.SECPKG_ATTR_CLIENT_SPECIFIED_TARGET);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@
<data name="net_io_invalidendcall" xml:space="preserve">
<value>{0} can only be called once for each asynchronous operation.</value>
</data>
<data name="net_io_out_range" xml:space="preserve">
<value>The byte count must not exceed {0} bytes for this stream type.</value>
</data>
<data name="net_listener_cannot_set_custom_cbt" xml:space="preserve">
<value>Custom channel bindings are not supported.</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions src/libraries/System.Net.Mail/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
<data name="net_io_invalidendcall" xml:space="preserve">
<value>{0} can only be called once for each asynchronous operation.</value>
</data>
<data name="net_io_out_range" xml:space="preserve">
<value>The byte count must not exceed {0} bytes for this stream type.</value>
</data>
<data name="net_MethodNotImplementedException" xml:space="preserve">
<value>This method is not implemented by this class.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ internal static IIdentity GetIdentity(NTAuthentication context)
return new GenericIdentity(name, protocol);
}

internal static string QueryContextAssociatedName(SafeDeleteContext? securityContext)
{
throw new PlatformNotSupportedException(SR.net_nego_server_not_supported);
}

internal static void ValidateImpersonationLevel(TokenImpersonationLevel impersonationLevel)
{
if (impersonationLevel != TokenImpersonationLevel.Identification)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ internal static IIdentity GetIdentity(NTAuthentication context)
return result;
}

internal static string? QueryContextAssociatedName(SafeDeleteContext securityContext)
{
return SSPIWrapper.QueryStringContextAttributes(GlobalSSPI.SSPIAuth, securityContext, Interop.SspiCli.ContextAttribute.SECPKG_ATTR_NAMES);
}

internal static void ValidateImpersonationLevel(TokenImpersonationLevel impersonationLevel)
{
if (impersonationLevel != TokenImpersonationLevel.Identification &&
Expand Down