| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | namespace CoreWCF.Channels |
| | | 5 | | { |
| | | 6 | | /// <summary> |
| | | 7 | | /// Enum BasicHttpSecurityMode |
| | | 8 | | /// </summary> |
| | | 9 | | public enum BasicHttpSecurityMode |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// No security is applied during transfer. (Default) |
| | | 13 | | /// </summary> |
| | | 14 | | None, |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Transfer security is provided using HTTPS. The server is authenticated via its SSL certificate. The client a |
| | | 18 | | /// </summary> |
| | | 19 | | Transport, |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// The message |
| | | 23 | | /// </summary> |
| | | 24 | | Message, |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Transfer security is provided using HTTPS. The server is authenticated via its SSL certificate. The client a |
| | | 28 | | /// </summary> |
| | | 29 | | /// <remarks>See https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/ws-transport-with-message-credent |
| | | 30 | | TransportWithMessageCredential, |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// TransportCredentialOnly will send the credentials in plain text and unencrypted and is only recommended for |
| | | 34 | | /// </summary> |
| | | 35 | | TransportCredentialOnly |
| | | 36 | | } |
| | | 37 | | |
| | | 38 | | internal static class BasicHttpSecurityModeHelper |
| | | 39 | | { |
| | | 40 | | internal static bool IsDefined(BasicHttpSecurityMode value) |
| | | 41 | | { |
| | 860 | 42 | | return (value == BasicHttpSecurityMode.None || |
| | 860 | 43 | | value == BasicHttpSecurityMode.Transport || |
| | 860 | 44 | | value == BasicHttpSecurityMode.Message || |
| | 860 | 45 | | value == BasicHttpSecurityMode.TransportWithMessageCredential || |
| | 860 | 46 | | value == BasicHttpSecurityMode.TransportCredentialOnly); |
| | | 47 | | } |
| | | 48 | | |
| | | 49 | | internal static BasicHttpSecurityMode ToSecurityMode(UnifiedSecurityMode value) |
| | | 50 | | { |
| | | 51 | | switch (value) |
| | | 52 | | { |
| | | 53 | | case UnifiedSecurityMode.None: |
| | 0 | 54 | | return BasicHttpSecurityMode.None; |
| | | 55 | | case UnifiedSecurityMode.Transport: |
| | 0 | 56 | | return BasicHttpSecurityMode.Transport; |
| | | 57 | | case UnifiedSecurityMode.Message: |
| | 0 | 58 | | return BasicHttpSecurityMode.Message; |
| | | 59 | | case UnifiedSecurityMode.TransportWithMessageCredential: |
| | 0 | 60 | | return BasicHttpSecurityMode.TransportWithMessageCredential; |
| | | 61 | | case UnifiedSecurityMode.TransportCredentialOnly: |
| | 0 | 62 | | return BasicHttpSecurityMode.TransportCredentialOnly; |
| | | 63 | | default: |
| | 0 | 64 | | return (BasicHttpSecurityMode)value; |
| | | 65 | | } |
| | | 66 | | } |
| | | 67 | | } |
| | | 68 | | } |