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 6865953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:07:06+00:00 2026-05-27T03:07:06+00:00

Context: Web Application – Java, Spring MVC, Spring Security What is not transparent to

  • 0

Context: Web Application – Java, Spring MVC, Spring Security

What is not transparent to me is what information to store/how to perform certain actions in web application(don’t take passwords in consideration of course), for example I can:

  1. Retrieve user(db request) and store user details in a session.
  2. Just retrieve user id(db request) and store it in a session and fetch it to DAOs when needed. Is it safe to store user ids in sessions?
  3. Request-scoped. Not to store anything in session.(of course spring still stores security details in there) If User requested action – determine if authenticated(?+role), determine its id(db request), fetch it to DAOs. If user requests this action again steps will have to be repeated.

Assuming if my db tables always have int id as a primary key. Login name is just unique. And please don’t be confined to my 3 approaches, these are really simple examples, I am talking about data storing/persisting(please don’t associate ORM with this word in this context) which is combination of db requests and is used for DTO on server-side in web application.

What I think is that the more details I store in a session(or across requests), the easier for me to manage it plus less requests to database. If I keep these details in a form not identifying particular user, then there should be no problems? For example if I store “id = 5 ; fruit_id[]=1,4,7;(sorry if syntax is wrong) say in session”, it doesnt really sound identifying if security is breached?

  • 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-27T03:07:07+00:00Added an answer on May 27, 2026 at 3:07 am

    Your question is a bit vague and can only be properly answered in light of exact details. However in general it is fine to store user details, including user id, in the session. Probably a User object mirroring whatever fields/details you have in your db’s user table. It’s also OK to store authentication levels or roles. Of course you shouldn’t store too much data in the session.

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

Sidebar

Related Questions

I'm building a Web application with Java. Trying to integrate Spring Web MVC 3.0
i'm creating a very simple (hello World quality) web application using spring mvc 3.0.
Context: The Cloud We have a java-based web application that we normally host on
How can I catch a com.sun.faces.context.FacesFileNotFoundException in a Java EE web application? I tried
I'm trying to implement spring-security to handle authentication and authorization of my web application.
In the context of a web application, my old boss always said put a
Here is part of my web.xml: <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:application-config.xml </param-value> </context-param> application-config.xml uses
I'm building a java web media-scraping application for extracting content from a variety of
I am using jsf and spring together in web application. I have configured datasource
I am used to configuring web application in context.xml , including jdbc resorces, and

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.