[JBoss Seam] - Seam security working in Facelets but not via annotations
by omilian3
Hi,
Following the Seam reference, I've setup a login page using the identity management facilities. The log in works fine, and in my Facelets I can use the following successfully:
<s:div rendered="#{identity.loggedIn}">
| YOU ARE LOGGED IN
| </s:div>
I've also setup the JBoss Rules engine, so the following also works:
<s:div rendered="#{s:hasPermission('customer', 'delete', null)}">
| YOU HAVE CUSTOMER DELETE
| </s:div>
and;
<s:div rendered="#{s:hasRole('power')}">
| YOU HAVE POWER ROLE
| </s:div>
So far so good. These pages all reference a simple backing bean as follows:
| package au.gov.austrac.ao.prototype;
|
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.security.Restrict;
| import org.jboss.seam.security.Identity;
|
| @Name("authenticator")
| public class ExampleAuthenticator {
|
| @In
| Identity identity;
|
| public String name = "bill";
|
| public String getName() {
| tryRulesEngine();
| return name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
|
| @Restrict("#{identity.loggedIn}")
| public void tryRulesEngine() {
| System.out.println("logged in? " + identity.isLoggedIn());
| }
|
| public boolean authenticate() {
| identity.addRole("power");
| return true;
| }
| }
This bean is available under the name "authenticator" in my pages via the @Name annotation, and the authenticate() method is invoked by the identity code, so it would seem that the framework knows about this class and the Seam annotations are being invoked (at least @Name is), yet when I'm not logged in I can still access the tryRulesEngine() method. Note that the section of the page controlled by the first code snippet above is not displayed.
It appears that the @Restrict annotation is not working or is not being invoked?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069842#4069842
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069842
18Â years, 8Â months
[JBoss Portal] - IPC - Event not fired
by explorer
Hi,
I was trying to work with the example given for IPC but with some custom code of mine. I was not able to achieve any result. Please advice.
I have a myportal.sar where in i put the jboss-service.xml with the following code.
| <server>
| <mbean
| code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
| name="portal:service=ListenerService,type=PortalInitListener"
| xmbean-dd=""
| xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
| <xmbean/>
| <depends
| optional-attribute-name="Registry"
| proxy-type="attribute">portal:service=ListenerRegistry</depends>
| <attribute name="RegistryId">PortalInitListener</attribute>
| <attribute name="ListenerClassName">
| gov.sba.bgportal.jboss.examples.PortalInitService
| </attribute>
| </mbean>
| <mbean
| code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
| name="portal:service=ListenerService,type=NodeEventListener"
| xmbean-dd=""
| xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
| <xmbean/>
| <depends
| optional-attribute-name="Registry"
| proxy-type="attribute">portal:service=ListenerRegistry</depends>
| <attribute name="RegistryId">NodeEventListener</attribute>
| <attribute name="ListenerClassName">
| gov.sba.bgportal.jboss.examples.MyEventPortlet$Listener
| </attribute>
| </mbean>
| </server>
|
My first listener PortalInitListener is of type PortalEventListener and works good for SessionEvents.
Second one is a PortalNodeEventListener. This never gets fired.
There are two portlets communicating the information through parameters.
FirstPortlet:
public class AlfrescoRenditionPrtlet extends GenericPortlet
| {
| protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
| {
| String renditionFileURL = rRequest.getPreferences().getValue("renditionFileURL", "/AdminHome/404.html");
| String PropegatedValue = rRequest.getParameterMap().toString();
| String s = "parameterMAP AlfrescoRenditionPrtlet ---->"+PropegatedValue;
| String s1 = "fromContext AlfrescoRenditionPrtlet ---->"+getPortletContext().getAttribute("fromContext");
| rResponse.setContentType("text/html");
| PrintWriter writer = rResponse.getWriter();
| writer.println("<form action=\"" + rResponse.createActionURL() + "\" method=\"post\">");
| writer.println("<input type=\"text\" name=\"EventPropegatedValue\" value=\"Hidden value from PortletItSelf\"/> ");
| writer.println("<input type=\"submit\"/>");
| writer.println("</form><br>");
| writer.println(s+"<br>"+s1);
| writer.close();
| }
| }
|
SecondPortlet:
| public void processAction(ActionRequest request, ActionResponse response) {
| String PropegatedValue = request.getParameter("EventPropegatedValue");
| response.setRenderParameter("PropegatedValue", PropegatedValue);
| }
|
| protected void doView(RenderRequest rRequest, RenderResponse response) throws PortletException, IOException, UnavailableException
| {
| String PropegatedValue = rRequest.getParameterMap().toString();
| String s = "PropegatedValue MyEventPortlet ---->"+PropegatedValue;
| String renditionFileURL = rRequest.getPreferences().getValue("renditionFileURL", "/AdminHome/404.html");
| String s1 = "fromContext MyEventPortlet ---->"+getPortletContext().getAttribute("fromContext");
| response.setContentType("text/html");
| PrintWriter writer = response.getWriter();
| writer.println(s+"<br>"+s1);
| writer.close();
| }
|
Listener:
| public static class Listener implements PortalNodeEventListener{
| public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent event) {
| PortalNode node = event.getNode();
| String nodeName = node.getName();
| WindowActionEvent newEvent = null;
| if (nodeName.equals("ARPWindow1") && event instanceof WindowActionEvent)
| {
| WindowActionEvent wae = (WindowActionEvent)event;
| PortalNode window2 = node.resolve("../MEPWindow2");
| if (window2 != null)
| {
| newEvent = new WindowActionEvent(window2);
| Map map = new HashMap<Object,Object>();
| map.put("EventPropegatedValue", "~~~~~This is the value~~~~");
| map.putAll(wae.getParameters());
| newEvent.setParameters(map);
| }
| }
| if (newEvent != null)
| {
| return newEvent;
| }
| else
| {
| return context.dispatch();
| }
| }
| }
|
I am unable to locate the problem. Any one there to advice me.
Any sort of help is thanked.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069838#4069838
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069838
18Â years, 8Â months
[JBoss Messaging] - onMessage not being fired for message on a queue
by HibsMax
Hi, Group.
This question is vague and I apologise for that up front. I'm mainly looking for pointers to help me determine where to start looking.
I have an application that:
1. produces a message
2. writes the message to a database
3. pushes the message to queue
4. update the record in the database
5. sends the message to a topic
6. a consumer then consumes the messages on the topic
steps 1-3 happen in a servlet running on server1
steps 4-5 happen in the onMessage method in an MDB running on server2
All the messages make it to the database so I know that steps 1, 2 and 3 are all working. I have a debug statement in the onMessage method and I can see that it's not being called for every message e.g. I send 450 messages but the onMessage is only executed 210 times. When I look in the JBM_MSG table I see what I believe are the missing messages (I check the headers column using the SQL below).
Can anyone suggest a reason why the onMessage method would not be called for every message? I know it's being called sometimes, just not all the time. I think I must be missing a config parameter or something.
I am using JBM 1.3 GA and Oracle.
Peace, Anders
SQL to check jbm_msg.headers:
SELECT UTL_RAW.CAST_TO_VARCHAR2 (DBMS_LOB.SUBSTR (headers))
FROM jbm_msg
/
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069833#4069833
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069833
18Â years, 8Â months