Yes, well, this is certainly a case of the blind leading the blind. Maybe someone
with some actual production experience could jump in???
I do think I have one answer: the web.xml file only defines "roles" for the app,
meaning, I take it, types of users that are meaningful in the context of the the
specific app (sort of like actors in a use-case diagram . . ?)
The architecture seems to provide that the "permanent" characteristics of the users
are maintained elsewhere (property files, databases, directories . . .) These
would be "users" (maybe stored as DNs or UIDs in a directory, with passwords or
public keys also in the user's entry), "groups" (like "Accounting" or "managers" or
maybe "gold-card holders" or "people with SECRET clearances", etc., perhaps stored
in a groupofuniquenames attribute) and maybe "roles" (no idea what standard
X.500-type attribute might be used.) Again, someone jump in who has actually
implemented this . . .
Anyhow, I think there's no bar to storing the directory-type info in directories or
databases, if you can find or build an appropriate authenticator class to plug in.
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
> >>
> >>
> >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
>
> Thanks for the reply.
>
> Now i have another question related to all this. I have a number of users
> in a database(sql) with username, password and group and I want to grant
> those people access depending on what group they belong to. So, instead of
> using the web.xml I want to get my users and admins from that database. How
> do I do this the best way? It would be extremly nice if anyone had an
> example application or something that uses this kind of authorization.
>
> Sorry if my questions are basic or so...but I can't seem to find the proper
> way of fixing this by myself, and once again I'm very greatfull for any
> 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