本文整理汇总了C#中CredentialType类的典型用法代码示例。如果您正苦于以下问题:C# CredentialType类的具体用法?C# CredentialType怎么用?C# CredentialType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CredentialType类属于命名空间,在下文中一共展示了CredentialType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Build
public CredentialTypeViewModel Build(CredentialType credentialType)
{
return new CredentialTypeViewModel()
{
Id = credentialType.Id,
Name = credentialType.Name,
Position = credentialType.Position
};
}
开发者ID:blink2linkme,项目名称:Platformus,代码行数:9,代码来源:CredentialTypeViewModelBuilder.cs
示例17: GetCredentials
public ICredentials GetCredentials (Uri uri, IWebProxy proxy, CredentialType credentialType, ICredentials existingCredentials, bool retrying)
{
bool result = false;
DispatchService.GuiSyncDispatch (() => {
using (var ns = new NSAutoreleasePool ()) {
var message = string.Format ("{0} needs {1} credentials to access {2}.", BrandingService.ApplicationName,
credentialType == CredentialType.ProxyCredentials ? "proxy" : "request", uri.Host);
NSAlert alert = NSAlert.WithMessage ("Credentials Required", "OK", "Cancel", null, message);
alert.Icon = NSApplication.SharedApplication.ApplicationIconImage;
NSView view = new NSView (new RectangleF (0, 0, 313, 91));
var creds = Utility.GetCredentialsForUriFromICredentials (uri, existingCredentials);
var usernameLabel = new NSTextField (new RectangleF (17, 55, 71, 17)) {
Identifier = "usernameLabel",
StringValue = "Username:",
Alignment = NSTextAlignment.Right,
Editable = false,
Bordered = false,
DrawsBackground = false,
Bezeled = false,
Selectable = false,
};
view.AddSubview (usernameLabel);
var usernameInput = new NSTextField (new RectangleF (93, 52, 200, 22));
usernameInput.StringValue = creds != null ? creds.UserName : string.Empty;
view.AddSubview (usernameInput);
var passwordLabel = new NSTextField (new RectangleF (22, 23, 66, 17)) {
StringValue = "Password:",
Alignment = NSTextAlignment.Right,
Editable = false,
Bordered = false,
DrawsBackground = false,
Bezeled = false,
Selectable = false,
};
view.AddSubview (passwordLabel);
var passwordInput = new NSSecureTextField (new RectangleF (93, 20, 200, 22));
passwordInput.StringValue = creds != null ? creds.Password : string.Empty;
view.AddSubview (passwordInput);
alert.AccessoryView = view;
result = alert.RunModal () == 1;
username = usernameInput.StringValue;
password = passwordInput.StringValue;
}
});
return result ? new NetworkCredential (username, password) : null;
}
开发者ID:fedorw,项目名称:monodevelop,代码行数:56,代码来源:MacProxyCredentialProvider.cs
示例18: GetCredentials
public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying)
{
NetworkCredential credentials;
// If we are retrying, the stored credentials must be invalid.
if (!retrying && (credentialType == CredentialType.RequestCredentials) && TryGetCredentials(out credentials))
{
return credentials;
}
return null;
}
开发者ID:michaelstaib,项目名称:NuGet.Protocol,代码行数:10,代码来源:SettingsCredentialProvider.cs
示例19: AdalClient
public AdalClient(
AppConfig appConfig,
CredentialType credentialType,
IServiceInfoProvider serviceProvider = null)
: base(appConfig, credentialType, serviceProvider)
{
appConfig.ServiceResource = Constants.Authentication.GraphServiceUrl;
serviceProvider = new ServiceProvider();
this.ServiceInformation = _serviceInfoProvider.CreateServiceInfo(appConfig, credentialType).Result;
}
开发者ID:RapidCircle,项目名称:PnP-Tools,代码行数:10,代码来源:AdalClient.cs
示例20: GetCredentials
public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying)
{
NetworkCredential credentials;
// If we are retrying, the stored credentials must be invalid.
if (!retrying && (credentialType == CredentialType.RequestCredentials) && TryGetCredentials(uri, out credentials))
{
_logger.Log(MessageLevel.Info, NuGetResources.SettingsCredentials_UsingSavedCredentials, credentials.UserName);
return credentials;
}
return _credentialProvider.GetCredentials(uri, proxy, credentialType, retrying);
}
开发者ID:xero-github,项目名称:Nuget,代码行数:11,代码来源:SettingsCredentialProvider.cs
注:本文中的CredentialType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论