public CustomUserNameSecurityTokenAuthenticator ( UserNamePasswordValidator validator) { if (validator == null) throw new ArgumentNullException ("validator"); this.validator = validator; }
public CustomUserNameSecurityTokenAuthenticator(UserNamePasswordValidator validator) { if (validator == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("validator"); } this.validator = validator; }
public CustomUserNameSecurityTokenAuthenticator( UserNamePasswordValidator validator) { if (validator == null) { throw new ArgumentNullException("validator"); } this.validator = validator; }
// ────────────────────────── Constructors ────────────────────────── public ServiceAuthenticationInspector( IWebAuthenticationHandler handler, UserNamePasswordValidator validator, bool requiresTransportLayerSecurity, string source) { _handler = handler; _validator = validator; _requiresTransportLayerSecurity = requiresTransportLayerSecurity; _source = source; }
public bool Authenticate(UserNamePasswordValidator validator) { if (!_valid) return false; try { validator.Validate(_username, _password); return true; } catch { } return false; }
internal UserNamePasswordServiceCredential(UserNamePasswordServiceCredential other) { this.includeWindowsGroups = other.includeWindowsGroups; this.membershipProvider = other.membershipProvider; this.validationMode = other.validationMode; this.validator = other.validator; this.cacheLogonTokens = other.cacheLogonTokens; this.maxCachedLogonTokens = other.maxCachedLogonTokens; this.cachedLogonTokenLifetime = other.cachedLogonTokenLifetime; this.isReadOnly = other.isReadOnly; }
// ────────────────────────── Constructors ────────────────────────── public OperationAuthenticationInvoker( IOperationInvoker invoker, IWebAuthenticationHandler handler, UserNamePasswordValidator validator, bool requiresTransportLayerSecurity, string source) { _invoker = invoker; _handler = handler; _validator = validator; _requiresTransportLayerSecurity = requiresTransportLayerSecurity; _source = source; }
private void RunService(object instance, string title, UserNamePasswordValidator validator ) { ServiceHost host = null; try { host = new ServiceHost(instance, new Uri[] { new Uri(ConfigurationManager.AppSettings["BaseServiceUrl"]), }); } catch(Exception e) { LogHelper.Log.Error("创建" + title + "服务失败"); return; } if (validator != null ) { var auto = host.Description.Behaviors.Find<ServiceCredentials>().UserNameAuthentication; auto.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom; auto.CustomUserNamePasswordValidator = validator; } host.Opened += (o, args) => { LogHelper.Log.Info(title + " service was started."); }; host.Faulted += (o, args) => { LogHelper.Log.Error(title + " service was failure. - " + args.ToString()); }; host.Closed += (sender, args) => { LogHelper.Log.Info(title + " service was closed."); }; host.Opening+= (sender, args) => { LogHelper.Log.Debug(title + " service has starting..."); }; try { host.Open(); } catch(Exception e) { LogHelper.Log.Error(e); throw; } }
public IIdentity Authenticate( IncomingWebRequestContext request, OutgoingWebResponseContext response, object[] parameters, UserNamePasswordValidator validator, bool secure, bool requiresTransportLayerSecurity, string source) { if (requiresTransportLayerSecurity && !secure) throw new BasicRequiresTransportSecurityException(); var authentication = new BasicAuthentication(request.Headers); if (!authentication.Authenticate(validator)) throw new BasicUnauthorizedException(source); return new GenericIdentity(authentication.Username, "WebBasicAuthenticationHandler"); }
public CustomSecurityTokenAuthenticator(UserNamePasswordValidator validator) : base(validator) { }
public BasicServerSecurity(UserNamePasswordValidator myValidator) { if (myValidator == null) throw new ArgumentNullException("myValidator"); _validator = myValidator; }
/// <summary> /// Initializes a new instance of the <see cref="PersonnelUserNameTokenAuthenticator"/> class. /// </summary> /// <param name="validator">A <see cref="T:System.IdentityModel.Selectors.UserNamePasswordValidator"/> that authenticates the username and password using a custom authentication scheme.</param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="validator"/> is null.</exception> public PersonnelUserNameTokenAuthenticator(UserNamePasswordValidator validator) : base(validator) { }