• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AuthenticationService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CreatePostTransactionScript

 public CreatePostTransactionScript(
     AuthenticationService authenticationService,
     PostToPostDTOMapper postToPostDtoMapper)
 {
     _authenticationService = authenticationService;
     _postToPostDtoMapper = postToPostDtoMapper;
 }
开发者ID:loki2302,项目名称:entity-framework-experiment,代码行数:7,代码来源:CreatePostTransactionScript.cs


示例2: AuthenticationService

        public void IsValidTest_只有驗證Authentication合法或非法()
        {
            //arrange
            //IProfile profile = MockRepository.GenerateStub<IProfile>();
            //profile.Stub(x => x.GetPassword("Joey")).Return("91");

            IProfile profile = Substitute.For<IProfile>();
            profile.GetPassword("Joey").Returns("91");

            //IToken token = MockRepository.GenerateStub<IToken>();
            //token.Stub(x => x.GetRandom("Joey")).Return("abc");
            IToken token = Substitute.For<IToken>();
            token.GetRandom("Joey").Returns("abc");

            //ILog log = MockRepository.GenerateStub<ILog>();
            ILog log = Substitute.For<ILog>();

            AuthenticationService target = new AuthenticationService(profile, token, log);
            string account = "Joey";
            string password = "wrong password";
            // 正確的 password 應為 "91abc"

            //act
            bool actual;
            actual = target.IsValid(account, password);

            // assert
            Assert.IsFalse(actual);
        }
开发者ID:cashwu,项目名称:TDD,代码行数:29,代码来源:v4-AuthenticationServiceTests+-+mock.cs


示例3: OneTimeSetup

        public void OneTimeSetup()
        {
            _passwordHasher = Substitute.For<IPasswordHasher>();
            _passwordHasher.ComputeHash("somestring", new byte[4]).ReturnsForAnyArgs("hashedPassword");

            _authService = new AuthenticationService(Session, _passwordHasher);
        }
开发者ID:PaulCampbell,项目名称:ATP,代码行数:7,代码来源:AuthenticationServiceFixture.cs


示例4: AuthenticationRegistry

        public AuthenticationRegistry(IAuthenticationProvider facebookProvider,
                                      IAuthenticationProvider googleProvider,
                                      IAuthenticationProvider twitterProvider)
        {
            var authenticationService = new AuthenticationService();

            if (facebookProvider != null)
            {
                authenticationService.AddProvider(facebookProvider);
            }

            if (googleProvider != null)
            {
                authenticationService.AddProvider(googleProvider);
            }

            if (twitterProvider != null)
            {
                authenticationService.AddProvider(twitterProvider);
            }

            For<IAuthenticationService>()
                .Use(authenticationService)
                .Named("Authentication Service.");
        }
开发者ID:codeprogression,项目名称:WorldDomination.Web.Authentication,代码行数:25,代码来源:AuthenticationRegistry.cs


示例5: wrong_email_address_cannot_log_in

        public void wrong_email_address_cannot_log_in()
        {
            _authService = new AuthenticationService(Session, _passwordHasher);
            var result = _authService.Login("invalidAddress", "SomePassword");

            Assert.AreEqual(LoginResult.unsuccessful, result);
        }
开发者ID:PaulCampbell,项目名称:ATP,代码行数:7,代码来源:AuthenticationServiceFixture.cs


示例6: should_add_and_successfully_authenticate_the_first_user

 public void should_add_and_successfully_authenticate_the_first_user()
 {
     var userRepository = new MemoryRepository<User>();
     var authenticationService = new AuthenticationService(userRepository, new UserCreateService(userRepository));
     authenticationService.Authenticate(Username, Password);
     userRepository.Count().ShouldEqual(1);
 }
开发者ID:mikeobrien,项目名称:volta,代码行数:7,代码来源:AuthenticationServiceTests.cs


示例7: UpdateCommentTransactionScript

 public UpdateCommentTransactionScript(
     AuthenticationService authenticationService,
     CommentToCommentDTOMapper commentToCommentDtoMapper)
 {
     _authenticationService = authenticationService;
     _commentToCommentDtoMapper = commentToCommentDtoMapper;
 }
开发者ID:loki2302,项目名称:entity-framework-experiment,代码行数:7,代码来源:UpdateCommentTransactionScript.cs


示例8: LoginController

 public LoginController(
     UserAccountService userService, 
     AuthenticationService authSvc)
 {
     this.userAccountService = userService;
     this.authSvc = authSvc;
 }
开发者ID:paulute,项目名称:BrockAllen.MembershipReboot,代码行数:7,代码来源:LoginController.cs


示例9: Create_New_User_Test

        public void Create_New_User_Test()
        {
            var user = new User()
            {
                FirstName = "Joe",
                LastName = "Henss",
                UserName = "joehenss",
                Password = Hasher.Hash("password"),
                PasswordSecurityQuestion = "Mother's maiden name",
                PasswordSecurityAnswer = "Hamilton"
            };

            var authenticationProvider = new AuthenticationService();
            var saveUserRequest = new SaveUserRequest() { User = user };

            var saveUserResponse = authenticationProvider.SaveUser(saveUserRequest);

            Assert.IsNotNull(saveUserResponse);
            Assert.AreEqual(ResponseStatus.Success, saveUserResponse.Status);

            var authenticateUserRequest = new AuthenticationRequest()
            {
                UserName = user.UserName,
                Password = user.Password
            };

            var authenticationResponse = authenticationProvider.AuthenticateUser(authenticateUserRequest);

            Assert.IsNotNull(authenticationResponse);
            Assert.AreEqual(ResponseStatus.Success, authenticationResponse.Status);
        }
开发者ID:jbob24,项目名称:fp,代码行数:31,代码来源:UnitTest1.cs


示例10: GetPostsTransactionScript

 public GetPostsTransactionScript(
     AuthenticationService authenticationService,
     PostToBriefPostDTOMapper postToBriefPostDtoMapper)
 {
     _authenticationService = authenticationService;
     _postToBriefPostDtoMapper = postToBriefPostDtoMapper;
 }
开发者ID:loki2302,项目名称:entity-framework-experiment,代码行数:7,代码来源:GetPostsTransactionScript.cs


示例11: should_successfully_authenticate_with_correct_credentials

 public void should_successfully_authenticate_with_correct_credentials()
 {
     var authenticationService = new AuthenticationService(_userRepository, new UserCreateService(_userRepository));
     var result = authenticationService.Authenticate(Username, Password);
     result.ShouldNotBeNull();
     result.Username.ToString().ShouldEqual(Username);
     result.IsAdministrator.ShouldBeTrue();
 }
开发者ID:mikeobrien,项目名称:volta,代码行数:8,代码来源:AuthenticationServiceTests.cs


示例12: SessionService

 public SessionService(AuthenticationService authenticationService,
     IGitterApiService gitterApiService,
     IPasswordStorageService passwordStorageService)
 {
     _authenticationService = authenticationService;
     _gitterApiService = gitterApiService;
     _passwordStorageService = passwordStorageService;
 }
开发者ID:nmetulev,项目名称:Modern-Gitter,代码行数:8,代码来源:SessionService.cs


示例13: ServiceAdapter

 public ServiceAdapter()
 {
     authServ = new AuthenticationService();
     proServ = new ProfileService();
     dbcServ = new DaybookClientService();
     authServ.CookieContainer = new System.Net.CookieContainer();
     Instance = this;
 }
开发者ID:chandru9279,项目名称:StarBase,代码行数:8,代码来源:ServiceAdapter.cs


示例14: LogIn

        public void LogIn()
        {
            AuthenticationService authenticationService = new AuthenticationService(new UserRepository());

            var result = authenticationService.LogIn("rodrigo.cruz", "1234");

            Assert.AreEqual(false, result);
        }
开发者ID:controllersystems,项目名称:DeusCumpre,代码行数:8,代码来源:UnitTest1.cs


示例15: SecuredRemoteServiceBase

 protected SecuredRemoteServiceBase(
     Configuration configuration,
     ConfigurationService configurationService,
     AuthenticationService authenticationService)
     : base(configuration, configurationService)
 {
     AuthenticationService = authenticationService;
 }
开发者ID:pamidur,项目名称:Gpodder.NET,代码行数:8,代码来源:SecuredRemoteServiceBase.cs


示例16: TestAuthentication

        public void TestAuthentication()
        {
            AuthenticationService service = new AuthenticationService();
            bool result = service.validate("guest", Encrypt("123456"));
            Assert.IsTrue(result);

            result = service.validate("guest", Encrypt("34545"));
            Assert.IsFalse(result);
        }
开发者ID:philfanzhou,项目名称:PredictFuture,代码行数:9,代码来源:AuthenticationServiceTest.cs


示例17: RetrieveAuthenticateUserByUserIdAsync

 public void RetrieveAuthenticateUserByUserIdAsync()
 {
     AuthenticationService authentication = new AuthenticationService();
     AuthenticateDetail userAccount = new AuthenticateDetail();
     userAccount.UserId = "0112";
     userAccount.Password = "55555";
     var task = authentication.RetrieveAuthenticateUserByUserIdAsync(userAccount);
     Console.WriteLine("completed");
 }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:9,代码来源:TestServices.cs


示例18: GetUserDetailsTransactionScript

 public GetUserDetailsTransactionScript(
     AuthenticationService authenticationService,
     PostToBriefPostDTOMapper postToBriefPostDtoMapper,
     CommentToCommentDTOMapper commentToCommentDtoMapper)
 {
     _authenticationService = authenticationService;
     _postToBriefPostDtoMapper = postToBriefPostDtoMapper;
     _commentToCommentDtoMapper = commentToCommentDtoMapper;
 }
开发者ID:loki2302,项目名称:entity-framework-experiment,代码行数:9,代码来源:GetUserDetailsTransactionScript.cs


示例19: IsAdmin_WhenIdentityIsNull_IsAdminIsFalse

        public void IsAdmin_WhenIdentityIsNull_IsAdminIsFalse()
        {
            //Arrange
            var service = new AuthenticationService();
            var applicationContext = Mock.Create<IApplicationContextService>();
            Mock.Arrange(() => applicationContext.Identity).Returns(() => null);
            service.ApplicationContextService = applicationContext;

            //Assert
            Assert.IsFalse(service.IsAdmin);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:11,代码来源:AuthenticationServiceTests.cs


示例20: GivenANullIAuthenticationServiceSettings_CheckCallback_ThrowsAnException

            public void GivenANullIAuthenticationServiceSettings_CheckCallback_ThrowsAnException()
            {
                // Arrange.
                var querystringParams = new NameValueCollection {{"a", "b"}};
                var authenticationService = new AuthenticationService();

                // Act and Assert.
                var result = Assert.Throws<ArgumentNullException>(
                    () => authenticationService.GetAuthenticatedClient(null, querystringParams));

                Assert.NotNull(result);
                Assert.Equal("Value cannot be null.\r\nParameter name: authenticationServiceSettings", result.Message);
            }
开发者ID:jchannon,项目名称:World-Domination.Web.Authentication,代码行数:13,代码来源:AuthenticationServiceFacts.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AuthenticationType类代码示例发布时间:2022-05-24
下一篇:
C# AuthenticationSchemes类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap