[JBoss Seam] - Roles using LDAPLoginModule
by dennisrjohn
I have a jaas domain configured using the LDAPLoginModule for my seam app. I need to use the roles in LDAP for authorization in my seam app. The seam app uses the LDAP to log in, and in the trace log I can see the following:
2007-11-28 15:50:03,654 TRACE [org.jboss.security.auth.spi.LdapLoginModule] Assign user to role Development
However, if I use identity.hasRole("Development") in my seam app, it never evaluates to true. Are the roles not passed from the LDAPLoginModule to the seam identity component? If not, can I extend the LDAPLoginModule and somehow access the seam Identity component? I tried subclassing it and using Identity.instance() but that blew up.
Any help would be greatly appreciated.
-Dennis
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108710#4108710
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108710
18 years, 5 months
[JNDI/Naming/Network] - Re: Need to configure JNDI
by new_to_jboss_4
here's what i have a sample application to test the jboss jndi..
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.naming.InitialContext;
import javax.naming.Context;
import java.util.Hashtable;
import javax.sql.DataSource;
class test {
public static void main(String[] args) throws SQLException {
Connection con = null;
PreparedStatement stmt = null;
String query = "SELECT sysdate FROM DUAL";
try {
//con = Database.connectWeblogic();
con = connectJboss();
stmt = con.prepareStatement(query);
stmt.execute();
ResultSet rs = stmt.getResultSet();
while(rs.next()){
System.out.println(rs.getString(1));
}
}catch(SQLException e){
e.printStackTrace();
//System.err.println(e.getMessage());
throw new SQLException("Fault: Couldn't Fetch Fields");
}finally {
//Database.disconnect(con);
}
}
public static Connection connectJboss() throws SQLException {
Context ctx = null;
//Hashtable<String, String> ht = new Hashtable<String, String>();
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
ht.put(Context.PROVIDER_URL, "fb-linux1.corp.adobe.com:8080");
Connection con = null;
try {
ctx = new InitialContext(ht);
DataSource ds = (DataSource) ctx.lookup("WTSN");
con = ds.getConnection();
} catch (Exception e) {
e.printStackTrace();
// System.out.println (e.getMessage());
throw new SQLException("Database connection failed");
}
return con;
}
}
i get this error...
java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory not found in [file:/usr/share/java/libgcj-3.4.3.jar, file:./, core:/]
at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.5.0.0)
at _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
at javax.naming.spi.NamingManager.getInitialContext(java.util.Hashtable) (/usr/lib/libgcj.so.5.0.0)
at javax.naming.InitialContext.getDefaultInitCtx() (/usr/lib/libgcj.so.5.0.0)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at javax.naming.InitialContext.lookup(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at test.connectJboss() (Unknown Source)
at test.main(java.lang.String[]) (Unknown Source)
java.sql.SQLException: Database connection failed
at test.connectJboss() (Unknown Source)
at test.main(java.lang.String[]) (Unknown Source)
Exception in thread "main" java.sql.SQLException: Fault: Couldn't Fetch Fields
at test.main(java.lang.String[]) (Unknown Source)
-----------------
Pls advice how to rectify this!!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108704#4108704
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108704
18 years, 5 months
[EJB/JBoss] - Problems accessing remote EJB
by cypher073
So, I have 2 separate JBoss installations running on separate machines. One hosts an EJB application that exposes a remote interface for clients to access. The second is running an EJB client application that accesses the remote interface of the first. The client application contains a jar containing copies of the server classes it needs, referenced in the application.xml as an EJB module. In the client application, upon initialization, I'm setting the remote JNDI environment as follows:
System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url", "jnp://<ip_of_first_server>:1099");
System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
And then getting an InitialContext in the usual way. The problem is that the client never seems to try to access the server's remote interface, and always tries to look locally. No errors are thrown at all. Is there something obvious that I'm missing here? Any help would be greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108697#4108697
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108697
18 years, 5 months