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


C# Credentials类代码示例

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


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


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