本文整理汇总了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);
}
示例2: Credential
public Credential(CredentialType credentialType, string applicationName, string userName, string password)
{
ApplicationName = applicationName;
UserName = userName;
Password = password;
CredentialType = credentialType;
}
示例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);
}
示例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;
}
}
示例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;
}
示例6: Load
public static PSObject Load(string target, CredentialType type = CredentialType.Generic)
{
PSObject cred;
NativeMethods.CredRead(FixTarget(target), type, 0, out cred);
return cred;
}
示例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;
}
示例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;
// }
}
示例9: Credential
public Credential(CredentialType credentialType, string applicationName, string userName, string password)
{
_applicationName = applicationName;
_userName = userName;
_password = password;
_credentialType = credentialType;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}