[Security & JAAS/JBoss] - Passing username/password from LoginModule to jdbc driver
by jplessinger
I hope this is the appropriate location, if not I apologies in advance.
I have this some what unique requirement that when a user logs into my website the username/password needs to be used for the database connection as well. The app is based on EJB3.0 and JPA.
Currently I have a LoginModule which authenticates the user against a windows domain and then adds the ManagedConnectionFactory for the database, username and password into a PasswordCredential. This is added to the private credentials of the subject.
If you're still following at a latter point in time when the JBoss server will read the username and password out of the subject and provide them to the JDBC driver.
This almost works, but only for the first user, any users after that it uses the previous connection properties. Which I almost suspect would happen.
So the question: Am I going down the right path. Can I change the username/password of the jdbc connection for each user this way.
I will also take suggests on how to accomplish this any other way. My Fear is I will not be able to use EJB and have to create an EntityManagerFactory every time a user logs into the application.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227352#4227352
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227352
16 years, 12 months
[JBoss Messaging] - JBoss 5.0.1, how to create new topic
by maxogm
Hello...
I need to create new topic in Jboss 5.0.1 from java applications. Did someone know how to do this.
In Jboss 4.0.1sp1 I do this using next method in Java:
| private void createTopic(String topicName) throws NamingException, InstanceNotFoundException, MBeanException, ReflectionException, IOException {
| Properties props = new Properties();
| props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
|
| InitialContext iniCtx = new InitialContext(props);
|
| try{
| iniCtx.lookup("topic/" + topicName + "");
| }catch (NameNotFoundException e) {
| ObjectName destinationManager = ObjectNameFactory.create("jboss.mq:service=DestinationManager");
| RMIAdaptor server = null;
| server = (RMIAdaptor) iniCtx.lookup("jmx/invoker/RMIAdaptor");
| server.invoke(destinationManager, "createTopic", new Object[] { topicName, "topic/" + topicName }, new String[] {
| String.class.getName(), String.class.getName() });
| }
| }
|
|
I try to modificate previous code to work with Jboss 5.0.1GA, but I not success. Sorry on very bad English.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227329#4227329
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227329
16 years, 12 months
[Beginners Corner] - Re: trouble with greeter example...
by Meghiddo
sorry for multiple replies, I am not seeing a way to edit a post..
I still cant figure this out at all. Im guessing the problem lies in how I added the richfaces library? I dont know.
When I made the project (with eclipse) I got to the third page askin what implementation to use. I chose mojarra which is what I have always used. Then in the component libraries section I added a new one and named it RichFaces.
Should richfaces be a jsf impelmentation like mojarra is? I dot think this is right, RichFaces is just a component library right? I keep trying different combinations though with and without richfaces being a jsf implementation but I am having no luck. STill he same problems every time.
What could be wrong here??
My projects that do not use richfaces work just fine, I can open them on localhost just like always.
Itried addig the code to one of my applications that already does work. WHen I try to open it in my browser here is the first error in the stack:
org.apache.jasper.JasperException: The absolute uri: http://richfaces.org/a4j cannot be resolved in either web.xml or the jar files deployed with this application
I know it must be something I did when first creating the project, I am new to adding libraries.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227327#4227327
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227327
16 years, 12 months
[EJB 3.0] - In too deep: JBOSS + JAAS + AJAX
by bacooper81
I'm pretty new to EJB and JBOSS, but I really want to take advantage of all the functionality they provide, including authentication. So I'm building a web app with JAAS, JBOSS and AJAX, and I got it to authenticate a user. The problem is, after it does it forwards the browser to the URL the original request was made to. This is a problem because the original request was an AJAX call to the server, and is only supposed to refresh part of the page. Now its grabbing that little bit of data and showing it on a completely new page. I'm not really sure what to do here. Is there some way I can control what happens after authentication is complete? Or is there a better solution?
Thanks in advance for any help.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227325#4227325
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227325
16 years, 12 months