Re: why swarm not render link

2008-05-05 Thread Maurice Marrink
2008/5/5 宁波新希望信息技术有限公司 -- 俞宏伟 [EMAIL PROTECTED]:
 *Can you check which block is executed, the if or the else.
  *the else block code will never execute after login in

True, it shouldn't but i am running out of ideas here.

Can you set a breakpoint in Component#render(MarkupStream) and check
what is happening there.
My guess (based on the log) is that isRenderAllowed() will return
true, and that there is some other reason why it is not visible.
If isRenderAllowed returns false can you step into it and tell me
exactly what happens.

Maurice


Re: why swarm not render link

2008-05-05 Thread 宁波新希望信息技术有限公司 -- 俞宏伟
thanks, Maurice

i found the problem, it is not relative to swarm. because my
BaseSecurePage.properties file not define fkey message, but
BasePage.properties defined
*label.page.logoff=退出
label.page.createuseraccount=申请个人帐号*

because wicket can not found the key message define, when render *a
href=# wicket:id=logoffwicket:message key=label.page.logoff//a*
tag, wicket will ignore the link tag





2008/5/5 Maurice Marrink [EMAIL PROTECTED]:

 2008/5/5 宁波新希望信息技术有限公司 -- 俞宏伟 [EMAIL PROTECTED]:
  *Can you check which block is executed, the if or the else.
   *the else block code will never execute after login in

 True, it shouldn't but i am running out of ideas here.

 Can you set a breakpoint in Component#render(MarkupStream) and check
 what is happening there.
 My guess (based on the log) is that isRenderAllowed() will return
 true, and that there is some other reason why it is not visible.
 If isRenderAllowed returns false can you step into it and tell me
 exactly what happens.

 Maurice




-- 
新希望软件---俞宏伟
Addr:宁波海曙新高路47弄7号四楼
Site: http://www.nhsoft.cn
GTalk:[EMAIL PROTECTED] [EMAIL PROTECTED]
MSN: [EMAIL PROTECTED]
Tel: 0574-87280538
Fax: 0574-56226219
Mobile:13780081921


Re: why swarm not render link

2008-05-04 Thread Maurice Marrink
Well everything looks fine, so i will ask you to verify a few things for me.
-Your hive file has permissions which continue over the next line, i
assume this is caused by copy pasting the file here and that in the
actual hive file each permission is on exactly 1 line.
-I assume all the page classes in the policy file extend this
BaseSecurePage of yours
-Can you turn on debug logging for BasicHive and
PolicyFileHiveFactory, i would like to see if you get any messages
about the user not having permissions for the links and messages about
skipped policy file lines
-Are you using 1.3.0 or 1.3-SNAPSHOT?
-According to the policy file these permissions are granted to any
authenticated user, can you confirm you indeed have an authenticated
user.
-Can you show me your application, in particular the methods swarm
requires you to implement

I cannot explain why your logoff link is not displayed, it is not
secured as far as i can see, so it should always render.

Maurice


On Sun, May 4, 2008 at 3:42 AM, NHSoft.YHW [EMAIL PROTECTED] wrote:


  my hive file:
  grant
  {
 permission ${ComponentPermission} wm.wicket.pages.HomePage, 
 inherit,
  render;
 permission ${ComponentPermission} wm.wicket.pages.HomePage, 
 enable;
 permission ${ComponentPermission} wm.wicket.pages.ManageCenterPage,
  inherit, render;
 permission ${ComponentPermission} wm.wicket.pages.ManageCenterPage,
  enable;
 permission ${ComponentPermission} 
 wm.wicket.pages.UserAccountFormPage,
  inherit, render;
 permission ${ComponentPermission} 
 wm.wicket.pages.UserAccountFormPage,
  enable;
  };

  BaseSecurePage extend SecureWebPage:

  public class BaseSecurePage extends SecureWebPage {
 private static final long serialVersionUID = 1L;

 protected static final Logger logger =
  LoggerFactory.getLogger(BaseSecurePage.class);

 public BaseSecurePage() {
 final HeaderPanel headerPanel = new HeaderPanel();
 headerPanel.setRenderBodyOnly(true);
 add(headerPanel);
 }
  ...
  }

  when i add link to headerPanel, the link(both wicket's Link and swarm
  SecurePageLink) will not render(not visible), but when i change my
  BaseSecurePage extend WebPage, the link will visible.

  my link create code in HeaderPanel as follow:

  public class HeaderPanel extends BasePanel {
 public HeaderPanel() {
 //general link
 Link logoff = new Link(logoff)
 {
 private static final long serialVersionUID = 1L;

 public void onClick()
 {
 WaspSession waspSession = 
 ((WaspSession)getSession());
 LoginContext loginContext =
  ((wm.wicket.Application)getApplication()).getLogoffContext();
 if (waspSession.logoff(loginContext))
 {
 // homepage is not allowed anymore so 
 we end up at the loginpage
 
 setResponsePage(Application.get().getHomePage());
 waspSession.invalidate();
 } else {
 error(A problem occured during the 
 logoff process, please try again or
  contact support);
 }
 }
 };
 add(logoff);

 //Swarm Secure Link
 final SecurePageLink lnkCreateUserAccount = new
  SecurePageLink(toCreateUserAccount, UserAccountFormPage.class);
 lnkCreateUserAccount.setAutoEnable(true);
 add(lnkCreateUserAccount);
 
 }
  }

  I want to know why link not render, if my hive file has some problem, how to
  change hive config file for can show link
  --
  View this message in context: 
 http://www.nabble.com/why-swarm-not-render-link-tp17041821p17041821.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: why swarm not render link

2008-05-04 Thread Maurice Marrink
The log indicates all requested permissions are granted. In fact the
only thing that raises my eyebrow in the log is :
05-04 21:14:10.000[UserAccountServiceImpl.java:40 :ERROR]
org.springframework.orm.ObjectRetrievalFailureException: Object of
class [wm.model.UserAccount] with identifier [nhsoft]: not found
05-04 21:14:10.046[ LoggerListener.java:60 :WARN ] Authentication
event AuthenticationSuccessEvent: nhsoft; details: null
which might indicate a problem with acegi or your configuration.
So i don't think swarm is the problem here. I did notice however an if
statement in HeaderPanel
Authentication authentication =
SecurityContextHolder.getContext().getAuthentication();
if(authentication != null)
 .
else
 

In the else block you are hiding both links, which matches the
problems you are seeing.
Theoretically if you only use this panel on pages extending from
SecureBasePage, the Authentication should never be null. If it is,
this indicates a synchronization problem between swarm and acegi, both
keep separate records of who is logged in and what there
permissions/grantedAuthorities are.

Can you check which block is executed, the if or the else.

Maurice

On Sun, May 4, 2008 at 3:28 PM, 宁波新希望信息技术有限公司 -- 俞宏伟
[EMAIL PROTECTED] wrote:
 -Your hive file has permissions which continue over the next line, i assume
 this is caused by copy pasting the file here and that in the actual hive
 file each permission is on exactly 1 line.
 yes, my hive file for each permission is on exactly 1 line(nabble forum show
 correctly)


  -I assume all the page classes in the policy file extend this
 BaseSecurePage of yours
 yes


  -Can you turn on debug logging for BasicHive and PolicyFileHiveFactory, i
 would like to see if you get any messages about the user not having
 permissions for the links and messages about skipped policy file lines
  yes, i turn on debug for org.apache.wicket.security,but i can not found any
 skipped tips message. attachment file for detail log information


  -Are you using 1.3.0 or 1.3-SNAPSHOT?
  version is 1.3.0


  -According to the policy file these permissions are granted to any
 authenticated user, can you confirm you indeed have an authenticated user.
 yes


  -Can you show me your application, in particular the methods swarm requires
 you to implement
 my swarm implement is acegi+swarm from swarm acegi example. i attach source
 code (swarm.implement.src.zip)

 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



Re: why swarm not render link

2008-05-04 Thread 宁波新希望信息技术有限公司 -- 俞宏伟
*Can you check which block is executed, the if or the else.
*the else block code will never execute after login in

if i change BaseSecurePage class extends from WebPage(same as BasePage), the
link will be visible.

when turn on wicket debug  detail information show the link object is exist,
but not render.
Page

[Page class = wm.wicket.pages.ManageCenterPage, id = 25, version = 0]:
 # Path Size Type Model Object   1footer2.1K
wm.wicket.pages.FooterPanel2footer:About1.3K
org.apache.wicket.markup.html.link.PageLink3footer:ShopList
1.3Korg.apache.wicket.markup.html.link.PageLink4footer:Terms
1.3Korg.apache.wicket.markup.html.link.PageLink5
globalFeedback1.6Korg.apache.wicket.markup.html.panel.FeedbackPanel
6globalFeedback:feedbackul5K
org.apache.wicket.markup.html.WebMarkupContainer7
globalFeedback:feedbackul:messages5K
org.apache.wicket.markup.html.list.ListView[]8header3.7K
wm.wicket.pages.HeaderPanel9header:Comment1.4K
org.apache.wicket.markup.html.link.PageLink10header:Home1.4K
org.apache.wicket.markup.html.link.PageLink11
header:ManageCenter1.4Korg.apache.wicket.markup.html.link.PageLink
12header:ShareShop1.3K
org.apache.wicket.markup.html.link.PageLink13header:UserManual
1.3Korg.apache.wicket.markup.html.link.PageLink14
header:logoff5Korg.apache.wicket.markup.html.link.Link15
header:toCreateUserAccount2K
org.apache.wicket.security.components.markup.html.links.SecurePageLink
16header:username420 bytes
org.apache.wicket.markup.html.basic.Label- nhsoft











On Mon, May 5, 2008 at 1:27 AM, Maurice Marrink [EMAIL PROTECTED] wrote:

 The log indicates all requested permissions are granted. In fact the
 only thing that raises my eyebrow in the log is :
 05-04 21:14:10.000[UserAccountServiceImpl.java:40 :ERROR]
 org.springframework.orm.ObjectRetrievalFailureException: Object of
 class [wm.model.UserAccount] with identifier [nhsoft]: not found
 05-04 21:14:10.046[ LoggerListener.java:60 :WARN ] Authentication
 event AuthenticationSuccessEvent: nhsoft; details: null
 which might indicate a problem with acegi or your configuration.
 So i don't think swarm is the problem here. I did notice however an if
 statement in HeaderPanel
 Authentication authentication =
 SecurityContextHolder.getContext().getAuthentication();
 if(authentication != null)
  .
 else
  

 In the else block you are hiding both links, which matches the
 problems you are seeing.
 Theoretically if you only use this panel on pages extending from
 SecureBasePage, the Authentication should never be null. If it is,
 this indicates a synchronization problem between swarm and acegi, both
 keep separate records of who is logged in and what there
 permissions/grantedAuthorities are.

 Can you check which block is executed, the if or the else.

 Maurice

 On Sun, May 4, 2008 at 3:28 PM, 宁波新希望信息技术有限公司 -- 俞宏伟
 [EMAIL PROTECTED] wrote:
  -Your hive file has permissions which continue over the next line, i
 assume
  this is caused by copy pasting the file here and that in the actual hive
  file each permission is on exactly 1 line.
  yes, my hive file for each permission is on exactly 1 line(nabble forum
 show
  correctly)
 
 
   -I assume all the page classes in the policy file extend this
  BaseSecurePage of yours
  yes
 
 
   -Can you turn on debug logging for BasicHive and PolicyFileHiveFactory,
 i
  would like to see if you get any messages about the user not having
  permissions for the links and messages about skipped policy file lines
   yes, i turn on debug for org.apache.wicket.security,but i can not found
 any
  skipped tips message. attachment file for detail log information
 
 
   -Are you using 1.3.0 or 1.3-SNAPSHOT?
   version is 1.3.0
 
 
   -According to the policy file these permissions are granted to any
  authenticated user, can you confirm you indeed have an authenticated
 user.
  yes
 
 
   -Can you show me your application, in particular the methods swarm
 requires
  you to implement
  my swarm implement is acegi+swarm from swarm acegi example. i attach
 source
  code (swarm.implement.src.zip)
 
  -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
 




-- 
新希望软件---俞宏伟
Addr:宁波海曙新高路47弄7号四楼
Site: http://www.nhsoft.cn
GTalk:[EMAIL PROTECTED] [EMAIL PROTECTED]
MSN: [EMAIL PROTECTED]
Tel: 0574-87280538
Fax: 0574-56226219
Mobile:13780081921


why swarm not render link

2008-05-03 Thread NHSoft.YHW

my hive file:
grant
{   
permission ${ComponentPermission} wm.wicket.pages.HomePage, inherit,
render;
permission ${ComponentPermission} wm.wicket.pages.HomePage, enable;
permission ${ComponentPermission} wm.wicket.pages.ManageCenterPage,
inherit, render;
permission ${ComponentPermission} wm.wicket.pages.ManageCenterPage,
enable;   
permission ${ComponentPermission} wm.wicket.pages.UserAccountFormPage,
inherit, render;
permission ${ComponentPermission} wm.wicket.pages.UserAccountFormPage,
enable;   
};

BaseSecurePage extend SecureWebPage:

public class BaseSecurePage extends SecureWebPage {
private static final long serialVersionUID = 1L;

protected static final Logger logger =
LoggerFactory.getLogger(BaseSecurePage.class);

public BaseSecurePage() {   
final HeaderPanel headerPanel = new HeaderPanel();
headerPanel.setRenderBodyOnly(true);
add(headerPanel);   
}
...
}

when i add link to headerPanel, the link(both wicket's Link and swarm
SecurePageLink) will not render(not visible), but when i change my
BaseSecurePage extend WebPage, the link will visible.

my link create code in HeaderPanel as follow:

public class HeaderPanel extends BasePanel {
public HeaderPanel() {
//general link
Link logoff = new Link(logoff)
{
private static final long serialVersionUID = 1L;

public void onClick()
{
WaspSession waspSession = 
((WaspSession)getSession());
LoginContext loginContext =
((wm.wicket.Application)getApplication()).getLogoffContext();
if (waspSession.logoff(loginContext))
{
// homepage is not allowed anymore so 
we end up at the loginpage

setResponsePage(Application.get().getHomePage());
waspSession.invalidate();
} else {
error(A problem occured during the 
logoff process, please try again or
contact support);
}
}
};
add(logoff);

//Swarm Secure Link
final SecurePageLink lnkCreateUserAccount = new
SecurePageLink(toCreateUserAccount, UserAccountFormPage.class);
lnkCreateUserAccount.setAutoEnable(true);
add(lnkCreateUserAccount);

}
}

I want to know why link not render, if my hive file has some problem, how to
change hive config file for can show link 
-- 
View this message in context: 
http://www.nabble.com/why-swarm-not-render-link-tp17041821p17041821.html
Sent from the Wicket - User mailing list archive at Nabble.com.