aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Security Management fails... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Security Management fails..." Watch "Security Management fails..." New topic
Author

Security Management fails...

Manish S Malhotra
Ranch Hand

Joined: Jan 19, 2007
Posts: 61
Hi All,
I'm using EJB2.0 with WSAD 5.0.

I'm having a simple EJB deployed on the WSAD's test Server.
This EJB logs the message given by the client EJB.

Following is its Deployment Descriptor, which is having one role and method permission.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
<display-name>SCEA_Preperation</display-name>
<enterprise-beans>
<session id="SCEASLSessionBean">
<ejb-name>SCEASLSessionBean</ejb-name>
<home>com.scea.test.ejb.sls.SCEASLSessionBeanHome</home>
<remote>com.scea.test.ejb.sls.SCEASLSessionBean</remote>
<ejb-class>com.scea.test.ejb.sls.SCEASLSessionBeanBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<security-role>
<description></description>
<role-name>Administrator</role-name>
</security-role>
<method-permission>
<role-name>Administrator</role-name>
<method>
<ejb-name>SCEASLSessionBean</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>SCEASLSessionBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>


This is the client from which I'm calling this Bean.

public class StatelessBeanClient
{
public static void main(String[] args)
{
SCEASLSessionBeanHome home = null;
SCEASLSessionBean bean = null;
try {
Properties prop = new Properties();
//prop.put(Context.SECURITY_PRINCIPAL, "manager2");
//prop.put(Context.SECURITY_CREDENTIALS, "manager2");
prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
prop.put(Context.PROVIDER_URL, "iiop://10.74.64.85:2809");
InitialContext context = new InitialContext(prop);
Object object =context.lookup("ejb/com/scea/test/ejb/sls/SCEASLSessionBeanHome");
home = (SCEASLSessionBeanHome) PortableRemoteObject.narrow(object, SCEASLSessionBeanHome.class);

bean = home.create();
bean.logMessage("Hello from Test Client....");
System.out.println("Done....");
} catch (NamingException e) {
System.out.print("NamingException");
e.printStackTrace();
}
catch (RemoteException e) {
System.out.print("RemoteException");
e.printStackTrace();
}
catch (CreateException e) {
System.out.print("CreateException");
e.printStackTrace();
}
finally
{
try {
if (bean != null)
{
bean.remove();
}
} catch (RemoteException e) {
} catch (RemoveException e) {
}
}
}

}

------
Issue is irrespective of the PRINCIPAL I'm passing or not passing I'm able to access the method Bean.
Ideally it should container should throw SecuritException.

Please correct me If I'm wrong or I have to do some more configuration in the deployment descrp. for enabling the security.

And I have one more small issue, As I start the Test Server I can the output of the Sysouts on the console but when I run any other Java Application the existing server console overwritten with the new Sysouts of the Java Application. And I'm not able to see the Server side Sysouts.

So, can any body please give me direction to solve the above two issues.

Thanks for your help!

Regards,
Manish


"Abstraction is the key thing while designing"
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Have you enabled Global Secuiry in WAS? If remember right you have to tell the server whether any security is used at all.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Manish S Malhotra
Ranch Hand

Joined: Jan 19, 2007
Posts: 61
Hi Paul,
Thanks for your valuable time.
I'm using WSAD5.0. Its having embedded WAS Test Server.
I'm not able to find any page where I can enable the Global Security for the Server.
On the security tab there are only options to enable "Enable Security" which is asking for Local OS Authentication and second is Enforce Java 2 Security.

But both are not what we have discussed I think.

Can you please guide how to enable that security in WSAD's Test Server?

Thanks,
Manish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Security Management fails...