private UserSession FetchOrCreateSession( IUserSessionStore sessionService, string dbName, string login, IDictionary <string, object> userFields) { Debug.Assert(sessionService != null); Debug.Assert(userFields.ContainsKey("password")); var uid = (long)userFields[IdFieldName]; var oldSession = sessionService.GetByUserId(uid); if (oldSession == null) { var newSession = new UserSession(login, uid); sessionService.Put(newSession); return(newSession); } else if (!oldSession.IsActive) { sessionService.Remove(oldSession.Token); var newSession = new UserSession(login, uid); sessionService.Put(newSession); return(newSession); } else { sessionService.Pulse(oldSession.Token); return(oldSession); } }
/// <summary> /// ctor /// </summary> /// <param name="store"></param> /// <param name="logger"></param> public ServerSideTicketStore( IUserSessionStore store, ILogger <ServerSideTicketStore> logger) { _store = store; _logger = logger; }
public UserProfileFactory(IUserSessionStore userSessionStore = null) { _userSessionStore = userSessionStore ?? new UserSessionStore(); _profileCreationFunctions = new Dictionary <UserProfileType, Func <IUser, IUserProfile> > { { UserProfileType.StrangerProfile, (user) => new StrangerProfileFactory().Create(user) },
public ConfirmEmailController( IUserStore userStore = null, IUserSessionStore userSessionStore = null) { _userStore = userStore ?? new UserStore(); _userFromSession = userSessionStore ?? new UserSessionStore(); }
/// <summary> /// Ctor /// </summary> /// <param name="options"></param> /// <param name="ticketStore"></param> /// <param name="sessionStore"></param> /// <param name="tokenEndpoint"></param> /// <param name="logger"></param> public SessionRevocationService(BffOptions options, IServerTicketStore ticketStore, IUserSessionStore sessionStore, ITokenEndpointService tokenEndpoint, ILogger <SessionRevocationService> logger) { _options = options; _ticketStore = ticketStore; _sessionStore = sessionStore; _tokenEndpoint = tokenEndpoint; _logger = logger; }
public SendEmailConfirmationController( IUserStore userStore = null, IEmailSender emailSender = null, IUserSessionStore userSessionStore = null) { _userStore = userStore ?? new UserStore(); _emailSender = emailSender ?? new EmailSender(); _userSessionStore = userSessionStore ?? new UserSessionStore(); }
public CreateTeamController( ITeamStore teamStore = null, ITeamProfileFactory teamProfileFactory = null, IUserSessionStore userSessionStore = null) { _teamStore = teamStore ?? new TeamStore(); _teamProfileFactory = teamProfileFactory ?? new TeamProfileFactory(); _userSessionStore = userSessionStore ?? new UserSessionStore(); }
public CreateLeagueController( ILeagueStore leagueStore = null, ILeagueViewModelFactory leagueViewModelFactory = null, IUserSessionStore userSessionStore = null) { _leagueStore = leagueStore ?? new LeagueStore(); _leagueViewModelFactory = leagueViewModelFactory ?? new LeagueViewModelFactory(); _userSessionStore = userSessionStore ?? new UserSessionStore(); }
/// <summary> /// ctor /// </summary> /// <param name="store"></param> /// <param name="dataProtectionProvider"></param> /// <param name="logger"></param> public ServerSideTicketStore( IUserSessionStore store, IDataProtectionProvider dataProtectionProvider, ILogger <ServerSideTicketStore> logger) { _store = store; _protector = dataProtectionProvider.CreateProtector("Duende.Bff.ServerSideTicketStore"); _logger = logger; }
public LoginController( IUserSessionStore userSessionStore = null, IUserStore userStore = null, IUserPasswordValidator userPasswordValidator = null) { _userSessionStore = userSessionStore ?? new UserSessionStore(); _userStore = userStore ?? new UserStore(); _userPasswordValidator = userPasswordValidator ?? new UserPasswordValidator(); }
public UserSessionStoreTests() { var services = new ServiceCollection(); services.AddBff() .AddEntityFrameworkServerSideSessions(options => options.UseInMemoryDatabase(Guid.NewGuid().ToString())); var provider = services.BuildServiceProvider(); _subject = provider.GetRequiredService <IUserSessionStore>(); _database = provider.GetRequiredService <SessionDbContext>(); }
public JoinTeamController( ITeamStore teamStore = null, IInviteToTeamStore inviteToTeamStore = null, ITeamMemberStore teamMemberStore = null, IUserSessionStore userSessionStore = null) { _teamStore = teamStore ?? new TeamStore(); _inviteToTeamStore = inviteToTeamStore ?? new InviteToTeamStore(); _teamMemberStore = teamMemberStore ?? new TeamMemberStore(); _userSessionStore = userSessionStore ?? new UserSessionStore(); }
public ChangePasswordController( IChangePasswordRequestValidator changePasswordRequestValidator = null, IUserPasswordValidator userPasswordValidator = null, IUserStore userStore = null, IUserSessionStore userSessionStore = null) { _changePasswordRequestValidator = changePasswordRequestValidator ?? new ChangePasswordRequestValidator(); _userPasswordValidator = userPasswordValidator ?? new UserPasswordValidator(); _userStore = userStore ?? new UserStore(); _userSessionStore = userSessionStore ?? new UserSessionStore(); }
public CreateUserController( IUserStore userStore = null, IUserSessionStore userSessionStore = null, IUserPasswordValidator userPasswordValidator = null, ICreateUserRequestValidator createUserRequestValidator = null, ISendEmailConfirmation sendEmailConfirmation = null) { _userStore = userStore ?? new UserStore(); _userSessionStore = userSessionStore ?? new UserSessionStore(); _userPasswordValidator = userPasswordValidator ?? new UserPasswordValidator(); _createUserRequestValidator = createUserRequestValidator ?? new CreateUserRequestValidator(); _sendEmailConfirmation = sendEmailConfirmation ?? new SendEmailConfirmationController(); }
public DodgyController(IUserSessionStore sessionStore) { _sessionStore = sessionStore; }
public UserSessionManager(IUserSessionStore <TUserKey, TSessionKey> store, IAuthenticationManager authenticationManager, ILogger logger) { this.store = store; this.authenticationManager = authenticationManager; this.logger = logger; }
public OdissUserStore(IUserSessionStore <Guid, Guid> sessionStore, Serialization serialization) { this.sessionStore = sessionStore; this.serialization = serialization; }