-
1. Re: Jboss 7: where to store client user data ?
gerry.matte Sep 4, 2012 12:08 AM (in response to eurtn)You can try out the jdf GreeterQuickstart which uses CDI + JPA + EJB + JTA + JSF at http://www.jboss.org/jdf/quickstarts/jboss-as-quickstart/guide/GreeterQuickstart/
but I think the simplest and best documented quickstart that's relevant to your question is at https://docs.jboss.org/author/display/AS7/Login+quickstart
You will want to add your custom user data to the User.java bean. There is already a non standard property called userName that seems to be available throughout the webapp so I don't expect adding other properties would be a problem.
Oddly, the Login Quckstart is not included in the list of jdf quickstarts for jboss 7.
I find the quickstarts extremely helpful to quickly setup a working tested implementation of the technology I wish to try out. It does take a bit of mental effort and time to study the quickstart in enough detail to understand the critical settings and techniques.
-
2. Re: Jboss 7: where to store client user data ?
eurtn Sep 4, 2012 10:32 AM (in response to gerry.matte)Hi,
thanks for the quick answer, but unfortunatly my use case is different;
I explain it better.
We don't have a web application; we use JAAS and so we need to login a user (username, password, company name and locale) via login module (with a callbackhandler).
In our EJB we need to retrieve the informations about the user.
In Jboss 4 we implemented a custom Principal to do so, but in Jboss 7 the custom principal is
not propagated in the ejb context, so when we retrieve it we don't have our company name and locale anymore.
is there a best practice or another good way to implement this case ?
Any advice is welcome!
Thank You
-
3. Re: Re: Jboss 7: where to store client user data ?
henrikdeluxe Sep 24, 2013 12:18 PM (in response to eurtn)Same Problem here - what is the correct way to propagate an custom principal for jaas authentification?
In older Versions it was possible to propagate the principal on clienside as follows:
final MyAppPrincipal customPrincipal = new MyAppPrincipal("username", "myLocale"); // implements Principal final SecurityClient client = SecurityClientFactory.getSecurityClient(JBossSecurityClient.class); client.setVmwideAssociation(true); client.setSimple(customPrincipal, plainPassword); client.login();
Then in my LoginModule i could get this principal on serverside:
private MyAppPrincipal getClientPrincipal() { final SecurityAssociationCallback callback = new SecurityAssociationCallback(); final Callback[] callbacks = { callback }; try { callbackHandler.handle(callbacks); final Principal principal = callback.getPrincipal(); if(principal instanceof MyAppPrincipal) { return (MyAppPrincipal) principal; } } catch(final IOException e) { LOGGER.error("couldn't get custom principal", e); } catch(final UnsupportedCallbackException e) { LOGGER.error("couldn't get custom principal", e); } return null; }
With AS 7.2 i only get SimplePrincipal on serverside