コード例 #1
0
		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 DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("validator");
     }
     this.validator = validator;
 }
コード例 #4
0
 public CustomUserNameSecurityTokenAuthenticator(
     UserNamePasswordValidator validator)
 {
     if (validator == null)
     {
         throw new ArgumentNullException("validator");
     }
     this.validator = validator;
 }
コード例 #5
0
 // ────────────────────────── Constructors ──────────────────────────
 public ServiceAuthenticationInspector(
     IWebAuthenticationHandler handler,
     UserNamePasswordValidator validator,
     bool requiresTransportLayerSecurity,
     string source)
 {
     _handler = handler;
     _validator = validator;
     _requiresTransportLayerSecurity = requiresTransportLayerSecurity;
     _source = source;
 }
コード例 #6
0
 public bool Authenticate(UserNamePasswordValidator validator)
 {
     if (!_valid) return false;
     try
     {
         validator.Validate(_username, _password);
         return true;
     }
     catch { }
     return false;
 }
コード例 #7
0
 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;
 }
コード例 #8
0
 // ────────────────────────── Constructors ──────────────────────────
 public OperationAuthenticationInvoker(
     IOperationInvoker invoker,
     IWebAuthenticationHandler handler,
     UserNamePasswordValidator validator,
     bool requiresTransportLayerSecurity,
     string source)
 {
     _invoker = invoker;
     _handler = handler;
     _validator = validator;
     _requiresTransportLayerSecurity = requiresTransportLayerSecurity;
     _source = source;
 }
コード例 #9
0
ファイル: MainWindow.xaml.cs プロジェクト: powerhai/Jinchen
        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;
            }
            
        }
コード例 #10
0
 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");
 }
コード例 #11
0
 public CustomSecurityTokenAuthenticator(UserNamePasswordValidator validator)
     : base(validator)
 {
 }
コード例 #12
0
ファイル: BasicServerSecurity.cs プロジェクト: ramz/sones
 public BasicServerSecurity(UserNamePasswordValidator myValidator)
 {
     if (myValidator == null)
         throw new ArgumentNullException("myValidator");
     _validator = myValidator;
 }
コード例 #13
0
 /// <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)
 {
 }