• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Security Management fails...

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you enabled Global Secuiry in WAS? If remember right you have to tell the server whether any security is used at all.
 
Manish S Malhotra
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic