[JBoss Portal] - Problems in doing JAAS login using code
by prassana
Hi all,
We have our portal users using windows NT clients. We want to do auto login to portal users (skip the login page). we have used jcifs NTLM filter. We are able to authenticate users with this arrangement. However we were not able to authorize the users.
So we wrote a filter that gets the username and makes a call to login function. we then set the user principal and subject to SecurityAssociation as shown below.
UsernamePasswordHandler handler = new UsernamePasswordHandler(httpRequest.getRemoteUser(), httpRequest.getRemoteUser().toCharArray());
LoginContext lgnctx;
try {
lgnctx = new LoginContext("portal", handler);
lgnctx.login();
System.out.println("Subject:" + lgnctx.getSubject().toString());
SecurityAssociation.setSubject(lgnctx.getSubject());
SecurityAssociation.setPrincipal(new UserPrincipal(httpRequest.getRemoteUser()));
SecurityAssociation.setCredential(httpRequest.getRemoteUser().toCharArray());
NOTE : we have user password same as user name in the database jbp_users table.
But when some portlets make call to check for "admin" role as in following code
req.isUserInRole(ADMIN_ROLE)
it fails even if the user logged in has admin role. This happens in a few portlets such as role management portlet.
We are not confident about the method we used to set the user subject and principal. Can any one suggest another method to set the user subject and principal?
Appreciate if any one suggests other methods for authorization.
my environment is as follws
JBoss Portal Version : jboss 2.6.1
Did you get Portal from CVS : yes
JBoss AS Version : JBoss AS 4.0.5
Database Vendor and Version : MS SQL server 2005
JDBC Connector : jdbc:jtds:sqlserver
OS Platform : Windows NT
thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4075173#4075173
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4075173
18Â years, 10Â months
[EJB/JBoss] - Java Compiler (JSR199) in EJB3
by Marco.Pehla
Hello everybody,
I need to compile generated Java source code inside of a enterprise application. I know that is possible to do these things in a ordinary JavaBean or backing bean of a JSF. But a much better solution would be to compile the Java code and return instances inside of a EJB3. I already migrated the JSR 199 compiler API of the Java 7 to libraries which can be used in Java 5 standalone applications. The JSR 199 Java Compiler API works pretty well and doesn't need access to the underlying file system. This is everything I need. But inside of a EJB3 deployed on JBoss 4.0.5 it doesn't work.
| JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
Normally compiler get an instance of the class JavaCompiler. But the object compiler is null.
Did anybody already implement a Java compiler as EJB3 ??? (Java version 5 would be enough.)
Any ideas for another solutions are very welcome.
Thank you in advance,
Marco
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4075163#4075163
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4075163
18Â years, 10Â months
[JBoss Messaging] - Re: ListAllMessages return no messages using RMI, but no pro
by hendra_netm
Hi Tim,
These are my code.
However, I can't reproduce the error.
It seems my computer was tired, and couldn't access the queue :o
Yesterday and today, my code worked well. So I think the problem lies on my side not on JBM.
Thank you very much for your attention.
Best Regards,
Hendra
| ic = new InitialContext();
| cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
| conn = cf.createConnection();
| Queue queue = (Queue)ic.lookup("/queue/A");
| Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
| MessageProducer prod = sess.createProducer(queue);
| Message mess = sess.createObjectMessage("Test Message");
|
| prod.send(mess);
|
| MBeanServerConnection mbeanServerConnection = (MBeanServerConnection)ic.lookup("jmx/invoker/RMIAdaptor");
| ObjectName objName = new ObjectName("jboss.messaging.destination:service=Queue,name=A");
| List list = (List)mbeanServerConnection.invoke(objName, "listAllMessages", new Object[]{}, new String[]{});
|
| for(java.util.Iterator iterator=list.iterator(); iterator.hasNext();)
| {
| Message msgInsideQueue = (Message)iterator.next();
| System.out.println("List message");
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4075162#4075162
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4075162
18Â years, 10Â months