| | | 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.Threading.Tasks; |
| | | 6 | | |
| | | 7 | | namespace CoreWCF.IdentityModel.Selectors |
| | | 8 | | { |
| | | 9 | | // TODO: Either consider moving this back to System.IdentityModel.Selectors and/or move to ServiceModel and make asy |
| | | 10 | | public abstract class UserNamePasswordValidator |
| | | 11 | | { |
| | | 12 | | private static UserNamePasswordValidator s_none; |
| | | 13 | | |
| | | 14 | | public static UserNamePasswordValidator None |
| | | 15 | | { |
| | | 16 | | get |
| | | 17 | | { |
| | 0 | 18 | | if (s_none == null) |
| | | 19 | | { |
| | 0 | 20 | | s_none = new NoneUserNamePasswordValidator(); |
| | | 21 | | } |
| | | 22 | | |
| | 0 | 23 | | return s_none; |
| | | 24 | | } |
| | | 25 | | } |
| | | 26 | | |
| | | 27 | | [Obsolete("Implementers should override ValidateAsync.")] |
| | 0 | 28 | | public virtual void Validate(string userName, string password) => throw new NotImplementedException(SR.Synchrono |
| | | 29 | | |
| | | 30 | | public virtual ValueTask ValidateAsync(string userName, string password) |
| | | 31 | | { |
| | | 32 | | #pragma warning disable CS0618 // Type or member is obsolete |
| | 0 | 33 | | Validate(userName, password); |
| | | 34 | | #pragma warning restore CS0618 // Type or member is obsolete |
| | 0 | 35 | | return new ValueTask(); |
| | | 36 | | } |
| | | 37 | | |
| | | 38 | | private class NoneUserNamePasswordValidator : UserNamePasswordValidator |
| | | 39 | | { |
| | 0 | 40 | | public override ValueTask ValidateAsync(string userName, string password) => new ValueTask(); |
| | | 41 | | } |
| | | 42 | | } |
| | | 43 | | } |