J2EE servers provide a "security service" to protect EJB's and also access to "Web
components" like html and jsp pages. See the J2EE Developer's Guide at
java.sun.com.
For Web apps the container sees if security has been configured in the web.xml
file; if so, all calls to components of that app are intercepted and checked
against the security configuration. You define what components are protected, the
type of login authentication desired (eg, BASIC, FORM, DIGEST, CERT -- not all
supported by all appservers) and what "roles" (eg, "admin" or "allusers") are
allowed access. The container then uses whatever auth type is specified, and
validates the credentials (password or whatever) against some auth source. Once
the user is logged in, the J2EE server limits access to pages, etc. based on the
web.xml config; I understand the programmer has access to a logged-in user's auth
status for customized work within a page (like deciding who gets to see the "Shut
Down" button on a JSP page. )
Low-end servers I've seen, and the Sun examples, just maintain user, password and
group info (i.e., directory info) in property files. In principle, however, any
source can be used for auth (and access rights) by extending the authentication
classes (and configuring the appserver to use yours.) For example, you could use
the JNDI API against an LDAP directory server for this info.
The specific security concepts (subjects, principals, PAM, etc) are documented in
the Sun JAAS API.
HTH,
martin
"Mikael Andr�asson" wrote:
> What is the best way to set an access for a site developed in java? Right
> now I post the name and password to a servlet who set a flag(depending on
> what access the person should have) in the users session...is that the
> "right" way to do it?
>
> Thankful for reply!
>
> /Mikael Andr�asson
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets