当前位置: 首页>>代码示例>>C#>>正文


C# CredentialType类代码示例

本文整理汇总了C#中CredentialType的典型用法代码示例。如果您正苦于以下问题:C# CredentialType类的具体用法?C# CredentialType怎么用?C# CredentialType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CredentialType类属于命名空间,在下文中一共展示了CredentialType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PutCredentialType

        public IHttpActionResult PutCredentialType(int id, CredentialType credentialType)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != credentialType.ID)
            {
                return BadRequest();
            }

            db.Entry(credentialType).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CredentialTypeExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
开发者ID:rmadziyauswa,项目名称:PasswordKeeper,代码行数:32,代码来源:CredentialTypesController.cs

示例2: Credential

 public Credential(CredentialType credentialType, string applicationName, string userName, string password)
 {
     ApplicationName = applicationName;
     UserName = userName;
     Password = password;
     CredentialType = credentialType;
 }
开发者ID:notdev,项目名称:AutoRohlikovac,代码行数:7,代码来源:CredentialManager.cs

示例3: GetCredentials

        public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CredentialType credentialType , bool retrying)
        {
            if (Credentials.ContainsKey(uri))
                return Credentials[uri];

            return provider.GetCredentials(uri, proxy, credentialType, retrying);
        }
开发者ID:n3rd,项目名称:SymbolSource.Community,代码行数:7,代码来源:TestHelper.cs

示例4: GetCredentials

        public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            string message = credentialType == CredentialType.ProxyCredentials ?
                    LocalizedResourceManager.GetString("Credentials_ProxyCredentials") :
                    LocalizedResourceManager.GetString("Credentials_RequestCredentials");
            Console.WriteLine(message, uri.OriginalString);
            Console.Write(LocalizedResourceManager.GetString("Credentials_UserName"));
            string username = Console.ReadLine();
            Console.Write(LocalizedResourceManager.GetString("Credentials_Password"));

            using (SecureString password = new SecureString())
            {
                Console.ReadSecureString(password);
                var credentials = new NetworkCredential
                {
                    UserName = username,
                    SecurePassword = password
                };
                return credentials;
            }
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:26,代码来源:ConsoleCredentialProvider.cs

示例5: CreateCredentials

        public static ICredentials CreateCredentials(
            CredentialType credentialType,
            String userName,
            String password,
            Uri url
        )
        {
            if (credentialType == CredentialType.Default
                && IsSharePointOnline(url)
            )
            {
                credentialType = CredentialType.SharePointOnline;
            }

            switch (credentialType)
            {
                case CredentialType.Windows:
                    return new NetworkCredential(
                        userName,
                        password
                    );
                case CredentialType.SharePointOnline:
                    return new SharePointOnlineCredentials(
                        userName,
                        password
                    );
            }

            return null;
        }
开发者ID:NaseUkolyCZ,项目名称:HarshPoint,代码行数:30,代码来源:CredentialFactory.cs

示例6: Load

       public static PSObject Load(string target, CredentialType type = CredentialType.Generic)
       {
           PSObject cred;
           NativeMethods.CredRead(FixTarget(target), type, 0, out cred);

           return cred;
       }
开发者ID:juneb,项目名称:BetterCredentials,代码行数:7,代码来源:NativeMethods.cs

示例7: GetCredentials

        public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            if (LaunchedFromVS())
            {
                throw new InvalidOperationException(LocalizedResourceManager.GetString("Error_CannotPromptForCedentials"));
            }

            string message = credentialType == CredentialType.ProxyCredentials ?
                    LocalizedResourceManager.GetString("Credentials_ProxyCredentials") :
                    LocalizedResourceManager.GetString("Credentials_RequestCredentials");
            Console.WriteLine(message, uri.OriginalString);
            Console.Write(LocalizedResourceManager.GetString("Credentials_UserName"));
            string username = Console.ReadLine();
            Console.Write(LocalizedResourceManager.GetString("Credentials_Password"));
            SecureString password = ReadLineAsSecureString();
            var credentials = new NetworkCredential
            {
                UserName = username,
                SecurePassword = password
            };

            return credentials;
        }
开发者ID:themotleyfool,项目名称:NuGet,代码行数:28,代码来源:ConsoleCredentialProvider.cs

示例8: get_credentials_from_user

        public ICredentials get_credentials_from_user(Uri uri, IWebProxy proxy, CredentialType credentialType)
        {
            if (!_config.Information.IsInteractive)
            {
                return CredentialCache.DefaultCredentials;
            }

            string message = credentialType == CredentialType.ProxyCredentials ?
                                 "Please provide proxy credentials:" :
                                 "Please provide credentials for: {0}".format_with(uri.OriginalString);
            this.Log().Info(ChocolateyLoggers.Important, message);

            Console.Write("User name: ");
            string username = Console.ReadLine();
            Console.Write("Password: ");
            var password = Console.ReadLine();

            //todo: set this up as secure
            //using (var securePassword = new SecureString())
            //{
            //    foreach (var letter in password.to_string())
            //    {
            //        securePassword.AppendChar(letter);
            //    }

            var credentials = new NetworkCredential
                {
                    UserName = username,
                    Password = password,
                    //SecurePassword = securePassword
                };
            return credentials;
            // }
        }
开发者ID:secretGeek,项目名称:choco,代码行数:34,代码来源:ChocolateyNugetCredentialProvider.cs

示例9: Credential

 public Credential(CredentialType credentialType, string applicationName, string userName, string password)
 {
     _applicationName = applicationName;
     _userName = userName;
     _password = password;
     _credentialType = credentialType;
 }
开发者ID:olemp,项目名称:sherpa,代码行数:7,代码来源:CredentialManager.cs

示例10: GetCredentials

		public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying)
		{
			var cp = MonoDevelop.Core.WebRequestHelper.CredentialProvider;
			if (cp == null)
				return null;

			return cp.GetCredentials (uri, proxy, (MonoDevelop.Core.Web.CredentialType)credentialType, retrying);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:8,代码来源:MonoDevelopCredentialProvider.cs

示例11: PlaceholderForm

		internal PlaceholderForm (CredentialType type, Uri uri, NetworkCredential currentCredential)
		{
			this.uri = uri;
			this.type = type;
			current = currentCredential;
			Size = new Size (0, 0);
			Visible = false;
		}
开发者ID:jmloeffler,项目名称:monodevelop,代码行数:8,代码来源:WindowsProxyCredentialProvider.cs

示例12: Credential

 public Credential(string username, string password, string target, CredentialType type)
 {
     Username = username;
     Password = password;
     Target = target;
     Type = type;
     PersistanceType = PersistanceType.Session;
     _lastWriteTime = DateTime.MinValue;
 }
开发者ID:CuneytKukrer,项目名称:TestProject,代码行数:9,代码来源:Credential.cs

示例13: GetExistingCredentials

		static ICredentials GetExistingCredentials (Uri uri, CredentialType credentialType)
		{
			var rootUri = new Uri (uri.GetComponents (UriComponents.SchemeAndServer, UriFormat.SafeUnescaped));
			var existing =
				PasswordService.GetWebUserNameAndPassword (uri) ??
				PasswordService.GetWebUserNameAndPassword (rootUri);

			return existing != null ? new NetworkCredential (existing.Item1, existing.Item2) : null;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:9,代码来源:WindowsProxyCredentialProvider.cs

示例14: GetCredentials

		public ICredentials GetCredentials (Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying)
		{
			if (uri == null)
				throw new ArgumentNullException ("uri");

			var form = new PlaceholderForm (credentialType, uri, null);
			var result = GdkWin32.RunModalWin32Form (form, IdeApp.Workbench.RootWindow);
			return result ? new NetworkCredential (form.Username, form.Password, form.Domain) : null;
		}
开发者ID:newky2k,项目名称:monodevelop,代码行数:9,代码来源:WindowsProxyCredentialProvider.cs

示例15: GetCredentials

        public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            return PromptUserForCredentials(uri, forcePrompt: true);
        }
开发者ID:304NotModified,项目名称:NuGetPackageExplorer-1,代码行数:9,代码来源:WindowsCredentialProvider.cs


注:本文中的CredentialType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。