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


C# AuthenticationService类代码示例

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


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


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