コード例 #1
0
        public bool PromptAuth(nsIDOMWindow aParent, IntPtr aChannel, int level, nsIAuthInformation authInfo, string checkboxLabel, IntPtr aCheckValue)
        {
            string userName = nsString.Get(authInfo.GetUsername);
            string password = nsString.Get(authInfo.GetPassword);

            string realm = nsString.Get(authInfo.GetRealm);

            if (PromptUsernameAndPassword(aParent, "Server Authentication", "The server '" + realm + "' requires a user name and password.", ref userName, ref password, checkboxLabel, aCheckValue))
            {
                nsString.Set(authInfo.SetUsername, userName);
                nsString.Set(authInfo.SetPassword, password);
                return(true);
            }

            return(false);
        }
コード例 #2
0
        public bool PromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, uint level, nsIAuthInformation authInfo, string checkboxLabel, ref System.Boolean aCheckValue)
        {
            string userName = nsString.Get(authInfo.GetUsernameAttribute);
            string password = nsString.Get(authInfo.GetPasswordAttribute);

            string realm = nsString.Get(authInfo.GetRealmAttribute);

            if (PromptUsernameAndPassword(aParent, "Server Authentication", "The server '" + realm + "' requires a user name and password.", ref userName, ref password, checkboxLabel, ref aCheckValue))
            {
                nsString.Set(authInfo.SetUsernameAttribute, userName);
                nsString.Set(authInfo.SetPasswordAttribute, password);
                return true;
            }

            return false;
        }
コード例 #3
0
ファイル: PromptService.cs プロジェクト: 15831944/Avtoritet
 public nsICancelable AsyncPromptAuth(nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, uint level, nsIAuthInformation authInfo)
 {
     return(DefaultPromptFactory.GetPrompt <nsIAuthPrompt2>().AsyncPromptAuth(aChannel, aCallback, aContext, level, authInfo));
 }
コード例 #4
0
ファイル: PromptService.cs プロジェクト: 15831944/Avtoritet
 public bool PromptAuth(nsIChannel aChannel, uint level, nsIAuthInformation authInfo)
 {
     return(DefaultPromptFactory.GetPrompt <nsIAuthPrompt2>().PromptAuth(aChannel, level, authInfo));
 }
コード例 #5
0
 /// <summary>The async prompt authentication.</summary>
 /// <param name="parent">The parent.</param>
 /// <param name="channel">The channel.</param>
 /// <param name="callback">The callback.</param>
 /// <param name="context">The context.</param>
 /// <param name="level">The level.</param>
 /// <param name="authInfo">The authentication info.</param>
 /// <param name="checkboxLabel">The checkbox label.</param>
 /// <param name="checkValue">The check value.</param>
 /// <returns>The <see cref="nsICancelable"/>.</returns>
 public nsICancelable AsyncPromptAuth(
     nsIDOMWindow parent,
     nsIChannel channel,
     nsIAuthPromptCallback callback,
     nsISupports context,
     uint level,
     nsIAuthInformation authInfo,
     string checkboxLabel,
     ref bool checkValue)
 {
     return PromptService.AsyncPromptAuth(channel, callback, context, level, authInfo);
 }
コード例 #6
0
 /// <summary>The prompt authentication.</summary>
 /// <param name="parent">The parent.</param>
 /// <param name="channel">The channel.</param>
 /// <param name="level">The level.</param>
 /// <param name="authInfo">The authentication info.</param>
 /// <param name="checkboxLabel">The checkbox label.</param>
 /// <param name="checkValue">The check value.</param>
 /// <returns>The <see cref="bool"/>.</returns>
 public bool PromptAuth(
     nsIDOMWindow parent,
     nsIChannel channel,
     uint level,
     nsIAuthInformation authInfo,
     string checkboxLabel,
     ref bool checkValue)
 {
     return PromptService.PromptAuth(channel, level, authInfo);
 }
コード例 #7
0
			nsICancelable nsIPromptService2.AsyncPromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, nsIAuthPromptCallback aCallback, Object aContext, UInt32 level, nsIAuthInformation authInfo, String checkboxLabel, ref Boolean checkValue)
			{
				Trace.TraceInformation("nsIPromptService2.AsyncPromptAuth");

				WebBrowser browser = GetBrowserFromDomWindow(aParent);
				if (browser == null)
				{
					Trace.TraceWarning("Can't get Browser object from DomWindow");
					aCallback.OnAuthCancelled(aContext, true);
					return null;
				}

				var e = new AsyncPromptAuthEventArgs(aCallback, aContext, (AuthLevel)level, authInfo, checkboxLabel, checkValue);
				browser.Events.Raise(EventKey.AsyncPromptAuth, e);
				checkValue = e.CheckState;
				return e;
			}
コード例 #8
0
		internal PromptAuthEventArgs(AuthLevel authLevel, nsIAuthInformation authInformation, String checkMsg, Boolean checkState)
			: base(false)
		{
			m_AuthLevel = authLevel;
			m_AuthFlags = (AuthFlags)authInformation.Flags;
			m_Realm = XpcomStringHelper.Get(authInformation.GetRealm);
			m_AuthScheme = XpcomStringHelper.Get(authInformation.GetAuthenticationScheme);
			Username = XpcomStringHelper.Get(authInformation.GetUsername);
			Password = XpcomStringHelper.Get(authInformation.GetPassword);
			Domain = XpcomStringHelper.Get(authInformation.GetDomain);
			m_CheckMsg = checkMsg;
			CheckState = checkState;
		}
コード例 #9
0
		internal AsyncPromptAuthEventArgs(nsIAuthPromptCallback callback, Object context, AuthLevel authLevel, nsIAuthInformation authInformation, String checkMsg, Boolean checkState)
			: base(authLevel, authInformation, checkMsg, checkState)
		{
			m_AuthCallback = callback;
			m_Context = context;
			m_AuthInformation = authInformation;
		}
コード例 #10
0
 public bool PromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, uint level, nsIAuthInformation authInfo, string checkboxLabel, ref bool checkValue)
 {
     throw new NotImplementedException();
 }
コード例 #11
0
 public bool PromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, uint level, nsIAuthInformation authInfo,
                        string checkboxLabel, ref bool checkValue)
 {
     return(false);
 }
コード例 #12
0
ファイル: PromptService.cs プロジェクト: ZhangLang001/GeckoFX
        public bool PromptAuth(nsIDOMWindow aParent, IntPtr aChannel, int level, nsIAuthInformation authInfo, string checkboxLabel, IntPtr aCheckValue)
        {
            string userName = nsString.Get(authInfo.GetUsername);
            string password = nsString.Get(authInfo.GetPassword);

            string realm = nsString.Get(authInfo.GetRealm);

            if (!PromptUsernameAndPassword(aParent, "Server Authentication", String.Format("The server '{0}' requires a user name and password.", realm), ref userName, ref password, checkboxLabel, aCheckValue))
                return false;

            nsString.Set(authInfo.SetUsername, userName);
            nsString.Set(authInfo.SetPassword, password);
            return true;
        }
 public bool PromptAuth([MarshalAs(UnmanagedType.Interface)] nsIDOMWindow aParent, [MarshalAs(UnmanagedType.Interface)] nsIChannel aChannel, uint level, [MarshalAs(UnmanagedType.Interface)] nsIAuthInformation authInfo, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.WStringMarshaler")] string checkboxLabel, [MarshalAs(UnmanagedType.U1)] ref bool checkValue)
 {
     return(true);
 }
 public nsICancelable AsyncPromptAuth([MarshalAs(UnmanagedType.Interface)] nsIDOMWindow aParent, [MarshalAs(UnmanagedType.Interface)] nsIChannel aChannel, [MarshalAs(UnmanagedType.Interface)] nsIAuthPromptCallback aCallback, [MarshalAs(UnmanagedType.Interface)] nsISupports aContext, uint level, [MarshalAs(UnmanagedType.Interface)] nsIAuthInformation authInfo, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.WStringMarshaler")] string checkboxLabel, [MarshalAs(UnmanagedType.U1)] ref bool checkValue)
 {
     return(null);
 }
コード例 #15
0
 public nsICancelable AsyncPromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, uint level, nsIAuthInformation authInfo, string checkboxLabel, ref bool checkValue)
 {
     //throw new NotImplementedException();
     return null;
 }
コード例 #16
0
 public bool PromptAuth(nsIChannel aChannel, uint level, nsIAuthInformation authInfo)
 {
     nsString.Set(authInfo.SetUsernameAttribute, "USERNAME");
     nsString.Set(authInfo.SetPasswordAttribute, "PASSWORD");
     return true;
 }
コード例 #17
0
 public nsICancelable AsyncPromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, uint level, nsIAuthInformation authInfo, string checkboxLabel, ref bool checkValue)
 {
     //throw new NotImplementedException();
     return(null);
 }
コード例 #18
0
			Boolean nsIPromptService2.PromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, UInt32 level, nsIAuthInformation authInfo, String checkboxLabel, ref Boolean checkValue)
			{
				Trace.TraceInformation("nsIPromptService2.PromptAuth");

				WebBrowser browser = GetBrowserFromDomWindow(aParent);
				if (browser == null)
				{
					Trace.TraceWarning("Can't get Browser object from DomWindow");
					return false;
				}

				var e = new PromptAuthEventArgs((AuthLevel)level, authInfo, checkboxLabel, checkValue);
				browser.Events.Raise(EventKey.PromptAuth, e);
				Boolean canProceed = !e.Cancel;

				if (canProceed)
				{
					authInfo.SetUsername(e.Username);
					authInfo.SetPassword(e.Password);
					authInfo.SetDomain(e.Domain);
				}

				checkValue = e.CheckState;
				return canProceed;
			}