當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。