| | | 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 | | using System; |
| | | 5 | | using System.Net; |
| | | 6 | | using System.Security.Principal; |
| | | 7 | | using CoreWCF.IdentityModel.Selectors; |
| | | 8 | | using CoreWCF.IdentityModel.Tokens; |
| | | 9 | | using CoreWCF.Security.Tokens; |
| | | 10 | | |
| | | 11 | | namespace CoreWCF.Security |
| | | 12 | | { |
| | | 13 | | public class SspiSecurityTokenProvider : SecurityTokenProvider |
| | | 14 | | { |
| | | 15 | | internal const bool DefaultAllowNtlm = true; |
| | | 16 | | internal const bool DefaultExtractWindowsGroupClaims = true; |
| | | 17 | | internal const bool DefaultAllowUnauthenticatedCallers = false; |
| | | 18 | | private readonly SspiSecurityToken _token; |
| | | 19 | | |
| | | 20 | | // client side ctor |
| | 0 | 21 | | public SspiSecurityTokenProvider(NetworkCredential credential, bool allowNtlm, TokenImpersonationLevel impersona |
| | | 22 | | { |
| | 0 | 23 | | _token = new SspiSecurityToken(impersonationLevel, allowNtlm, credential); |
| | 0 | 24 | | } |
| | | 25 | | |
| | | 26 | | // service side ctor |
| | 12 | 27 | | public SspiSecurityTokenProvider(NetworkCredential credential, bool extractGroupsForWindowsAccounts, bool allowU |
| | | 28 | | { |
| | 12 | 29 | | _token = new SspiSecurityToken(credential, extractGroupsForWindowsAccounts, allowUnauthenticatedCallers); |
| | 12 | 30 | | } |
| | | 31 | | |
| | | 32 | | protected override SecurityToken GetTokenCore(TimeSpan timeout) |
| | | 33 | | { |
| | 12 | 34 | | return _token; |
| | | 35 | | } |
| | | 36 | | } |
| | | 37 | | } |