[Security] - Use EJB inside a LoginModule, repeated calls to login()
by Thomas.Woelfl
We try to access a EJB stateless service inside a custom LoginModule. The problem is that the login() method is called again and again when the the EJB stateless service is accessed.
| public class DatabaseServerLoginModuleTm3 extends DatabaseServerLoginModule
| {
| @Override
| public boolean login() throws LoginException
| {
| try {
| boolean successLogin = super.login();
| return successLogin;
| }
| catch ( LoginException e ) {
| increaseFailedLogins();
| throw e;
| }
| }
|
| private void increaseFailedLogins()
| {
| if ( this.getClaimedUsername() == null ) {
| return;
| }
| InitialContext ctx = new InitialContext();
| return (PersonServiceLocal) ctx.lookup( "PersonServiceBean/local" );
|
| PersonServiceLocal personService = lookupContactService();
| Person person = personService.getPersonByUsername( this.getClaimedUsername() );
|
| personService.increaseFailedLoginsForPerson( person );
| }
| }
|
In jboss.xml we defined the security domain "TM3-security" for all beans:
| <jboss>
| <security-domain>java:/jaas/TM3-security</security-domain>
| <unauthenticated-principal>guest</unauthenticated-principal>
| </jboss>
|
In login-config.xml the used login-modules are defined:
| <application-policy name = "TM3-security">
| <authentication>
| <login-module code = "org.jboss.security.auth.spi.RunAsLoginModule" flag = "required">
| <module-option name="roleName">LoginModuleUser</module-option>
| </login-module>
|
| <login-module code = "com.tm3.erp.core.business.DatabaseServerLoginModuleTm3" flag = "required">
| <module-option name = "unauthenticatedIdentity">guest</module-option>
| <module-option name = "dsJndiName">java:/PostgresDS</module-option>
| <module-option name = "ignorePasswordCase">false</module-option>
| <module-option name = "principalsQuery">xy</module-option>
| <module-option name = "rolesQuery">xy</module-option>
| </login-module>
|
| <login-module code="org.jboss.security.ClientLoginModule" flag="required">
| <module-option name="multi-threaded">true</module-option>
| <module-option name="restore-login-identity">true</module-option>
| </login-module>
| </authentication>
| </application-policy>
|
We tried to moved the called EJB (PersonService) to a different Security Domain using the annotions:
a) @org.jboss.ejb3.annotation.SecurityDomain("java:/jaas/other")
b) @org.jboss.security.annotation.SecurityDomain ("java:/jaas/other")
No success. Any ideas? Thank you.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269747#4269747
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269747
16 years, 4 months
[jBPM Users] - Re: Entity variable
by juanignaciosl
Neat. As I read at the documentation it's likely that I should be able to save as an Hibernate entity, but Serializable is good enough for the time being.
Nevertheless, when I make it Serializable it gets stored but it can't be loaded, taskService.getVariables throws the following exception:
| org.jbpm.api.JbpmException: couldn't deserialize object
| (...)
| org.jbpm.api.JbpmException: couldn't deserialize object
| Caused by: java.lang.ClassNotFoundException
|
I'm trying to deploy the .class file inside a .bar or .jar together with the jpdl and deploying it with createDeployment() .addResourcesFromZipInputStream(zip), but the class won't get deployed.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269744#4269744
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269744
16 years, 4 months
[JBoss Messaging Users] - standalone consumer for clustered queue did not get all mess
by arminhaaf
we are currently migrating from JBoss AS 4.2.2 with MQ to a clustered JBoss AS 5.1 with messaging
We have some standalone JMS consumers to connect external systems.
The problem is that a standalone JMS consumer connects to only one node and so gets the messages from this node only.
The queue is Clustered:
<mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=TestClusteredQueue"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends>jboss.messaging:service=PostOffice</depends>
| <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
| <attribute name="Clustered">true</attribute>
| </mbean>
|
A sample external consumer
| public static void main(String[] args) throws Exception {
| System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
| System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
| System.setProperty("java.naming.provider.url", "node1:1100,node2:1100");
|
|
| final InitialContext tInitialContext = new InitialContext();
| final ConnectionFactory tConnFactory = (ConnectionFactory) tInitialContext.lookup("ClusteredConnectionFactory");
| final Queue tLisaToMfcQueue = (Queue) tInitialContext.lookup("/queue/TestClusteredQueue");
|
| javax.jms.Connection jmsConnection = tConnFactory.createConnection();
|
| Session tSession = jmsConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
|
| System.out.println("from browser");
| Enumeration tMessages = tSession.createBrowser(tLisaToMfcQueue).getEnumeration();
| while (tMessages.hasMoreElements()) {
| Message tMessage = (Message) tMessages.nextElement();
| System.out.println(tMessage);
| }
|
| System.out.println("from consumer");
|
| final MessageConsumer tConsumer = tSession.createConsumer(tLisaToMfcQueue);
|
| tConsumer.setMessageListener(new MessageListener() {
| public void onMessage(final Message pMessage) {
| System.out.println(pMessage);
| try {
| pMessage.acknowledge();
| } catch (JMSException e) {
| e.printStackTrace();
| }
| }
| });
|
| jmsConnection.setExceptionListener(new ExceptionListener() {
|
| public void onException(final JMSException e) {
| System.out.println("got exception");
| }
| });
|
| jmsConnection.start();
|
| }
|
So how can i get a standalone consumer getting all messages from the queue
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269737#4269737
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269737
16 years, 4 months
[Spring Integration] - Re: JBoss-Spring-ActiveMQ integration issue
by katoch
--------------------------------------------------------------------------------
I am using Spring2.5.5, ActiveMQ5.3, JBoss 5.1.
I am using 10 concurrent cousumers in DefaultMessageListenerContainer
<bean id="listenerContainer" class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
| <property name="connectionFactory" ref="MyCF" />
| <property name="destination" ref="MyPostQueue" />
| <property name="messageListener" ref="MyPojo" />
| <property name="sessionTransacted" value="true"/>
| <property name="concurrentConsumers" value="10"/>
| <property name="cacheLevelName" value="CACHE_CONSUMER" />
| </bean>
I have tried with "cacheLevelName" property with None,Session,Connection
The problem is that only one consumer gets invoked. I have tested it.
Can somebody help me? I want
1. if 10 messages (huge) come to my queue, the all the 10 consumers get invoked and complete the process
2. how can I increase this number as my number of messages consumers increase ,since in ActiveMQ console I am just seeing fixed number of consumers. i.e. how to pool ?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269720#4269720
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269720
16 years, 4 months