本文整理汇总了C#中AuthenticationService类的典型用法代码示例。如果您正苦于以下问题:C# AuthenticationService类的具体用法?C# AuthenticationService怎么用?C# AuthenticationService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationService类属于命名空间,在下文中一共展示了AuthenticationService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatePostTransactionScript
public CreatePostTransactionScript(
AuthenticationService authenticationService,
PostToPostDTOMapper postToPostDtoMapper)
{
_authenticationService = authenticationService;
_postToPostDtoMapper = postToPostDtoMapper;
}
示例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);
}
示例3: OneTimeSetup
public void OneTimeSetup()
{
_passwordHasher = Substitute.For<IPasswordHasher>();
_passwordHasher.ComputeHash("somestring", new byte[4]).ReturnsForAnyArgs("hashedPassword");
_authService = new AuthenticationService(Session, _passwordHasher);
}
示例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);
}
示例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);
}
示例7: UpdateCommentTransactionScript
public UpdateCommentTransactionScript(
AuthenticationService authenticationService,
CommentToCommentDTOMapper commentToCommentDtoMapper)
{
_authenticationService = authenticationService;
_commentToCommentDtoMapper = commentToCommentDtoMapper;
}
示例8: LoginController
public LoginController(
UserAccountService userService,
AuthenticationService authSvc)
{
this.userAccountService = userService;
this.authSvc = authSvc;
}
示例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);
}
示例10: GetPostsTransactionScript
public GetPostsTransactionScript(
AuthenticationService authenticationService,
PostToBriefPostDTOMapper postToBriefPostDtoMapper)
{
_authenticationService = authenticationService;
_postToBriefPostDtoMapper = postToBriefPostDtoMapper;
}
示例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();
}
示例12: SessionService
public SessionService(AuthenticationService authenticationService,
IGitterApiService gitterApiService,
IPasswordStorageService passwordStorageService)
{
_authenticationService = authenticationService;
_gitterApiService = gitterApiService;
_passwordStorageService = passwordStorageService;
}
示例13: ServiceAdapter
public ServiceAdapter()
{
authServ = new AuthenticationService();
proServ = new ProfileService();
dbcServ = new DaybookClientService();
authServ.CookieContainer = new System.Net.CookieContainer();
Instance = this;
}
示例14: LogIn
public void LogIn()
{
AuthenticationService authenticationService = new AuthenticationService(new UserRepository());
var result = authenticationService.LogIn("rodrigo.cruz", "1234");
Assert.AreEqual(false, result);
}
示例15: SecuredRemoteServiceBase
protected SecuredRemoteServiceBase(
Configuration configuration,
ConfigurationService configurationService,
AuthenticationService authenticationService)
: base(configuration, configurationService)
{
AuthenticationService = authenticationService;
}