Dave,

I think Steve was actually using the information in the properties for 
authentication, not post-authentication. Correct me if I'm wrong. The 
general case would be:

<username/principalname, authprop1, authprop2, authprop3> = true/false 
authentication

for example, <username, organization, password> should be sufficient in 
Steve's case (again, correct me if I'm wrong). This would allow you to have 
the same username show up in different organizations. It could be argued 
that you could shoe-horn this into the current auth scheme by making the 
username="organization\username" and parsing it in your login module, but 
that does not work very well in the generic case, and it assumes that "\" 
is not in the domain of organization names nor user names. You could also 
go with the LDAP "o=org, cn=name" format.

for another example, I may do authentication, not by username/pass, but by 
a quizzing system asking you three (random) questions. Your credentials, 
then, consist of your username/id and your answers, and the login module 
could go to an LDAP directory or JDBC source to determine if the answers 
are correct. This is not difficult to do with form-based login (from web 
containers) or from X.509 information (this sort of slips through the 
cracks in JBoss/Catalina?); it's just propagating this through the JBoss 
infrastructure that's not trivial, since it's all geared to assume username 
and password. It would be nice to send a username and a map (protected, of 
course, if you're using Java 2 security), which would hold a bag of (named) 
credentials to be used by a login module to answer auth questions.

You could do this with something like this, in JBoss 2.4/Tomcat 3.2:

JBossSecurityMgrRealm.authenticate() currently calls 
org.apache.util.SecurityTools.credentials(request, credentialMap) to 
populate a Map from an incoming request. Instead, .authenticate could 
traverse the incoming request itself and grab all incoming Parameters and 
context Attributes, and populate them into the credentialMap (what do you 
do with overlapping keys?), which it would then wrap into a 
MapCallbackHandler and also stick into the SecurityAssociation (which takes 
Object. probably should be deep copied in and out?). EJBSecurityManager 
then would have to be extended to have an isValid(principal, 
callbackHandler) to answer authentication; it would pass that callback 
handler straight into the LoginContext() constructor. The 
MapCallbackHandler would then traverse the incoming callbacks, and use 
their prompt or other callback attribute as a key into the initial map (to 
get information from the Map).

I don't think it's this easy in the Catalina code, since Apache/Tomcat seem 
to have digested the request before the JBoss interceptor gets it, and you 
only get to authenticate on an X.509 array, a string, or byte[] (see 
interface org.catalina.Realm). I guess you could serialize the Map and get 
it through the byte[] way.

I don't know how you'd do this in Jetty.

One problem with this approach is that if you pass a Map around the place, 
you have to be careful that receivers don't change it; it's easy for 
receiver code to add/delete/modify entries, unless again you use Java 2 
security. Serialize/deserialize may help. Maybe serialize the 
callbackHandler instead? Is there such a thing as an ImmutableMap object, 
kind of like javax.security.auth.Subject works after you call setReadOnly()?

Ugh. This is long and may have huge holes. This is all off the top of my 
head, with only quick reads of the code, so don't flame me, please.


At 07:53 AM 10/31/2001, Dave Smith wrote:
--- Begin Original Message ---
>I'm assuming the properties based Principle would allow you to call
>sessionContext.getCallerPrincipal() and then retreive certain properties 
>like companyId, branchId etc .... If you wanted to get this stuff out 
>of  the Database would you just not have to extend
>DatabaseServerLoginModule and instead of creating a SimplePrincipal have a 
>PropertiesPrincipal with an addional method getProperty? There would be no 
>need for an addional Callback because you are still only getting login and 
>password. OverSimplification?
>
>
>Steve Salkin wrote:
>
>>Hi-
>>After posting here to see if there was interest in a generic version of 
>>LoginModule similar to the UsernamePasswordLoginModule, but which 
>>supported a third passed-in attribute "Organization" for ASP models, I 
>>had an interesting dialog with JAAS expert Scott Stark. Since our 
>>conversation seems to have petered out, I'd like to make some elements 
>>part of the public record so they don't get forgotten, and will be 
>>accessable to people coming along later who are a situation similar to 
>>mine. Scott, I hope you don't mind my quoting some of your technical 
>>remarks rather than rephrasing them just to avoid this.
>>After a brief confusion at the outset, Scott realized that I was trying 
>>to ask the user for two separate pieces of information to uniquely 
>>identify them. I explained that I was planning to add another 
>>CallbackHandler and another Principal implementation to facilitate this. 
>>He said:
>>   "Ok, I see the issue. However, when a login module is executed on the
>>   server in response to either an attempt to access an ejb or a servlet, 
>> there
>>   is no callback handler to which the request can be delegated. An
>>   extension to the current security manager would have to be made to
>>   allow one to configure a callback handler for a security domain.
>>   Also, the next logical step would be to have a properties based principal
>>   and callback object that allowed one to associate any number of
>>   attributes with a principal. The ASP use case is one that just uses a
>>   single "organization" property. Adding this as well as externalizing the
>>   callback handler for a security domain makes sense to me."
>>As I said to him, this is more work than I probably have time to do right 
>>now, given the other deadlines I am facing, and it seems unlikely to me 
>>that this would be a good first project for a new jboss developer even if 
>>I did.
>>Perhaps I will be able to contribute to the project in some way at a 
>>later time. In any event, since I am writing here I'd like to thank each 
>>of you for the amazing work that has gone into jboss, which I have 
>>followed for some time. May it bring you all fame and fortune.
>>S-
>>
>>_______________________________________________
>>Jboss-development mailing list
>>[EMAIL PROTECTED]
>>https://lists.sourceforge.net/lists/listinfo/jboss-development
>
>
>
>_______________________________________________
>Jboss-development mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/jboss-development
--- End Original Message --- 


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to