[jboss-user] [JBoss Portal] - [org.jboss.portal.security.PortalPermissionCollection] Permi
) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.core.aspects.portlet.AjaxInterceptor.invoke(AjaxInterceptor.java:51) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.aspects.portlet.ModesInterceptor.invoke(ModesInterceptor.java:62) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.bridge.BridgeInterceptor.invoke(BridgeInterceptor.java:47) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.aspects.portlet.WindowStatesInterceptor.invoke(WindowStatesInterceptor.java:55) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.aspects.portlet.PortletSessionSynchronizationInterceptor.invoke(PortletSessionSynchronizationInterceptor.java:80) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.aspects.portlet.ContextTrackerInterceptor.invoke(ContextTrackerInterceptor.java:46) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor$1.doCallback(ContextDispatcherInterceptor.java:104) | at org.jboss.portal.web.command.CommandDispatcher$CallbackCommand.execute(CommandDispatcher.java:74) | at sun.reflect.GeneratedMethodAccessor413.invoke(Unknown Source) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) | at java.lang.reflect.Method.invoke(Unknown Source) I have seen a lot of posts with this problem but no suggested solution. My portlet and all its siblings have viewrecursive permissions. What does this exception really imply ? Which repository is it not able to access ? Please help if anyone has any leads on this. sbiwal View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4168608#4168608 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4168608 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: problem with IPC
I think your portlet events for Portlet A and B are not bound to the listener. The reason you are getting messages from the doView in portlet B is because. it is probably added on the same page as portlet A. So as soon as you submit portlet A, the entire page is rendered again and hence calling the doView in portletB. Please see one of my previous posts regarding how you can login as admin and check what listeners are bound to your portlet windows. Also you are suppose to deploy the .sar file View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4162418#4162418 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4162418 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: problem with IPC
Hi Dileep, You said when you're trying to submit, you get an error message - 1) What are you trying to submit ? 2) What is the error message ? sbiwal View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4162213#4162213 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4162213 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: problem with IPC
Hi, There is one more way to check that your portlets events are bound to any listeners. Login as admin to your portal. Go to the admin link Browse through your portal/pages to get to the portletA and portletB. Now on the portlet window go to the Properties link. You should have the event listening binding mentioned on this page. Check if this is as your required. My guess is that your portlet events are not bound to any listeners. You can set your listeners from this admin link and also from the portlet descriptors. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4161378#4161378 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4161378 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: Sharing session attribute between servelt and portlet
Thanks. I had started using the APPLICATION_SCOPE and it worked. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4158875#4158875 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4158875 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: problem with IPC
Hi Ruchika, There are three things important deployment descriptors for a portlet in JBoss - 1) portlet.xml - this file relates a portlet name to a portlet class 2) portlet-instances.xml - this file relates the portlet name defined above to a portlet instance. Now the same portlet can have more than one instances. 3) -object.xml - usually replace the part with the name of your portlet. This file defines a window (which is the actual view that you see in your portal) to a portlet instance. Once again the same portlet instance can be rendered using multiple windows eg you have your portlet instance in 2 or pages. The event listeners are bound to these windows. So when you declare this window (in your *-object.xml file), you should list the listener with it. Only this window of the portlet will listen to events (with the listener id specified by you) and not the other windows for the same portlet. I am pasting an example of the *-object.xml file here - | ?xml version=1.0 encoding=UTF-8? | deployments | deployment | parent-refmyPortal/parent-ref | if-existsoverwrite/if-exists | page | page-nameMyPage/page-name | window | window-name | MyPortletWindow1 | /window-name | instance-ref | MyPortletInstance | /instance-ref | listeneripc_listener/listener | regioncenter/region | height1/height | /window | window | window-name | MyPortletWindow2 | /window-name | instance-ref | MyPortletInstance | /instance-ref | regionleft/region | height1/height | /window | /page | /deployment | /deployments In the above file, note the following things - 1) You should have a portal with the name MyPortal. 2) Now a new page will be created in this portal - MyPage 3) The first window in this page - MyPortletWindow1 uses the instance MyPortletInstance and throws events with listener id ipc_listener. Whatever is your listener class associated with this listener id, will honor such events. 4) The second window in this page - MyPortletWindow2 uses the same portlet instance MyPortletInstance but does not throw events with the listener id ipc_listener 5) Now just specify your listener class in the jboss-service.xml descriptor (as specified in the reference guide) and you'll be done. Please do not hesitate to ask me any more doubts. I struggled with this for a long time myself and would like it if my digging could help anyone. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4152555#4152555 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4152555 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: problem with IPC
Hi Ruchika, Yes I was able to solve this problem. Firstly you must create a processAction method for your portletA (or the calling portlet). This is because we are generating an action event from the submit form of portletA. Secondly listeners are registered for a portlet window and not the portlet instance. So listeners must be specified during the window deployment ie during the deployment of the -object.xml file. Please let me know the exact problem you are facing and I will try to help you through it. IPC is working as intended for me. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4152523#4152523 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4152523 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - multi-threading inside JBoss Portlet
Hi, I have the following situation - * User takes an action on a portlet and the portlet starts a new thread which handles the action (apparently the action which is copying some files may take long and thats why I fork it in a new thread). * If in the meantime, the user starts the (copy) action again, the previous thread should be interrupted and the new copy should be honored. All of this works fine as long as I do not refresh the view of my portlet ie the isInterrupted flag is set on any previous thread and when this thread checks for isInterrupted(), it finds itself interrupted and I can exit gracefully. But if I have a situation where the user interrupts a previous copy action (lets say Thread1), and then refreshes the portlet (anything that called doView), then the isInterrupted flag on Thread1 is cleared and it still proceeds. Does doView of a portlet causes thread interrupts to be cleared ? Am I doing something wrong ? I had searched the forums enough, but did not find anyone doing something similar to this. Any help would be appreciated. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4151669#4151669 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4151669 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - problem with IPC
Hi, I am trying to use the simple Inter portlet communication provided in the JBoss2.6 core-samples. I add PortletA and portletB to a page and then select a color in PortletA and clicked on SubmitQuery. But I get the following exception - 17:51:04,296 ERROR [org_jboss_portal_core_samples_basic_event_PortletA] The portlet threw an exception | javax.portlet.PortletException: processAction method not implemented | at javax.portlet.GenericPortlet.processAction(GenericPortlet.java:120) | at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.invokeAction(PortletContainerImpl.java:458) | at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:401) | at org.jboss.portal.portlet.container.PortletContainerInvoker$1.invoke(PortletContainerInvoker.java:86) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:131) | at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.org$jboss$portal$core$aspects$portlet$TransactionInterceptor$invokeNotSupported$aop(TransactionInterceptor.java:86) | at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_N4547270787964792031.invokeNext(TransactionInterceptor$invokeNotSupported_N4547270787964792031.java) | at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66) | at org.jboss.aspects.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:112) | at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_N4547270787964792031.invokeNext(TransactionInterceptor$invokeNotSupported_N4547270787964792031.java) | at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66) | at org.jboss.aspects.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:102) | at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_N4547270787964792031.invokeNext(TransactionInterceptor$invokeNotSupported_N4547270787964792031.java) | at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.invokeNotSupported(TransactionInterceptor.java) | at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.invoke(TransactionInterceptor.java:56) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.core.aspects.portlet.HeaderInterceptor.invoke(HeaderInterceptor.java:50) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor.invoke(ProducerCacheInterceptor.java:53) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.core.aspects.portlet.AjaxInterceptor.invoke(AjaxInterceptor.java:51) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.aspects.portlet.ModesInterceptor.invoke(ModesInterceptor.java:62) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.bridge.BridgeInterceptor.invoke(BridgeInterceptor.java:47) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.aspects.portlet.WindowStatesInterceptor.invoke(WindowStatesInterceptor.java:55) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.aspects.portlet.PortletSessionSynchronizationInterceptor.invoke(PortletSessionSynchronizationInterceptor.java:80) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at org.jboss.portal.portlet.aspects.portlet.ContextTrackerInterceptor.invoke(ContextTrackerInterceptor.java:46) | at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38) | at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115) | at
[jboss-user] [JBoss Portal] - Re: IPC - Event not fired
Also posting the code for PortletA and PortletB PortletA.java | package org.jboss.portal.core.samples.basic.event; | | import javax.portlet.ActionRequest; | import javax.portlet.ActionResponse; | import javax.portlet.GenericPortlet; | import javax.portlet.PortletException; | import javax.portlet.PortletSecurityException; | import javax.portlet.RenderRequest; | import javax.portlet.RenderResponse; | import java.io.IOException; | import java.io.PrintWriter; | | /** | * @author a href=mailto:[EMAIL PROTECTED]Julien Viet/a | * @version $Revision: 5448 $ | */ | public class PortletA extends GenericPortlet | { |protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException |{ | response.setContentType(text/html); | PrintWriter writer = response.getWriter(); | writer.println(form action=\ + response.createActionURL() + \ method=\post\); | writer.println(select name=\color\); | writer.println(optionblue/option); | writer.println(optionred/option); | writer.println(optionblack/option); | writer.println(/select); | writer.println(input type=\submit\/); | writer.println(/form); | writer.close(); |} | } | PortletB.java | package org.jboss.portal.core.samples.basic.event; | | import org.jboss.portal.WindowState; | import org.jboss.portal.api.node.PortalNode; | import org.jboss.portal.api.node.event.PortalNodeEvent; | import org.jboss.portal.api.node.event.PortalNodeEventContext; | import org.jboss.portal.api.node.event.PortalNodeEventListener; | import org.jboss.portal.api.node.event.WindowActionEvent; | | import javax.portlet.ActionRequest; | import javax.portlet.ActionResponse; | import javax.portlet.GenericPortlet; | import javax.portlet.PortletException; | import javax.portlet.PortletSecurityException; | import javax.portlet.RenderRequest; | import javax.portlet.RenderResponse; | import java.io.IOException; | import java.io.PrintWriter; | | /** | * @author a href=mailto:[EMAIL PROTECTED]Julien Viet/a | * @version $Revision: 8785 $ | */ | public class PortletB extends GenericPortlet | { | |public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException |{ | String color = request.getParameter(color); | if (color != null) | { | response.setRenderParameter(color, color); | } |} | |protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException |{ | String color = request.getParameter(color); | response.setContentType(text/html); | PrintWriter writer = response.getWriter(); | writer.println(div + | (color == null ? : style=\color: + color + ;\) + | some text in color/div); | writer.close(); |} | |public static class Listener implements PortalNodeEventListener |{ | public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent event) | { | PortalNode node = event.getNode(); | | // Get node name | String nodeName = node.getName(); | | // See if we need to create a new event or not | WindowActionEvent newEvent = null; | if (nodeName.equals(PortletAWindow) event instanceof WindowActionEvent) | { | // Find window B | WindowActionEvent wae = (WindowActionEvent)event; | PortalNode windowB = node.resolve(../PortletBWindow); | if (windowB != null) | { |// We can redirect |newEvent = new WindowActionEvent(windowB); |newEvent.setWindowState(WindowState.MAXIMIZED); |newEvent.setParameters(wae.getParameters()); | } | } | | // | if (newEvent != null) | { | // If we have a new event redirect to it | return newEvent; | } | else | { | // Otherwise bubble up | return context.dispatch(); | } | } |} | } | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4143697#4143697 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4143697 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: problem with IPC
Also posting code for PortletA and PortletB PortletA.java | package org.jboss.portal.core.samples.basic.event; | | import javax.portlet.ActionRequest; | import javax.portlet.ActionResponse; | import javax.portlet.GenericPortlet; | import javax.portlet.PortletException; | import javax.portlet.PortletSecurityException; | import javax.portlet.RenderRequest; | import javax.portlet.RenderResponse; | import java.io.IOException; | import java.io.PrintWriter; | | /** | * @author a href=mailto:[EMAIL PROTECTED]Julien Viet/a | * @version $Revision: 5448 $ | */ | public class PortletA extends GenericPortlet | { |protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException |{ | response.setContentType(text/html); | PrintWriter writer = response.getWriter(); | writer.println(form action=\ + response.createActionURL() + \ method=\post\); | writer.println(select name=\color\); | writer.println(optionblue/option); | writer.println(optionred/option); | writer.println(optionblack/option); | writer.println(/select); | writer.println(input type=\submit\/); | writer.println(/form); | writer.close(); |} | } | PortletB.java | package org.jboss.portal.core.samples.basic.event; | | import org.jboss.portal.WindowState; | import org.jboss.portal.api.node.PortalNode; | import org.jboss.portal.api.node.event.PortalNodeEvent; | import org.jboss.portal.api.node.event.PortalNodeEventContext; | import org.jboss.portal.api.node.event.PortalNodeEventListener; | import org.jboss.portal.api.node.event.WindowActionEvent; | | import javax.portlet.ActionRequest; | import javax.portlet.ActionResponse; | import javax.portlet.GenericPortlet; | import javax.portlet.PortletException; | import javax.portlet.PortletSecurityException; | import javax.portlet.RenderRequest; | import javax.portlet.RenderResponse; | import java.io.IOException; | import java.io.PrintWriter; | | /** | * @author a href=mailto:[EMAIL PROTECTED]Julien Viet/a | * @version $Revision: 8785 $ | */ | public class PortletB extends GenericPortlet | { | |public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException |{ | String color = request.getParameter(color); | if (color != null) | { | response.setRenderParameter(color, color); | } |} | |protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException |{ | String color = request.getParameter(color); | response.setContentType(text/html); | PrintWriter writer = response.getWriter(); | writer.println(div + | (color == null ? : style=\color: + color + ;\) + | some text in color/div); | writer.close(); |} | |public static class Listener implements PortalNodeEventListener |{ | public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent event) | { | PortalNode node = event.getNode(); | | // Get node name | String nodeName = node.getName(); | | // See if we need to create a new event or not | WindowActionEvent newEvent = null; | if (nodeName.equals(PortletAWindow) event instanceof WindowActionEvent) | { | // Find window B | WindowActionEvent wae = (WindowActionEvent)event; | PortalNode windowB = node.resolve(../PortletBWindow); | if (windowB != null) | { |// We can redirect |newEvent = new WindowActionEvent(windowB); |newEvent.setWindowState(WindowState.MAXIMIZED); |newEvent.setParameters(wae.getParameters()); | } | } | | // | if (newEvent != null) | { | // If we have a new event redirect to it | return newEvent; | } | else | { | // Otherwise bubble up | return context.dispatch(); | } | } |} | } | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4143698#4143698 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4143698 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: problem with IPC
Hi, Thanks for your reply. My ipc listener is declared in portletB and even the settings are for portletB. I am attaching my jboss-service.xml here - | ?xml version=1.0 encoding=UTF-8? | | server | |!-- A sample listener -- |mbean | code=org.jboss.portal.core.event.PortalEventListenerServiceImpl | name=portal:service=ListenerService,type=ipc_listener_hw | xmbean-dd= | xmbean-code=org.jboss.portal.jems.as.system.JBossServiceModelMBean | xmbean/ | depends | optional-attribute-name=Registry | proxy-type=attributeportal:service=ListenerRegistry/depends | attribute name=RegistryIdipc_listener_hw/attribute | attribute name=ListenerClassNameorg.jboss.portlet.hello.HelloWorldPortletB$Listener/attribute |/mbean | /server | This is my helloworld-object.xml file | ?xml version=1.0 encoding=UTF-8? | deployments |deployment | parent-refdefault/parent-ref | if-existsoverwrite/if-exists | page | page-nameIPC/page-name | listeneripc_listener_hw/listener | properties/ | window | window-nameHelloWorldPortletAWindow/window-name | instance-refHelloWorldPortletAInstance/instance-ref | regionleft/region | height0/height | /window | window | window-nameHelloWorldPortletBWindow/window-name | instance-refHelloWorldPortletBInstance/instance-ref | regioncenter/region | height0/height | /window | /page |/deployment | /deployments | | Please let me know if these settings are wrong. Your help will be highly appreciated View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4143750#4143750 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4143750 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: Problems in doing JAAS login using code
Hi I am working on a similar problem. I want to login a special user automatically to the portal the first time a user access it (lets say user in the below code). I created a custom tomcat valve using the code described below. However the user is not authorized to access his dashboard (or any other /auth pages). I know I am missing something but can't put my finger on it. I am using the standard JAAS IdentityLoginModule. I see that the Principal returned by the JBossSecurityMgrRealm is always null (becuase the security context is null). Please help me. I have been breaking my head over this for a long time. I have read documentations and other posts on the forum but nothing is working for me. Thanks, Swati | package org.jboss.web.tomcat.security; | | import .. | | /** A valve that provides information on the jaas login exception seen in the | SecurityAssociation exception data. The useExceptionAsMsg flag indicates if | the exception message should be set as the http response message. The | exceptionHeader attribute if set is the header name that should be populated | with the exception message. | | @author [EMAIL PROTECTED] | @version $Revision: 57206 $ | */ | public class BasicAuthValve |extends ValveBase | { |private static Logger log = Logger.getLogger(BasicAuthValve.class); |private static boolean trace = log.isTraceEnabled(); | |/** Should the exception message be used as the request status message */ |private boolean useExceptionAsMsg = false; |/** A flag indicating if the auth exception thread local should be cleared */ |private boolean clearAuthException = true; |/** The name of the reply header to use to return the exception message */ |private String exceptionHeader = null; | |public boolean isUseExceptionAsMsg() |{ | return useExceptionAsMsg; |} |public void setUseExceptionAsMsg(boolean useExceptionAsMsg) |{ | this.useExceptionAsMsg = useExceptionAsMsg; |} | |public String getExceptionHeader() |{ | return exceptionHeader; |} |public void setExceptionHeader(String exceptionHeader) |{ | this.exceptionHeader = exceptionHeader; |} | |public void invoke(Request request, Response response) | throws IOException, ServletException |{ | // TODO Auto-generated method stub | List roles = new ArrayList(); | roles.add(Authenticated); | roles.add(User); | roles.add(Admin); | roles.add(CustomRole); | | String password = user; | String username = user; | | Principal p = this.getContainer().getRealm().authenticate(username, (String)null); | request.setUserPrincipal(new GenericPrincipal(request.getContext().getRealm(), username, password, roles)); | | this.getNext().invoke(request, response); | |} | | } View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4135808#4135808 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4135808 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: Auto-login on JBoss Portal
Thanks a lot. I was able to successfully create a custom tomcat valve (code attached below). This even allowed automatic login to my user and displayed the default page as User logged in: . However I think this user is still not authorized to access anything that is below the /auth access. When I call the this.container.getRealm().authenticate method in the valve I am forwarded to the JBossSecurityMgrRealm.authenticate method. In this method, the securityCtx object is null and so I just get a null from the function. I think this is the problem why my users are not being authorized. Can you please shed some light as to where I could be going wrong. So in short all I have changed in the Jboss AS code is adding this custom valve and changing the server.xml I have not changed anything in the Jboss Portal code at all. /* | * JBoss, Home of Professional Open Source. | * Copyright 2006, Red Hat Middleware LLC, and individual contributors | * as indicated by the @author tags. See the copyright.txt file in the | * distribution for a full listing of individual contributors. | * | * This is free software; you can redistribute it and/or modify it | * under the terms of the GNU Lesser General Public License as | * published by the Free Software Foundation; either version 2.1 of | * the License, or (at your option) any later version. | * | * This software is distributed in the hope that it will be useful, | * but WITHOUT ANY WARRANTY; without even the implied warranty of | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * Lesser General Public License for more details. | * | * You should have received a copy of the GNU Lesser General Public | * License along with this software; if not, write to the Free | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | */ | package org.jboss.web.tomcat.security; | | import java.io.IOException; | import java.security.Principal; | import java.security.acl.Group; | import java.util.ArrayList; | import java.util.List; | | import javax.security.auth.Subject; | import javax.servlet.ServletException; | | import org.apache.catalina.connector.Request; | import org.apache.catalina.connector.Response; | import org.apache.catalina.Context; | import org.apache.catalina.Session; | | import org.apache.catalina.realm.GenericPrincipal; | import org.apache.catalina.valves.ValveBase; | import org.jboss.logging.Logger; | import org.jboss.security.SecurityAssociation; | import org.jboss.security.SimpleGroup; | | //import com.sun.security.auth.UserPrincipal; | | //import com.sun.security.auth.UserPrincipal; | | /** A valve that provides information on the jaas login exception seen in the | SecurityAssociation exception data. The useExceptionAsMsg flag indicates if | the exception message should be set as the http response message. The | exceptionHeader attribute if set is the header name that should be populated | with the exception message. | | @author [EMAIL PROTECTED] | @version $Revision: 57206 $ | */ | public class BasicAuthValve |extends ValveBase | { |private static Logger log = Logger.getLogger(BasicAuthValve.class); |private static boolean trace = log.isTraceEnabled(); | |/** Should the exception message be used as the request status message */ |private boolean useExceptionAsMsg = false; |/** A flag indicating if the auth exception thread local should be cleared */ |private boolean clearAuthException = true; |/** The name of the reply header to use to return the exception message */ |private String exceptionHeader = null; | |public boolean isUseExceptionAsMsg() |{ | return useExceptionAsMsg; |} |public void setUseExceptionAsMsg(boolean useExceptionAsMsg) |{ | this.useExceptionAsMsg = useExceptionAsMsg; |} | |public String getExceptionHeader() |{ | return exceptionHeader; |} |public void setExceptionHeader(String exceptionHeader) |{ | this.exceptionHeader = exceptionHeader; |} | |public void invoke(Request request, Response response) | throws IOException, ServletException |{ | // TODO Auto-generated method stub | List roles = new ArrayList(); | roles.add(Authenticated); | roles.add(User); | roles.add(Admin); | roles.add(CustomRole); | | String password = user; | String username = user; | | Principal p = this.getContainer().getRealm().authenticate(username, (String)null); | request.setAuthType(FORM); | request.setUserPrincipal(new
[jboss-user] [Tomcat, HTTPD, Servlets JSP] - Re: Problems Accessing Realm (JBossSecurityMgrRealm) from To
Hi Josh, I am facing a similar issue as you did sometime back ie. the JBossSecurityMgrRealm instance that is provided to me in my custom valve has a null securityCtx. I am still a newbee to Jboss and JAAS. I could not understand your last post as to which code did you move to the authenticator ? In my case I have only created a custom valve - NO custom authenticator. Can you please help me with this as I have been struggling with this issue for a week now. Thanks, Swati View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4135814#4135814 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4135814 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [Tomcat, HTTPD, Servlets JSP] - Re: Problems Accessing Realm (JBossSecurityMgrRealm) from To
Hi Josh, Some more information on my problem. I am just implementing a basic custom valve (and not a SSO valve). I am attaching the code for my valve below. Isn't this similar to the authenticator that you talk about in your last post ? If so then the Realm object that I get should have the JNDI namespace correctly set ? | /* | * JBoss, Home of Professional Open Source. | * Copyright 2006, Red Hat Middleware LLC, and individual contributors | * as indicated by the @author tags. See the copyright.txt file in the | * distribution for a full listing of individual contributors. | * | * This is free software; you can redistribute it and/or modify it | * under the terms of the GNU Lesser General Public License as | * published by the Free Software Foundation; either version 2.1 of | * the License, or (at your option) any later version. | * | * This software is distributed in the hope that it will be useful, | * but WITHOUT ANY WARRANTY; without even the implied warranty of | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * Lesser General Public License for more details. | * | * You should have received a copy of the GNU Lesser General Public | * License along with this software; if not, write to the Free | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | */ | package org.jboss.web.tomcat.security; | | import java.io.IOException; | import java.security.Principal; | import java.security.acl.Group; | import java.util.ArrayList; | import java.util.List; | | import javax.security.auth.Subject; | import javax.servlet.ServletException; | | import org.apache.catalina.connector.Request; | import org.apache.catalina.connector.Response; | import org.apache.catalina.Context; | import org.apache.catalina.Session; | | import org.apache.catalina.realm.GenericPrincipal; | import org.apache.catalina.valves.ValveBase; | import org.jboss.logging.Logger; | import org.jboss.security.SecurityAssociation; | import org.jboss.security.SimpleGroup; | | //import com.sun.security.auth.UserPrincipal; | | //import com.sun.security.auth.UserPrincipal; | | /** A valve that provides information on the jaas login exception seen in the | SecurityAssociation exception data. The useExceptionAsMsg flag indicates if | the exception message should be set as the http response message. The | exceptionHeader attribute if set is the header name that should be populated | with the exception message. | | @author [EMAIL PROTECTED] | @version $Revision: 57206 $ | */ | public class BasicAuthValve |extends ValveBase | { |private static Logger log = Logger.getLogger(BasicAuthValve.class); |private static boolean trace = log.isTraceEnabled(); | |/** Should the exception message be used as the request status message */ |private boolean useExceptionAsMsg = false; |/** A flag indicating if the auth exception thread local should be cleared */ |private boolean clearAuthException = true; |/** The name of the reply header to use to return the exception message */ |private String exceptionHeader = null; | |public boolean isUseExceptionAsMsg() |{ | return useExceptionAsMsg; |} |public void setUseExceptionAsMsg(boolean useExceptionAsMsg) |{ | this.useExceptionAsMsg = useExceptionAsMsg; |} | |public String getExceptionHeader() |{ | return exceptionHeader; |} |public void setExceptionHeader(String exceptionHeader) |{ | this.exceptionHeader = exceptionHeader; |} | |public void invoke(Request request, Response response) | throws IOException, ServletException |{ | // TODO Auto-generated method stub | List roles = new ArrayList(); | roles.add(Authenticated); | roles.add(User); | roles.add(Admin); | roles.add(CustomRole); | | String password = user; | String username = user; | | username = request.getRemoteUser(); | if (username != null) { | Principal p = this.getContainer().getRealm().authenticate(username, (String)null); | request.setAuthType(FORM); | request.setUserPrincipal(new GenericPrincipal(request.getContext().getRealm(), username, password, roles)); | } | | this.getNext().invoke(request, response); | if (request.getAttribute(org.jboss.portal.logout) != null) { | request.getSession().invalidate(); | } |} | | } | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4135815#4135815 Reply to
[jboss-user] [JBoss Portal] - Auto-login on JBoss Portal
Hi, I'm a newbee to Jboss Portal and am using it as the framework for our project's portal. I need to integrate the portal with a Shibboleth login. So basically a user should be able to select from a list of identity providers, use his login for that Identity provider and then access the portal. I want that once the user verifies himself on the Identity Provider, he should automatically login to the portal. The username of the logged in user is provided to my application as a parameter on the request. I don't understand at which point should I intercept the framework to provide auto-login and then redirect the user to the default page. Any help would be highly appreciated. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4135193#4135193 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4135193 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: Auto-login on JBoss Portal
Thanks for your reply. I do understand a little better of the idea you were suggesting after reading the related documentation. However I am using AAF (Australian Access Federation) as my SSO server. I am running my JBoss Application Server under Apache2 and have already configured Apache2 to redirect my portal access to the AAF login site. Here the user chooses his IdP and logins using the same. This part is done. Now after the user logs in successfully, he can see the default page of the portal but he is NOT logged into the portal. I need a way to log him into the portal and set his username/principal on to the request parameters. Also the framework that I am trying to provide, I would still like the Logout button on the portal which the user can click to signout as his default login and use another login if he may have (like if someone knows the admin login). View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4135493#4135493 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4135493 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: Auto-login on JBoss Portal
One more question - I have created and built a custom tomcat Valve which will create the UserPrincipal object. How do I make JBoss Application Server to use this tomcat instead of the standard one that it uses ? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4135515#4135515 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4135515 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Portal] - Re: custom authentication
Hi, I am looking for a similar solution to my problem. Basically I am authenticating my users against some accepted Identity Providers (using Shibboleth). Now I want a user (who has successfully been authenticated) to be automatically logged into the portal. Have you figured out a solution to your problem ? It might be of help to me. Thanks in advance. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4135179#4135179 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4135179 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user