public AccountController(UserManager<ApplicationUser> userManager, IUserAuthentication userAuthentication, IEmailService<Email> emailService, ILogger logger) { UserManager = userManager; _userAuthentication = userAuthentication; _emailService = emailService; _logger = logger; }
public UserTasks( IInterestTasks interestTasks, IImageProcessor imageProcessor, IFileUploadService fileUploadService, IWebContentService webContentService, IFeedFinder feedFinder, IUserAuthentication userAuthentication, IConversationRepository conversationRepository, IEmailService emailService, ILocationService locationService, IUserRepository userRepository, IPageParsingService pageParsingService, IUserInterestTasks userInterestTasks) { _interestTasks = interestTasks; _imageProcessor = imageProcessor; _fileUploadService = fileUploadService; _webContentService = webContentService; _feedFinder = feedFinder; _userAuthentication = userAuthentication; _conversationRepository = conversationRepository; _emailService = emailService; _locationService = locationService; _userRepository = userRepository; _pageParsingService = pageParsingService; _userInterestTasks = userInterestTasks; }
public async Task <IUserAuthentication> AddNew(IUserAuthentication entity) { TUserAuthentication tEntity = entity as TUserAuthentication; var errors = await this.ValidateEntityToAdd(tEntity); if (errors.Count() > 0) { await this.ThrowEntityException(errors); } try { this.StartTransaction(); entity.Verified = false; entity.VerificationCode = _codeGenerator.GenerateCode(); entity.CodeExpiration = DateTime.Now; var savedEntity = await base.AddNew(tEntity); this.CommitTransaction(); /*write the email sending code*/ return(savedEntity); } catch (PostgresException ex) { throw new EntityUpdateException(ex); } catch { throw; } }
public StepDefinitions() { var mock = new Moq.Mock<IUserAuthentication>(); mock.Expect(x => x.IsValidLogin("admin", "password")).Returns(true); //mock.Expect(x => x.IsValidLogin(It.IsAny<string>(), It.IsAny<string>())).Returns(false); _auth = mock.Object; }
public static bool SetUserPassword(string AUsername, string APassword, bool APasswordNeedsChanged) { string UserAuthenticationMethod = TAppSettingsManager.GetValue("UserAuthenticationMethod", "OpenPetraDBSUser", false); if (UserAuthenticationMethod == "OpenPetraDBSUser") { TPetraPrincipal tempPrincipal; SUserRow UserDR = TUserManagerWebConnector.LoadUser(AUsername.ToUpper(), out tempPrincipal); SUserTable UserTable = (SUserTable)UserDR.Table; Random r = new Random(); UserDR.PasswordSalt = r.Next(1000000000).ToString(); UserDR.PasswordHash = TUserManagerWebConnector.CreateHashOfPassword(String.Concat(APassword, UserDR.PasswordSalt), "SHA1"); UserDR.PasswordNeedsChange = APasswordNeedsChanged; TDBTransaction Transaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.Serializable); SUserAccess.SubmitChanges(UserTable, Transaction); DBAccess.GDBAccessObj.CommitTransaction(); return(true); } else { IUserAuthentication auth = TUserManagerWebConnector.LoadAuthAssembly(UserAuthenticationMethod); return(auth.SetPassword(AUsername, APassword)); } }
public UserDetailsController(IUserDetails UserDetails, ICompanyDetails CompanyDetails, IRole Role, IUserAuthentication UserAuthentication) { _IUserDetails = UserDetails; _ICompanyDetails = CompanyDetails; _IRole = Role; _IUserAuthentication = UserAuthentication; }
public static bool PasswordAuthentication(String AUserID, String APassword) { TPetraPrincipal PetraPrincipal = null; SUserRow UserDR = TUserManagerWebConnector.LoadUser(AUserID, out PetraPrincipal); string UserAuthenticationMethod = TAppSettingsManager.GetValue("UserAuthenticationMethod", "OpenPetraDBSUser", false); if (UserAuthenticationMethod == "OpenPetraDBSUser") { if (TUserManagerWebConnector.CreateHashOfPassword(String.Concat(APassword, UserDR.PasswordSalt)) != UserDR.PasswordHash) { return(false); } } else { IUserAuthentication auth = TUserManagerWebConnector.LoadAuthAssembly(UserAuthenticationMethod); string ErrorMessage; if (!auth.AuthenticateUser(AUserID, APassword, out ErrorMessage)) { return(false); } } return(true); }
public UsersController(IUsersService usersService, IUserAuthentication authentication, ILoginService loginService) : base(authentication, loginService) { this.usersService = usersService; }
private void SaveExceptionToDatabase(Exception httpException) { var exceptionGuid = Guid.NewGuid(); IExceptionRepository exceptionRepository = DependencyResolver.Current.GetService(typeof(IExceptionRepository)) as IExceptionRepository; IExceptionEventRepository exceptionEventRepository = DependencyResolver.Current.GetService(typeof(IExceptionEventRepository)) as IExceptionEventRepository; IUserAuthentication authentication = DependencyResolver.Current.GetService(typeof(IUserAuthentication)) as IUserAuthentication; ISessionProvider sessionProvider = DependencyResolver.Current.GetService(typeof(ISessionProvider)) as ISessionProvider; var exceptions = this.GetAllExceptions(httpException) .ToList() .Select( exception => new ItanException { Message = exception.Message, Source = exception.Source, Stacktrace = exception.StackTrace, Typeof = exception.GetType().ToString(), ErrorId = exceptionGuid, UserId = authentication.CurrentUserIsAuthenticated() ? sessionProvider.GetCurrentUserId() : 0 }); var eventItanExceptions = exceptions.Select(e => new EventItanException() { ErrorId = exceptionGuid, ItanException = e }); //exceptionRepository.SaveToDatabase(exceptions); exceptionEventRepository.SaveToDatabase(eventItanExceptions); }
public UsersController(IUsersService usersService, IUserAuthentication authentication, ILoginService loginService, ISessionProvider sessionProvider) : base(authentication, loginService, sessionProvider) { this.usersService = usersService; }
public Smtp(IServerSetting settings, IUserAuthentication user, MimeMessage mimeMessage) { _client = new SmtpClient(); _mimeMessage = mimeMessage; _server = settings; _user = user; }
public UserSubscriptionService(IUsersSubscriptionRepository userSubscriptionsRepository, IUserSubscriptionEntryToReadRepository userSubscriptionsEntryToReadRepository, IUserAuthentication authentication) { this.userSubscriptionsRepository = userSubscriptionsRepository; this.userSubscriptionsEntryToReadRepository = userSubscriptionsEntryToReadRepository; this.authentication = authentication; }
public FriendlyImageUrlStrategy( IAlbumFacade gallery, IUserAuthentication authentication ) { this.gallery = gallery; this.authentication = authentication; }
public AccountController( IUserAuthentication authentication, ILoginService loginService, IAccountService accountService) : base(authentication, loginService) { this.accountService = accountService; }
public OpmlImporterController( IUserAuthentication authentication, ILoginService loginService, IOpmlImporterService opmlImporterService) : base(authentication, loginService) { this.opmlImporterService = opmlImporterService; }
public OpmlImporterController( IUserAuthentication authentication, ILoginService loginService, ISessionProvider sessionProvider, IOpmlImporterService opmlImporterService) : base(authentication, loginService, sessionProvider) { this.opmlImporterService = opmlImporterService; }
public GivenAnUserAuthentication() { UserRepository = new Mock <IUserRepository>(); UnitOfWork = new Mock <IUnitOfWork>(); EncriptionService = new Mock <IEncryptionService>(); DomainNotification = new Mock <INotifiable <DomainNotification> >(); UserAuthentication = new UserAuthentication(UnitOfWork.Object, UserRepository.Object, DomainNotification.Object, EncriptionService.Object); }
public StreamController( IUserAuthentication authentication, ILoginService loginService, IRssSubscriptionService rssSubscriptionService) : base(authentication, loginService) { this.rssSubscriptionService = rssSubscriptionService; }
public StreamController( IUserAuthentication authentication, ILoginService loginService, ISessionProvider sessionProvider, IRssSubscriptionService rssSubscriptionService) : base(authentication, loginService, sessionProvider) { this.rssSubscriptionService = rssSubscriptionService; }
public AccountController( IUserAuthentication authentication, ILoginService loginService, ISessionProvider sessionProvider, IAccountService accountService) : base(authentication, loginService, sessionProvider) { this.accountService = accountService; }
public HomeController( IUserAuthentication authentication, ILoginService loginService, ISessionProvider sessionProvider, IRssChannelsRepository rssRepository) : base(authentication, loginService, sessionProvider) { this.rssRepository = rssRepository; }
public SignInPageViewModel(INavigationService navigationService, IUserAuthentication userAuthentication, IPageDialogService dialogService, IAuthorizationService authorization) { _navigationService = navigationService; _userAuthentication = userAuthentication; _dialogService = dialogService; _authorization = authorization; }
public UsersService(IUserRepository usersRepository, IUsersSubscriptionRepository usersSubscriptionRepository, IUserAuthentication authentication, IMapper mapper) { this.usersRepository = usersRepository; this.usersSubscriptionRepository = usersSubscriptionRepository; this.authentication = authentication; this.mapper = mapper; }
public AdminController( IUserAuthentication authentication, ILoginService loginService, IAdminService adminService, IUpdateService updateService) : base(authentication, loginService) { this.adminService = adminService; this.updateService = updateService; }
public PersonSubscriptionHandler( IRssEventRepository rssEventsRepository, IUsersSubscriptionRepository usersSubscriptionRepository, IMapper mapper, IUserAuthentication authentication) { this.rssEventsRepository = rssEventsRepository; this.usersSubscriptionRepository = usersSubscriptionRepository; this.mapper = mapper; this.authentication = authentication; }
public OpmlImporterService( IRssChannelsSubscriptionsRepository rssSubscriptionsRepository, IRssChannelsRepository rssChannelsRepository, IOpmlReader opmlHandler, IUserAuthentication authentication) { this.rssSubscriptionsRepository = rssSubscriptionsRepository; this.rssChannelsRepository = rssChannelsRepository; this.opmlHandler = opmlHandler; this.authentication = authentication; }
public RssChannelController( IUserAuthentication authentication, ILoginService loginService, IRssChannelsService rssChannelsService, IRssSubscriptionService rssSubscriptionService, IUserSubscriptionService userSubscriptionServiceService) : base(authentication, loginService) { this.rssChannelsService = rssChannelsService; this.rssSubscriptionService = rssSubscriptionService; this.userSubscriptionServiceService = userSubscriptionServiceService; }
public ImageController( PreviewFacade preview, IImageFormat[] formats, IUserAuthentication authentication, IImageRequestStrategy strategy ) : base(authentication) { this.preview = preview; this.formats = formats; this.strategy = strategy; }
public RssSubscriptionHandler( IRssChannelsSubscriptionsRepository rssSubscriptionsRepository, IRssEntriesToReadRepository rssToReadRepository, IMapper mapper, IRssEventRepository rssEventsRepository, IUserAuthentication authentication) { this.rssSubscriptionsRepository = rssSubscriptionsRepository; this.rssToReadRepository = rssToReadRepository; this.mapper = mapper; this.rssEventsRepository = rssEventsRepository; this.authentication = authentication; }
public RssChannelController( IUserAuthentication authentication, ILoginService loginService, ISessionProvider sessionProvider, IRssChannelsService rssChannelsService, IRssSubscriptionService rssSubscriptionService, IUserSubscriptionService userSubscriptionServiceService) : base(authentication, loginService, sessionProvider) { this.rssChannelsService = rssChannelsService; this.rssSubscriptionService = rssSubscriptionService; this.userSubscriptionServiceService = userSubscriptionServiceService; }
public AlbumController( IAlbumFacade gallery, IAuthorizationService authorization, IUserAuthentication authentication, IImageRequestStrategy requestStrategy, ILocation dataLocation ) : base(authentication) { this.gallery = gallery; this.authorization = authorization; this.requestStrategy = requestStrategy; this.zipLocation = dataLocation.GetLocation("zips", ActionIfMissing.CreateNew); }
public UserController( IUserAuthentication repUserAuth, IUser repUser, IAnnualBudget repAnnualBudget, IIRASPermission repIRASPermission, IDepreciation repDepreciation ) { _repUserAuth = repUserAuth; _repUser = repUser; _repAnnualBudget = repAnnualBudget; _repIRASPermission = repIRASPermission; _repDepreciation = repDepreciation; }
private static void ConfigureOAuth(IAppBuilder app, IUserAuthentication userAppService, INotifiable <UserAuthenticated> userAuthenticateNotification) { var OAuthServerOptions = new OAuthAuthorizationServerOptions() { AllowInsecureHttp = true, TokenEndpointPath = new PathString("/api/security/token"), AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(1), ApplicationCanDisplayErrors = true, Provider = new SimpleAuthorizationServerProvider(userAppService, userAuthenticateNotification) }; // Token Generation app.UseOAuthAuthorizationServer(OAuthServerOptions); app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions()); }
public AccessController( IOpenIdAjaxRelyingParty openId, IUserAuthentication authentication, IRepository<IUserGroup> userGroupRepository, IAuthorizationService authorization, IAlbumFacade gallery ) : base(authentication) { this.openId = openId; this.authentication = authentication; this.userGroupRepository = userGroupRepository; this.authorization = authorization; this.gallery = gallery; }
public RssSubscriptionService( IRssChannelsSubscriptionsRepository rssSubscriptionsRepository, IRssEntriesToReadRepository rssToReadRepository, IRssEventRepository rssEventsRepository, IRssChannelsRepository rssChannelsRepository, ISubscriptionHandlerFactory subscriptionHandlerFactory, IUserAuthentication authentication) { this.rssSubscriptionsRepository = rssSubscriptionsRepository; this.rssToReadRepository = rssToReadRepository; this.rssEventsRepository = rssEventsRepository; this.rssChannelsRepository = rssChannelsRepository; this.subscriptionHandlerFactory = subscriptionHandlerFactory; this.authentication = authentication; }
public ApplicationLoginService( IUserAuthentication authentication, IUserRepository userRepository, ISocialLoginRepository socialLoginRepository, IUserRoleRepository repositoryUserRoles, IMapper mapper, IApplicationSettingsRepository applicationSettingsRepository) { this.authentication = authentication; this.userRepository = userRepository; this.socialLoginRepository = socialLoginRepository; this.repositoryUserRoles = repositoryUserRoles; this.mapper = mapper; this.applicationSettingsRepository = applicationSettingsRepository; }
public ApplicationLoginService( IUserAuthentication authentication, IUserRepository userRepository, ISocialLoginRepository socialLoginRepository, ISessionProvider sessionProvider, IUserRoleRepository repositoryUserRoles, IMapper mapper) { this.authentication = authentication; this.userRepository = userRepository; this.socialLoginRepository = socialLoginRepository; this.sessionProvider = sessionProvider; this.repositoryUserRoles = repositoryUserRoles; this.mapper = mapper; }
public UserController( IUserManagement UserManagement, IMiddleManagement MiddleManagment, IUserSession UserSession, IUserAuthentication UserAuthentication, IEnumerable<IUserAuthenticator> UserAuthenticators, IFormsAuthentication FormsAuthentication, IStringHash StringHash) : base(MiddleManagment, UserSession, FormsAuthentication) { userManagement = UserManagement; userAuthentication = UserAuthentication; userAuthenticators = UserAuthenticators; formsAuthentication = FormsAuthentication; stringHash = StringHash; }
public static bool GetAuthenticationFunctionality(out bool ACanCreateUser, out bool ACanChangePassword, out bool ACanChangePermissions) { ACanCreateUser = true; ACanChangePassword = true; ACanChangePermissions = true; string UserAuthenticationMethod = TAppSettingsManager.GetValue("UserAuthenticationMethod", "OpenPetraDBSUser", false); if (UserAuthenticationMethod != "OpenPetraDBSUser") { IUserAuthentication auth = TUserManagerWebConnector.LoadAuthAssembly(UserAuthenticationMethod); auth.GetAuthenticationFunctionality(out ACanCreateUser, out ACanChangePassword, out ACanChangePermissions); } return(true); }
public static IUserAuthentication LoadAuthAssembly(string AUserAuthenticationMethod) { if (FUserAuthenticationClass == null) { // namespace of the class TUserAuthentication, eg. Plugin.AuthenticationPhpBB // the dll has to be in the normal application directory string Namespace = AUserAuthenticationMethod; string NameOfDll = TAppSettingsManager.ApplicationDirectory + Path.DirectorySeparatorChar + Namespace + ".dll"; string NameOfClass = Namespace + ".TUserAuthentication"; // dynamic loading of dll System.Reflection.Assembly assemblyToUse = System.Reflection.Assembly.LoadFrom(NameOfDll); System.Type CustomClass = assemblyToUse.GetType(NameOfClass); FUserAuthenticationClass = (IUserAuthentication)Activator.CreateInstance(CustomClass); } return(FUserAuthenticationClass); }
public static void SimulatePasswordAuthenticationForNonExistingUser() { string UserAuthenticationMethod = TAppSettingsManager.GetValue("UserAuthenticationMethod", "OpenPetraDBSUser", false); if (UserAuthenticationMethod == "OpenPetraDBSUser") { TUserManagerWebConnector.CreateHashOfPassword("wrongPassword", Convert.ToBase64String(TPasswordHelper.CurrentPasswordScheme.GetNewPasswordSalt()), TPasswordHelper.CurrentPasswordSchemeNumber); } else { IUserAuthentication auth = TUserManagerWebConnector.LoadAuthAssembly(UserAuthenticationMethod); string ErrorMessage; auth.AuthenticateUser("wrongUser", "wrongPassword", out ErrorMessage); } }
public static IUserAuthentication LoadAuthAssembly(string AUserAuthenticationMethod) { if (FUserAuthenticationClass == null) { // namespace of the class TUserAuthentication, eg. Plugin.AuthenticationPhpBB // the dll has to be in the normal application directory string Namespace = AUserAuthenticationMethod; string NameOfDll = TAppSettingsManager.ApplicationDirectory + Path.DirectorySeparatorChar + Namespace + ".dll"; string NameOfClass = Namespace + ".TUserAuthentication"; // dynamic loading of dll System.Reflection.Assembly assemblyToUse = System.Reflection.Assembly.LoadFrom(NameOfDll); System.Type CustomClass = assemblyToUse.GetType(NameOfClass); FUserAuthenticationClass = (IUserAuthentication)Activator.CreateInstance(CustomClass); } return FUserAuthenticationClass; }
public static bool SetUserPassword(string AUsername, string APassword, bool APasswordNeedsChanged, bool AUnretireIfRetired) { string UserAuthenticationMethod = TAppSettingsManager.GetValue("UserAuthenticationMethod", "OpenPetraDBSUser", false); if (UserAuthenticationMethod == "OpenPetraDBSUser") { TDBTransaction SubmitChangesTransaction = null; bool SubmissionResult = false; TPetraPrincipal tempPrincipal; DBAccess.GDBAccessObj.BeginAutoTransaction(IsolationLevel.Serializable, ref SubmitChangesTransaction, ref SubmissionResult, delegate { SUserRow UserDR = TUserManagerWebConnector.LoadUser(AUsername.ToUpper(), out tempPrincipal); SUserTable UserTable = (SUserTable)UserDR.Table; Random r = new Random(); UserDR.PasswordSalt = r.Next(1000000000).ToString(); UserDR.PasswordHash = TUserManagerWebConnector.CreateHashOfPassword(String.Concat(APassword, UserDR.PasswordSalt), "SHA1"); UserDR.PasswordNeedsChange = APasswordNeedsChanged; // unretire the user if it has been previously retired if (AUnretireIfRetired) { UserDR.Retired = false; } SUserAccess.SubmitChanges(UserTable, SubmitChangesTransaction); SubmissionResult = true; }); return(true); } else { IUserAuthentication auth = TUserManagerWebConnector.LoadAuthAssembly(UserAuthenticationMethod); return(auth.SetPassword(AUsername, APassword)); } }
public UserService( IDtoMapper <User, CreateUser> regiserUserMapper, IDtoMapper <User, LoginDto> userDtoToUserMapper, IDtoMapper <LoginResponse, User> userToLoginResponseMapper, ISaveUser createUser, IUserAuthentication userAuthentication, IMakeFriendship makeFriendship, INameGenerate nameGenerate, IUserRepository userRepository, IUnityOfWork unityOfWork) { this.regiserUserMapper = regiserUserMapper; this.createUser = createUser; this.userToLoginResponseMapper = userToLoginResponseMapper; this.userDtoToUserMapper = userDtoToUserMapper; this.userAuthentication = userAuthentication; this.makeFriendship = makeFriendship; this.nameGenerate = nameGenerate; this.unityOfWork = unityOfWork; this.userRepository = userRepository; }
public RssChannelsService( IRssChannelsRepository channelsRepository, ISessionProvider sessionProvider, IRssChannelsSubscriptionsRepository channelsSubscriptionRepository, IRssEntriesToReadRepository rssEntriesToReadRepository, IUserAuthentication authentication, IRssChannelsSubscriptionsRepository rssSubscriptionRepository, ISessionProvider session, IMapper mapping, IEventRssChannelCreatedRepository eventRssChannelCreatedRepository) { this.channelsRepository = channelsRepository; this.sessionProvider = sessionProvider; this.channelsSubscriptionRepository = channelsSubscriptionRepository; this.rssEntriesToReadRepository = rssEntriesToReadRepository; this.authentication = authentication; this.rssSubscriptionRepository = rssSubscriptionRepository; this.session = session; this.mapping = mapping; this.eventRssChannelCreatedRepository = eventRssChannelCreatedRepository; }
/// <summary> /// Initializes a new instance of the <see cref="LoginController"/> class. /// </summary> public LoginController(IUserAuthentication userAuthentication, IUserSession <Domain.Model.User> userSession) { _userAuthentication = userAuthentication; _userSession = userSession; }
public AuthController(IUserAuthentication auth, ILogHandler logHandler, IExceptionHandler exceptionHandler) { authentication = auth; this.logHandler = logHandler; this.exceptionHandler = exceptionHandler; }
public static bool CreateUser(string AUsername, string APassword, string AFirstName, string AFamilyName, string AModulePermissions) { TDBTransaction ReadTransaction = null; TDBTransaction SubmitChangesTransaction = null; bool UserExists = false; bool SubmissionOK = false; // TODO: check permissions. is the current user allowed to create other users? SUserTable userTable = new SUserTable(); SUserRow newUser = userTable.NewRowTyped(); newUser.UserId = AUsername; newUser.FirstName = AFirstName; newUser.LastName = AFamilyName; if (AUsername.Contains("@")) { newUser.EmailAddress = AUsername; newUser.UserId = AUsername.Substring(0, AUsername.IndexOf("@")). Replace(".", string.Empty). Replace("_", string.Empty).ToUpper(); } // Check whether the user that we are asked to create already exists DBAccess.GDBAccessObj.BeginAutoReadTransaction(IsolationLevel.ReadCommitted, ref ReadTransaction, delegate { if (SUserAccess.Exists(newUser.UserId, ReadTransaction)) { TLogging.Log("Cannot create new user as a user with User Name '" + newUser.UserId + "' already exists!"); UserExists = true; } }); if (UserExists) { return(false); } userTable.Rows.Add(newUser); string UserAuthenticationMethod = TAppSettingsManager.GetValue("UserAuthenticationMethod", "OpenPetraDBSUser", false); if (UserAuthenticationMethod == "OpenPetraDBSUser") { if (APassword.Length > 0) { newUser.PasswordSalt = PasswordHelper.GetNewPasswordSalt(); newUser.PasswordHash = PasswordHelper.GetPasswordHash(APassword, newUser.PasswordSalt); newUser.PasswordNeedsChange = true; } } else { try { IUserAuthentication auth = TUserManagerWebConnector.LoadAuthAssembly(UserAuthenticationMethod); if (!auth.CreateUser(AUsername, APassword, AFirstName, AFamilyName)) { newUser = null; } } catch (Exception e) { TLogging.Log("Problem loading user authentication method " + UserAuthenticationMethod + ": " + e.ToString()); return(false); } } if (newUser != null) { DBAccess.GDBAccessObj.BeginAutoTransaction(IsolationLevel.Serializable, ref SubmitChangesTransaction, ref SubmissionOK, delegate { SUserAccess.SubmitChanges(userTable, SubmitChangesTransaction); List <string> modules = new List <string>(); if (AModulePermissions == DEMOMODULEPERMISSIONS) { modules.Add("PTNRUSER"); modules.Add("FINANCE-1"); ALedgerTable theLedgers = ALedgerAccess.LoadAll(SubmitChangesTransaction); foreach (ALedgerRow ledger in theLedgers.Rows) { modules.Add("LEDGER" + ledger.LedgerNumber.ToString("0000")); } } else { string[] modulePermissions = AModulePermissions.Split(new char[] { ',' }); foreach (string s in modulePermissions) { if (s.Trim().Length > 0) { modules.Add(s.Trim()); } } } SUserModuleAccessPermissionTable moduleAccessPermissionTable = new SUserModuleAccessPermissionTable(); foreach (string module in modules) { SUserModuleAccessPermissionRow moduleAccessPermissionRow = moduleAccessPermissionTable.NewRowTyped(); moduleAccessPermissionRow.UserId = newUser.UserId; moduleAccessPermissionRow.ModuleId = module; moduleAccessPermissionRow.CanAccess = true; moduleAccessPermissionTable.Rows.Add(moduleAccessPermissionRow); } SUserModuleAccessPermissionAccess.SubmitChanges(moduleAccessPermissionTable, SubmitChangesTransaction); // TODO: table permissions should be set by the module list // TODO: add p_data_label... tables here so user can generally have access string[] tables = new string[] { "p_bank", "p_church", "p_family", "p_location", "p_organisation", "p_partner", "p_partner_location", "p_partner_type", "p_person", "p_unit", "p_venue", "p_data_label", "p_data_label_lookup", "p_data_label_lookup_category", "p_data_label_use", "p_data_label_value_partner", }; SUserTableAccessPermissionTable tableAccessPermissionTable = new SUserTableAccessPermissionTable(); foreach (string table in tables) { SUserTableAccessPermissionRow tableAccessPermissionRow = tableAccessPermissionTable.NewRowTyped(); tableAccessPermissionRow.UserId = newUser.UserId; tableAccessPermissionRow.TableName = table; tableAccessPermissionTable.Rows.Add(tableAccessPermissionRow); } SUserTableAccessPermissionAccess.SubmitChanges(tableAccessPermissionTable, SubmitChangesTransaction); SubmissionOK = true; }); return(true); } return(false); }
public static bool SetUserPassword(string AUsername, string APassword, string AOldPassword, bool APasswordNeedsChanged, out TVerificationResultCollection AVerification) { TDBTransaction Transaction; string UserAuthenticationMethod = TAppSettingsManager.GetValue("UserAuthenticationMethod", "OpenPetraDBSUser", false); TVerificationResult VerificationResult; AVerification = new TVerificationResultCollection(); if (!TSharedSysManValidation.CheckPasswordQuality(APassword, out VerificationResult)) { return(false); } if (APasswordNeedsChanged && APassword == AOldPassword) { AVerification = new TVerificationResultCollection(); AVerification.Add(new TVerificationResult("\nPassword check.", Catalog.GetString( "Password not changed as the old password was reused. Please use a new password."), TResultSeverity.Resv_Critical)); return(false); } if (UserAuthenticationMethod == "OpenPetraDBSUser") { TPetraPrincipal tempPrincipal; SUserRow UserDR = TUserManagerWebConnector.LoadUser(AUsername.ToUpper(), out tempPrincipal); if (TUserManagerWebConnector.CreateHashOfPassword(String.Concat(AOldPassword, UserDR.PasswordSalt)) != UserDR.PasswordHash) { AVerification = new TVerificationResultCollection(); AVerification.Add(new TVerificationResult("\nPassword quality check.", String.Format( Catalog.GetString( "Old password entered incorrectly. Password not changed.")), TResultSeverity.Resv_Critical)); return(false); } SUserTable UserTable = (SUserTable)UserDR.Table; UserDR.PasswordHash = TUserManagerWebConnector.CreateHashOfPassword(String.Concat(APassword, UserDR.PasswordSalt)); UserDR.PasswordNeedsChange = false; Transaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.Serializable); try { SUserAccess.SubmitChanges(UserTable, Transaction); DBAccess.GDBAccessObj.CommitTransaction(); } catch (Exception Exc) { TLogging.Log("An Exception occured during the setting of the User Password:" + Environment.NewLine + Exc.ToString()); DBAccess.GDBAccessObj.RollbackTransaction(); throw; } return(true); } else { IUserAuthentication auth = TUserManagerWebConnector.LoadAuthAssembly(UserAuthenticationMethod); return(auth.SetPassword(AUsername, APassword, AOldPassword)); } }
/// <summary> /// Initializes a new instance of the <see cref="UserAuthenticationService"/> class. /// </summary> /// <param name="userAuthentication">The user authentication.</param> /// <param name="emailService">The email service.</param> /// <param name="appInfoService">The app info service.</param> public UserAuthenticationService(IUserAuthentication userAuthentication, IEmailService emailService, IAppInfoService appInfoService) { _userAuthentication = userAuthentication; _emailService = emailService; _appInfoService = appInfoService; }
public PasswordValidator(IUserAuthentication dbAuthentcator, String Username, String Password) { _dbauth = dbAuthentcator; _Username = Username; _Password = Password; }
/// <summary> /// 构造函数。 /// </summary> public AuthenticationProvider() { this.authentication = new DataSyncFactory(); }
public SimpleAuthorizationServerProvider(IUserAuthentication userAuthentication, INotifiable <UserAuthenticated> userAuthenticateNotification) { _userAuthentication = userAuthentication; _userAuthenticateNotification = userAuthenticateNotification; }
public RssItemActionService(IRssActionRepository rssItemActionRepository, IUserAuthentication authentication) { this.rssItemActionRepository = rssItemActionRepository; this.authentication = authentication; }
public AccountService(IUserRepository userRepository, IMapper mapper, IUserAuthentication authentication) { this.userRepository = userRepository; this.mapper = mapper; this.authentication = authentication; }
protected BaseController(IUserAuthentication authentication, ILoginService loginService, ISessionProvider sessionProvider) { this.authentication = authentication; this.loginService = loginService; this.sessionProvider = sessionProvider; }
public AlbumItemController(IAlbumFacade gallery, IUserAuthentication authentication) : base(authentication) { this.gallery = gallery; }