[Security & JAAS/JBoss] - Secure EJBs and unsecure Servlets
by OrangeMetallicFrog
Hello again.
Having read through my last post, I realised it wasn't really very clear what I was doing/having a problem with. Hopefully now it isn't so early in the day I can be a bit clearer!
So, I have an EJB that I have secured. I can connect to this through my remote client. The remote client has a jndi.properties file that defines the various values for the principal, credentials, factory.initial, etc. This is working fine.
Then I've got a servlet that I'm using as a webservice. This takes a couple of parameters for the principal and credentials. This then calls
| Hashtable env = new Hashtable();
| env.put("java.naming.security.principal", principal);
| env.put("java.naming.security.credentials", credentials);
| nameCtxt = new InitialContext(env);
|
The nameCtxt returned is then used to perform a lookup of the secure EJB and that's when the problems start due to security.
I've dumped out the values of the context and they are
java.naming.factory.initial = org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkg = org.jboss.naming:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces (I'm not sure why these are repeated 3 times)
java.naming.security.principal = MyPrincipal
java.naming.security.credentials = MyCredentials
java.naming.security.protocol = mySecurity
The value for protocol is coming from my jndi.properties file that I've included in the ear file that this is all bundled up into as I thought that might have been the problem.
This is really starting to drive me crazy! I'm sure I must just be missing something simple, but I don't know what.
Help!
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4197686#4197686
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4197686
17 years, 6 months
[Installation, Configuration & DEPLOYMENT] - Re: JBoss 5 deployment issue
by venuwin
Please find my destinations-service.xml below :
| <?xml version="1.0" encoding="UTF-8"?>
|
| <!--
| Messaging Destinations deployment descriptor.
|
| $Id: destinations-service.xml 81998 2008-12-03 06:46:29Z scott.stark(a)jboss.org $
| -->
|
| <server>
|
| <!--
| The Default Dead Letter Queue. This destination is a dependency of an EJB MDB container.
| -->
|
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=DLQ"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| </mbean>
|
| <!--
| The Default Expiry Queue.
| -->
|
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=ExpiryQueue"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| </mbean>
|
| <!-- Added by chaitanya for 30SS project-->
|
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=TotalProcessQueue"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="JNDIName">queue/TotalProcessQueue</attribute>
| <attribute name="SecurityConfig">
| <security>
| <role name="guest" read="true" write="true"/>
| <role name="publisher" read="true" write="true" create="false"/>
| <role name="noacc" read="false" write="false" create="false"/>
| </security>
| </attribute>
|
| </mbean>
|
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=ProcessUnitQueue"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="JNDIName">queue/ProcessUnitQueue</attribute>
| <attribute name="SecurityConfig">
| <security>
| <role name="guest" read="true" write="true"/>
| <role name="publisher" read="true" write="true" create="false"/>
| <role name="noacc" read="false" write="false" create="false"/>
| </security>
| </attribute>
|
| </mbean>
|
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=ProcessStatusQueue"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="JNDIName">queue/ProcessStatusQueue</attribute>
| <attribute name="SecurityConfig">
| <security>
| <role name="guest" read="true" write="true"/>
| <role name="publisher" read="true" write="true" create="false"/>
| <role name="noacc" read="false" write="false" create="false"/>
| </security>
| </attribute>
| </mbean>
|
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=MetricsQueue"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="JNDIName">queue/MetricsQueue</attribute>
| <attribute name="SecurityConfig">
| <security>
| <role name="guest" read="true" write="true"/>
| <role name="publisher" read="true" write="true" create="false"/>
| <role name="noacc" read="false" write="false" create="false"/>
| </security>
| </attribute>
| </mbean>
|
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=RequestInfoQueue"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="JNDIName">queue/RequestInfoQueue</attribute>
| <attribute name="SecurityConfig">
| <security>
| <role name="guest" read="true" write="true"/>
| <role name="publisher" read="true" write="true" create="false"/>
| <role name="noacc" read="false" write="false" create="false"/>
| </security>
| </attribute>
|
| </mbean>
|
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=CartQueue"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="JNDIName">queue/CartQueue</attribute>
| <attribute name="SecurityConfig">
| <security>
| <role name="guest" read="true" write="true"/>
| <role name="publisher" read="true" write="true" create="false"/>
| <role name="noacc" read="false" write="false" create="false"/>
| </security>
| </attribute>
| </mbean>
|
| </server>
and my messaging-service.xml is :
| <?xml version="1.0" encoding="UTF-8"?>
|
| <!--
| The JBoss Messaging service deployment descriptor.
|
| $Id: messaging-service.xml 3880 2008-03-14 15:55:42Z timfox $
| -->
|
| <server>
|
| <!-- ServerPeer MBean configuration
| ============================== -->
| <mbean code="org.jboss.jms.server.security.SecurityMetadataStore"
| name="jboss.messaging:service=SecurityStore">
|
| <attribute name="DefaultSecurityConfig">
| <security>
| <role name="guest" read="true" write="true" create="true"/>
| </security>
| </attribute>
|
| <attribute name="SecurityDomain">java:/jaas/messaging</attribute>
|
| <attribute name="SuckerPassword">CHANGE ME!!</attribute>
| </mbean>
|
| <mbean code="org.jboss.jms.server.ServerPeer"
| name="jboss.messaging:service=ServerPeer"
| xmbean-dd="xmdesc/ServerPeer-xmbean.xml">
|
| <!-- The unique id of the server peer - in a cluster each node MUST have a unique value - must be an integer -->
|
| <attribute name="ServerPeerID">${jboss.messaging.ServerPeerID:0}</attribute>
|
| <!-- The default JNDI context to use for queues when they are deployed without specifying one -->
|
| <attribute name="DefaultQueueJNDIContext">/queue</attribute>
|
| <!-- The default JNDI context to use for topics when they are deployed without specifying one -->
|
| <attribute name="DefaultTopicJNDIContext">/topic</attribute>
|
| <attribute name="PostOffice">jboss.messaging:service=PostOffice</attribute>
|
| <!-- The default Dead Letter Queue (DLQ) to use for destinations.
| This can be overridden on a per destinatin basis -->
|
| <attribute name="DefaultDLQ">jboss.messaging.destination:service=Queue,name=DLQ</attribute>
|
| <!-- The default maximum number of times to attempt delivery of a message before sending to the DLQ (if configured).
| This can be overridden on a per destinatin basis -->
|
| <attribute name="DefaultMaxDeliveryAttempts">10</attribute>
|
| <!-- The default Expiry Queue to use for destinations. This can be overridden on a per destinatin basis -->
|
| <attribute name="DefaultExpiryQueue">jboss.messaging.destination:service=Queue,name=ExpiryQueue</attribute>
|
| <!-- The default redelivery delay to impose. This can be overridden on a per destination basis -->
|
| <attribute name="DefaultRedeliveryDelay">0</attribute>
|
| <!-- The periodicity of the message counter manager enquiring on queues for statistics -->
|
| <attribute name="MessageCounterSamplePeriod">5000</attribute>
|
| <!-- The maximum amount of time for a client to wait for failover to start on the server side after
| it has detected failure -->
|
| <attribute name="FailoverStartTimeout">60000</attribute>
|
| <!-- The maximum amount of time for a client to wait for failover to complete on the server side after
| it has detected failure -->
|
| <attribute name="FailoverCompleteTimeout">300000</attribute>
|
| <attribute name="StrictTck">false</attribute>
|
| <!-- The maximum number of days results to maintain in the message counter history -->
|
| <attribute name="DefaultMessageCounterHistoryDayLimit">-1</attribute>
|
| <!-- The name of the connection factory to use for creating connections between nodes to pull messages -->
|
| <attribute name="ClusterPullConnectionFactoryName">jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory</attribute>
|
| <!-- When redistributing messages in the cluster. Do we need to preserve the order of messages received
| by a particular consumer from a particular producer? -->
|
| <attribute name="DefaultPreserveOrdering">false</attribute>
|
| <!-- Max. time to hold previously delivered messages back waiting for clients to reconnect after failover -->
|
| <attribute name="RecoverDeliveriesTimeout">300000</attribute>
|
| <!-- Set to true to enable message counters that can be viewed via JMX -->
|
| <attribute name="EnableMessageCounters">false</attribute>
|
| <!-- The password used by the message sucker connections to create connections.
| THIS SHOULD ALWAYS BE CHANGED AT INSTALL TIME TO SECURE SYSTEM
| <attribute name="SuckerPassword">CHANGE ME!!</attribute>-->
|
|
| <!-- The name of the server aspects configuration resource
| <attribute name="ServerAopConfig">aop/jboss-aop-messaging-server.xml</attribute>
| -->
| <!-- The name of the client aspects configuration resource
| <attribute name="ClientAopConfig">aop/jboss-aop-messaging-client.xml</attribute>
| -->
|
| <depends optional-attribute-name="PersistenceManager">jboss.messaging:service=PersistenceManager</depends>
|
| <depends optional-attribute-name="JMSUserManager">jboss.messaging:service=JMSUserManager</depends>
|
| <depends>jboss.messaging:service=Connector,transport=bisocket</depends>
| <depends optional-attribute-name="SecurityStore"
| proxy-type="org.jboss.jms.server.SecurityStore">jboss.messaging:service=SecurityStore</depends>
| </mbean>
|
| </server>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4197676#4197676
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4197676
17 years, 6 months
[Installation, Configuration & DEPLOYMENT] - Re: JBoss 5 deployment issue
by venuwin
Hi,
That has been fixed. Now my error is this :
| 2008-12-19 21:08:01,862 WARN [org.jboss.resource.adapter.jms.inflow.JmsActivation] (WorkManager(2)-2) Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@1899788(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter(a)1f0c437 destination=queue/CartQueue destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5)
| javax.naming.NameNotFoundException: queue not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:673)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at org.jboss.util.naming.Util.lookup(Util.java:222)
| at org.jboss.resource.adapter.jms.inflow.dlq.AbstractDLQHandler.setupDLQDestination(AbstractDLQHandler.java:106)
| at org.jboss.resource.adapter.jms.inflow.dlq.AbstractDLQHandler.setup(AbstractDLQHandler.java:82)
| at org.jboss.resource.adapter.jms.inflow.dlq.JBossMQDLQHandler.setup(JBossMQDLQHandler.java:48)
| at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDLQ(JmsActivation.java:413)
| at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:351)
| at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:729)
| at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
| at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
| at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
| at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
| at java.lang.Thread.run(Thread.java:595)
Going nuts with Jboss5. This kind of tedious setup would not help anyone. When the whole world speaks about backward compatibility, forcing people to undergo such a pain is undue.
With folks like jaikiran, yes, we can live with it. Jaikiran helps all of us a lot.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4197675#4197675
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4197675
17 years, 6 months