本文整理汇总了C#中Credentials类的典型用法代码示例。如果您正苦于以下问题:C# Credentials类的具体用法?C# Credentials怎么用?C# Credentials使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Credentials类属于命名空间,在下文中一共展示了Credentials类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: UpdateFromSourcedMo_Agreed
public void UpdateFromSourcedMo_Agreed()
{
using (TestMqServiceClient mq = new TestMqServiceClient())
{
Referral referral = (new SetData()).MinRegister();
Credentials cr = new Credentials { Organization = idLpu, Token = guid };
var result = mq.Register(cr, referral);
//обновляем данные
referral = (new SetData()).MinUpdateFromSourcedMo(result.IdMq);
referral.EventsInfo = new EventsInfo
{
Source = new EventSource
{
IsReferralReviewed = true,
ReferralCreateDate = ReferralData.eventsInfo.Source.ReferralCreateDate,
ReferralReviewDate = ReferralData.eventsInfo.Source.ReferralReviewDate
}
};
var updateResult = mq.UpdateFromSourcedMo(cr, referral);
}
if (Global.errors == "")
Assert.Pass();
else
Assert.Fail(Global.errors);
}
开发者ID:nbIxMaN,项目名称:MQTESTS,代码行数:26,代码来源:UpdateFromSourcedMo.cs
示例2: Test
public static void Test(string userName, string password, string sport)
{
ICredentials credentials = new Credentials { UserName = userName, Password = password };
var theSession = SessionFactory.CreateSession(new Uri(_url), credentials);
//Get the Unified Data Service
var theService = theSession.GetService("UnifiedDataAPI");
var theFeature = theService.GetFeature(sport);
//Get all the Resources (Fixtures) for the given sport
var theResources = theFeature.GetResources();
//Grab the first one, this is only an example after all
var theResource = theResources.First();
//Get the snapshot
var theSnapshot = theResource.GetSnapshot();
var fixtureSnapshot = JsonConvert.DeserializeObject<Fixture>(theSnapshot, new JsonSerializerSettings { Converters = new List<JsonConverter> { new IsoDateTimeConverter() }, NullValueHandling = NullValueHandling.Ignore });
System.Console.WriteLine(theSnapshot);
theResource.StreamConnected += (sender, args) => System.Console.WriteLine("Stream Connected");
theResource.StreamEvent += (sender, args) => System.Console.WriteLine(args.Update);
theResource.StreamDisconnected += (sender, args) => System.Console.WriteLine("Stream Disconnected");
//Start Streaming
theResource.StartStreaming();
//Wait 60 seconds, then stop the Stream
Thread.Sleep(600000);
theResource.StopStreaming();
}
开发者ID:andyb,项目名称:Unified_Data_API_Client_DotNet,代码行数:30,代码来源:Program.cs
示例3: GetCredentials
private Credentials GetCredentials()
{
var credentials = new Credentials();
try
{
if ( UserName.IsNullOrEmptyOrWhiteSpace() )
{
ErrorMessage = "The username field should not be empty";
return null;
}
if (TokenData.IsNullOrEmptyOrWhiteSpace())
{
ErrorMessage = AppResources.InvalidToken;
return null;
}
var tokenParts = TokenData.Split('/');
if ( tokenParts.Length != 2 || tokenParts[0].IsNullOrEmptyOrWhiteSpace() || tokenParts[1].IsNullOrEmptyOrWhiteSpace() )
{
ErrorMessage = AppResources.InvalidToken;
return null;
}
var identity = tokenParts[0];
var token = tokenParts[1];
credentials.Username = UserName;
credentials.Token = token;
credentials.Identity = identity;
}
catch ( Exception )
{
return null;
}
return credentials;
}
开发者ID:Codealike,项目名称:Codealike-WinPhone,代码行数:33,代码来源:LoginViewModel.cs
示例4: createTicketGrantingTicket
/** The validators to check the Credentials. */
//@NotNull
//private Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
/**
* @throws IllegalArgumentException if the Credentials are null or if given
* invalid credentials.
*/
public string createTicketGrantingTicket(Credentials credentials)
{
//Assert.notNull(credentials, "credentials cannot be null");
this.checkForErrors(credentials);
return this.centralAuthenticationService.createTicketGrantingTicket(credentials);
}
开发者ID:CSharpDev,项目名称:Dev.All,代码行数:15,代码来源:RemoteCentralAuthenticationService.cs
示例5: Authenticator
public Authenticator(Credentials credentials, IXmlSerializer serializer)
{
Ensure.ArgumentNotNull(credentials, "credentials");
Credentials = credentials;
_valueProvider = new SignatureValueProvider(serializer);
}
开发者ID:alex-erygin,项目名称:Platron.Client,代码行数:7,代码来源:Authenticator.cs
示例6: Init
private void Init()
{
if (ConfigurationReader == null)
{
ConfigurationReader = new zVirtualScenesHub.API.Configuration.WindowsStorageConfigurationReader();
}
try
{
Credentials = new Credentials();
var profilesIndex = ConfigurationReader.ReadSetting<string>("Profiles").Result;
if (!string.IsNullOrEmpty(profilesIndex))
{
Credentials = NewtonSerializer<Credentials>.FromJSON<Credentials>(profilesIndex);
foreach (var c in Credentials)
{
if (c.Default)
{
DefaultCredential = c;
break;
}
}
}
}
catch (Exception)
{
}
}
开发者ID:nothingmn,项目名称:zVirtualScenesHub,代码行数:29,代码来源:CredentialStore.cs
示例7: Equality
public void Equality()
{
Credentials oneA = new Credentials("a", "a", ServiceAccount.LocalService);
Credentials oneB = new Credentials("a", "a", ServiceAccount.LocalService);
Credentials two = new Credentials("2", "a", ServiceAccount.LocalService);
Credentials three = new Credentials("a", "2", ServiceAccount.LocalService);
Credentials four = new Credentials("a", "a", ServiceAccount.User);
oneA.Equals(oneA)
.ShouldBeTrue("instance equality");
oneA.Equals(oneB)
.ShouldBeTrue("value equality");
oneA.Equals(two)
.ShouldBeFalse("username");
oneA.Equals(three)
.ShouldBeFalse("password");
oneA.Equals(four)
.ShouldBeFalse("service account");
oneA.Equals(null)
.ShouldBeFalse("null");
}
开发者ID:KevM,项目名称:Topshelf,代码行数:26,代码来源:Credential_Specs.cs
示例8: TryAuthentifcate
public bool TryAuthentifcate(Credentials credentials, out Model.UserIdentity identity)
{
identity = null;
using (var database = DatabaseFactory.GetDatabase())
{
User user = database.Query<User>().FirstOrDefault(x => x.Name == credentials.UserName);
// Check if there is a User:
if (user == null)
{
return false;
}
// Make sure the Hashed Passwords match:
if (user.PasswordHash != cryptoService.ComputeHash(credentials.Password, user.PasswordSalt))
{
return false;
}
// We got a User, now obtain his claims from DB:
IList<Claim> claims = database.Fetch<Claim>(@"
select c.*
from auth.user u
inner join auth.user_claim uc on u.user_id = uc.user_id
inner join auth.claim c on uc.claim_id = c.claim_id
where u.user_id = @0", user.Id);
// And return the UserIdentity:
identity = Convert(user, claims);
return true;
}
}
开发者ID:alana1,项目名称:NancySamples,代码行数:34,代码来源:DatabaseAuthService.cs
示例9: ConnectToEWS
static private EWSConnection ConnectToEWS(Credentials credentials)
{
Logger.DebugFormat("Initializing FolderMailboxManager for email adderss {0}", credentials.EmailAddress);
var exchangeService = new ExchangeService(ExchangeVersion.Exchange2010_SP1)
{
Credentials = new WebCredentials(credentials.UserName, credentials.Password),
Timeout = 60000
};
exchangeService.AutodiscoverUrl(
credentials.EmailAddress,
x =>
{
Logger.DebugFormat("Following redirection for EWS autodiscover: {0}", x);
return true;
}
);
Logger.DebugFormat("Service URL: {0}", exchangeService.Url);
return new EWSConnection()
{
Service = exchangeService,
Router =
new RecipientsMailboxManagerRouter(
new EWSMailFolder(Folder.Bind(exchangeService, WellKnownFolderName.Inbox)))
};
}
开发者ID:modulexcite,项目名称:mail2bug,代码行数:28,代码来源:EWSConnectionManager.cs
示例10: Should_be_possible_be_possible_to_get_all_credential_informations
public void Should_be_possible_be_possible_to_get_all_credential_informations()
{
var credentials = new Credentials("mss", "lfernandes", "123456\\b", "RooT");
AssertCredentials(credentials, "mss", "lfernandes", "RooT");
Assert.AreEqual("123456\\b", credentials.GetPassword(), "An unexpected password value was found.");
}
开发者ID:jonaslsl,项目名称:modSIC,代码行数:7,代码来源:CredentialsTest.cs
示例11: If_username_was_given_with_embedded_domain_the_domain_field_must_be_ignored
public void If_username_was_given_with_embedded_domain_the_domain_field_must_be_ignored()
{
var credentialsWithDomainEmbeddedInUsernameAndInDomainField =
new Credentials(".", @"10.1.1.1\oval", string.Empty, string.Empty);
AssertCredentials(credentialsWithDomainEmbeddedInUsernameAndInDomainField, "10.1.1.1", "oval", string.Empty);
}
开发者ID:ywcsz,项目名称:modSIC,代码行数:7,代码来源:CredentialsTest.cs
示例12: TabViewModelBase
//public delegate void TournamentsUpdatedEventHandler(object sender, EventArgs e);
//protected event TournamentsUpdatedEventHandler TournamentsUpdatedEvent
public TabViewModelBase()
{
if(Credentials == null)
{
Credentials = new Credentials();
}
}
开发者ID:palbitz1003,项目名称:CMGC,代码行数:10,代码来源:TabViewModelBase.cs
示例13: GetResultDocument_NotEmptyDoc
public void GetResultDocument_NotEmptyDoc()
{
using (MqServiceClient mq = new MqServiceClient())
{
//Задаём статус направления "Зарегистрировано в РЕГИЗ.УО"
Referral referral = (new SetData()).MinRegister();
Credentials cr = new Credentials { Organization = idLpu, Token = guid };
var result = mq.Register(cr, referral);
//Задаём статус "Выдано пациенту"
referral = (new SetData()).SetStatus_PatientDocumentIssue(result.IdMq);
var res2 = mq.UpdateFromSourcedMo(cr, referral);
//Задаём статус "Выделена единица ресурса, целевой МО назначена дата приема"
referral = (new SetData()).MinChangePlannedResource(result.IdMq);
var res3 = mq.ChangePlannedResource(cr, referral);
//Задаём статус "Начато оказание медицинской помощи в целевой МО"
referral = (new SetData()).SetStatus_HealthCareStart(result.IdMq);
var res4 = mq.UpdateFromTargetMo(cr, referral);
//Задаём статус "Завершено оказание медицинской помощи в целевой МО"
referral = (new SetData()).SetStatus_HealthCareEnd(result.IdMq);
var res5 = mq.UpdateFromTargetMo(cr, referral);
referral = (new SetData()).GetResultDocument(result.IdMq);
var res6 = mq.GetResultDocument(cr, referral);
}
if (Global.errors == "")
Assert.Pass();
else
Assert.Fail(Global.errors);
}
开发者ID:nbIxMaN,项目名称:MQTESTS,代码行数:34,代码来源:GetResultDocument.cs
示例14: CredentialStore
public CredentialStore(Configuration.IConfigurationReader configurationReader = null)
{
ConfigurationReader = configurationReader;
if (ConfigurationReader == null)
{
#if WINDOWS_PHONE
ConfigurationReader = new Configuration.IsolatedStorageConfigurationReader();
#else
ConfigurationReader = new Configuration.AppConfigConfigurationReader();
#endif
}
Credentials = new Credentials();
var profilesIndex = ConfigurationReader.ReadSetting<string>("Profiles");
if (!string.IsNullOrEmpty(profilesIndex))
{
Credentials = Newtonsoft.Json.JsonConvert.DeserializeObject<Credentials>(profilesIndex);
foreach (var c in Credentials)
{
if (c.Default)
{
DefaultCredential = c;
break;
}
}
}
SetupDefault();
}
开发者ID:nothingmn,项目名称:zVirtualScenes-Client,代码行数:29,代码来源:CredentialStore.cs
示例15: CredentialStoreTest
private void CredentialStoreTest(string url, string username, string password)
{
try
{
Uri uri = new Uri(url, UriKind.Absolute);
Credentials writeCreds = new Credentials(username, password);
Credentials readCreds = null;
ICredentialStore priamryStore = new CredentialStore("prime-test");
priamryStore.WriteCredentials(uri, writeCreds);
if (priamryStore.ReadCredentials(uri, out readCreds))
{
Assert.AreEqual(writeCreds.Password, readCreds.Password, "Passwords did not match between written and read credentials");
Assert.AreEqual(writeCreds.Username, readCreds.Username, "Usernames did not match between written and read credentials");
}
else
{
Assert.Fail("Failed to read credentials");
}
priamryStore.DeleteCredentials(uri);
Assert.IsFalse(priamryStore.ReadCredentials(uri, out readCreds), "Deleted credentials were read back");
}
catch (Exception exception)
{
Assert.Fail(exception.Message);
}
}
开发者ID:colhountech,项目名称:Git-Credential-Manager-for-Windows,代码行数:31,代码来源:CredentialStoreTest.cs
示例16: Start
// Use this for initialization
void Start()
{
// First create the credentials object for the account. In this example email credentials are used
Credentials credentials = new Credentials();
credentials.email = email;
credentials.password = password;
// Create the user account with some profile data and attach it to the credentials created in the previous block
GDUser user = new GDUser();
user.credentials = credentials;
user.profile["email"] = email;
user.profile["name"] = "";
user.profile["color"] = "";
user.profile["hobby"] = "";
user.profile["film"] = "";
user.profile["age"] = 0;
user.profile["lvl"] = 1;
user.profile["wonAttr"] = 0;
user.profile ["friends"] = new Dictionary<string, object> ();
// Make the request to Gamedonia Backend to create the account and process the result in a block.
GamedoniaUsers.CreateUser(user, delegate (bool success){
if (success){
Debug.Log("Success");
}
else{
Debug.Log("Fail");
}
});
}
开发者ID:Derojo,项目名称:Medical,代码行数:32,代码来源:AddUser.cs
示例17: Cancellation
public MqResult Cancellation(Credentials cr, Referral r)
{
try
{
TestReferral tr = TestReferral.BuildReferralFromDataBaseData(r.ReferralInfo.IdMq);
tr.evInfo.cancellation = new TestCancellation(r.EventsInfo.Cancellation);
MqResult x = client.Cancellation(cr, r);
if (tr != TestReferral.BuildReferralFromDataBaseData(x.IdMq))
{
Global.errors1.Add("Несовпадение");
Global.errors1.AddRange(Global.errors2);
}
return x;
}
catch (System.ServiceModel.FaultException<MqTests.WebReference.MqFault[]> e)
{
getErrors(e.Detail);
return null;
}
catch (System.ServiceModel.FaultException<MqTests.WebReference.MqFault> e)
{
Global.errors1.Add(e.Detail.PropertyName + " - " + e.Detail.Message);
return null;
}
}
开发者ID:nbIxMaN,项目名称:MQTESTS,代码行数:25,代码来源:TestMqServiceClient.cs
示例18: OpenStorage
/// <summary>
/// Opens a storage session with the storage server.
/// </summary>
/// <param name="depotId">The depot id.</param>
/// <param name="depotVersion">The depot version.</param>
/// <param name="cellId">The cell id.</param>
/// <param name="credentials">The credentials.</param>
/// <param name="doHandshake">Whether or not to send the handshake and reopen cell</param>
/// <returns>A new StorageSession object for the session.</returns>
public StorageSession OpenStorage( uint depotId, uint depotVersion, uint cellId, Credentials credentials, bool doHandshake = true )
{
if (doHandshake)
{
bool bRet = this.HandshakeServer((ESteam2ServerType)7);
if (!bRet)
throw new Steam2Exception("Storage handshake with content server failed");
bRet = this.SendCommand(
0, // open storage
cellId
);
byte success = this.Socket.Reader.ReadByte();
if (success == 0)
throw new Steam2Exception(string.Format("Unable to open storage depot for cellid {0}", cellId));
ushort bannerLen = NetHelpers.EndianSwap(this.Socket.Reader.ReadUInt16());
byte[] bannerData = this.Socket.Reader.ReadBytes(bannerLen);
}
return new StorageSession( this, depotId, depotVersion, credentials );
}
开发者ID:Nephyrin,项目名称:SteamKit,代码行数:35,代码来源:ContentServerClient.cs
示例19: MinUpdateMedServiceProfile
public void MinUpdateMedServiceProfile()
{
using (MqServiceClient mq = new MqServiceClient())
{
Credentials cr = new Credentials { Organization = idLpu, Token = guid };
ProfileMedService medServ = (new SetData()).MinUpdateMedServiceProfile();
mq.UpdateMedServiceProfile(cr, medServ);
Options options = new Options
{
DateReport = OptionData.options.DateReport,
Target = new ReferralTarget
{
Lpu = new Coding { Code = idLpu, System = Dictionary.MO, Version = "1" }
},
ReferralInfo = new ReferralInfo { ProfileMedService = medServ.IdProfileMedService }
};
var result = mq.GetQueueInfo(cr, options);
}
if (Global.errors == "")
Assert.Pass();
else
Assert.Fail(Global.errors);
}
开发者ID:nbIxMaN,项目名称:MQTESTS,代码行数:26,代码来源:UpdateMedServiceProfile.cs
示例20: GetGeoding
public void GetGeoding()
{
var credentials = new Credentials(token);
var client = new MapboxClient(credentials);
var result = client.GeocodingApi.SearchGeocoding("coventry");
Console.WriteLine(result.Result);
}
开发者ID:hahmed,项目名称:Mapbox-csharp-client,代码行数:7,代码来源:MapboxTests.cs
注:本文中的Credentials类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论