You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "NHSoft.YHW" <nh...@gmail.com> on 2008/05/04 03:41:50 UTC
why swarm not render link
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.
Re: why swarm not render link
Posted by 宁波新希望信息技术有限公司 -- 俞宏伟 <nh...@gmail.com>.
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="logoff"><wicket:message key="label.page.logoff"/></a>*
tag, wicket will ignore the link tag
2008/5/5 Maurice Marrink <ma...@gmail.com>:
> 2008/5/5 宁波新希望信息技术有限公司 -- 俞宏伟 <nh...@gmail.com>:
> > *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:nhsoft.yhw@gmail.com <GT...@gmail.com>
MSN: nhsoft.yhw@hotmail.com
Tel: 0574-87280538
Fax: 0574-56226219
Mobile:13780081921
Re: why swarm not render link
Posted by Maurice Marrink <ma...@gmail.com>.
2008/5/5 宁波新希望信息技术有限公司 -- 俞宏伟 <nh...@gmail.com>:
> *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
Posted by 宁波新希望信息技术有限公司 -- 俞宏伟 <nh...@gmail.com>.
*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 1 footer 2.1K
wm.wicket.pages.FooterPanel 2 footer:About 1.3K
org.apache.wicket.markup.html.link.PageLink 3 footer:ShopList
1.3K org.apache.wicket.markup.html.link.PageLink 4 footer:Terms
1.3K org.apache.wicket.markup.html.link.PageLink 5
globalFeedback 1.6K org.apache.wicket.markup.html.panel.FeedbackPanel
6 globalFeedback:feedbackul 5K
org.apache.wicket.markup.html.WebMarkupContainer 7
globalFeedback:feedbackul:messages 5K
org.apache.wicket.markup.html.list.ListView [] 8 header 3.7K
wm.wicket.pages.HeaderPanel 9 header:Comment 1.4K
org.apache.wicket.markup.html.link.PageLink 10 header:Home 1.4K
org.apache.wicket.markup.html.link.PageLink 11
header:ManageCenter 1.4K org.apache.wicket.markup.html.link.PageLink
12 header:ShareShop 1.3K
org.apache.wicket.markup.html.link.PageLink 13 header:UserManual
1.3K org.apache.wicket.markup.html.link.PageLink 14
header:logoff 5K org.apache.wicket.markup.html.link.Link 15
header:toCreateUserAccount 2K
org.apache.wicket.security.components.markup.html.links.SecurePageLink
16 header:username 420 bytes
org.apache.wicket.markup.html.basic.Label - nhsoft
On Mon, May 5, 2008 at 1:27 AM, Maurice Marrink <ma...@gmail.com> 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, 宁波新希望信息技术有限公司 -- 俞宏伟
> <nh...@gmail.com> 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: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
--
新希望软件---俞宏伟
Addr:宁波海曙新高路47弄7号四楼
Site: http://www.nhsoft.cn
GTalk:nhsoft.yhw@gmail.com <GT...@gmail.com>
MSN: nhsoft.yhw@hotmail.com
Tel: 0574-87280538
Fax: 0574-56226219
Mobile:13780081921
Re: why swarm not render link
Posted by Maurice Marrink <ma...@gmail.com>.
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, 宁波新希望信息技术有限公司 -- 俞宏伟
<nh...@gmail.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
Re: why swarm not render link
Posted by 宁波新希望信息技术有限公司 -- 俞宏伟 <nh...@gmail.com>.
*-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)
Re: why swarm not render link
Posted by Maurice Marrink <ma...@gmail.com>.
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 <nh...@gmail.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org