This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to implementing good security in Servlet?

 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,,

how to implementing good security, example for authentication in Servlet?..
Assume that i have application which has Create, Read, Update, and Delete method..
Admin could accessed all methods..
but Employee just could read the data..
How to good implementing that requirements?..
Do i have to provides 2 Servlet with 2 forms?..
or could i have one servlet with one form?..

i interested Spring Security which has Method security implements..
could i do like Spring Security in Servlet?..
i uses JBoss 5.1 + JSP + Servlet + EJB3..

please give me any suggestion..
Thanks in advance ..
 
ujjwal soni
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can also use ACEGI security framework for spring framework Its available at

http://www.acegisecurity.org/
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest would be to use the authentication/authorization framework that's built into the Servlet API. It implements a username/password/role scheme that makes authentication information available through the HttpServletRequest's getRemoteUser and isUserInRole methods.
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies..


How to set username/password/role scheme in HttpServletRequest?..
assume that i have login application..
the users who wants to login to my application must filled the Login (username, and password)..
and the users who can login to my application is admin and employers?..
how to set that user's role (either admin/employee) to HttpServletRequest?..

Would you like to give me an example?..

Thanks in advance..
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some of the details are specific to your servlet container, while some others are generic for all web apps. See http://faq.javaranch.com/java/ServletsFaq#security for further information.
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Ulf Dittmer

Thanks sir..

i uses JBoss 5.0..
Okay.. Firstly i'll try it in Tomcat6.. then i'll implement it in JBoss..
Hope it will run well..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic