Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6531583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:53:44+00:00 2026-05-25T09:53:44+00:00

How can I implement following functionality in a project using or without using spring-security.

  • 0

How can I implement following functionality in a project using or without using spring-security.

1. LoggedIn Count: Number of times the user has logged into the system.

2. Time Spend: Total time spent by user.

As of now, I have thought about the solution using javascript, in which one request will be sent to the server periodically. And inside the server it will increment the spendtime variable.

Still would like to know that, is there anything coming alongwith spring-security itself or not. Or any other idea to handle such functionality.

Any idea/suggestion would be highly appreciated…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:53:44+00:00Added an answer on May 25, 2026 at 9:53 am

    1) For the numer of logins the best way is to plug in to Spring Security using AuthenticationSuccessHandler, as @user395072 said and hold the result in user table in numOfSuccessfulLogins adding +1 on every successful login.

    2) For the time spent on the site all You need is a session variable, lets’a call it $MY_TIME. Then on every request if $MY_TIME doesn’t exist in session, you set it to the current date (i.e. System.currentTimeMillis()). If it does exist, than You take the current time and substract the $MY_TIME value and You have the time spent so far in current session. On the same request You need need to persist it. You can have a separete table for it adding a new record when You set the $MY_TIME to session and updating the newest one every other time. Or You can have 2 fields in user table: cumulativeTime and currentSessionTime, and You add update cumulativeTime += currentSessionTime and currentSessionTime = 0 when settin $MY_TIME to session, and on any other request update currentSessionTime = System.currentTimeMillis() - $MY_TIME.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement the following functionality: Flex data grid has 1 default
I am trying to implement the following functionality in my application The user selects
I am creating a Rails app with the following functionality: A user can save
Can someone please tell me how I can implement the following line of pseudo-code.
How can I implement the following in python? #include <iostream> int main() { std::string
How can I implement cross browser opacity gradient (not color gradient)? See following code:
How can implement reordring in winforms datagridview by using the feature of drag and
I need to implement the following functionality in JavaScript/jQuery and its driving me nutts.
I am new to extJS, and trying to implement the following functionality: I have
I want to implement following functionality but I am confused if it's possible in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.