Just a follow up...

Currently, authentication in Pax Wicket is only implemented for the case
of annotations.


Is the plan to ignore in-code kind for some reason, or is it just
because it wasn't needed yet?




On Tue, 2007-06-26 at 12:19 +0900, David Leangen wrote:
> I just committed a (kind of) replica of the Wicket authentication
> example project to ops4j. I think it would be useful for showing how
> Wicket authentication is supposed to work in Pax Wicket.
> 
> However, it ain't yet working. There are still some things I need to
> figure out.
> 
> I think there are also some things (like what I write about below) that
> just won't work in Pax Wicket in its present form.
> 
> 
> Anyway, if anybody wants to jump in, I certainly won't hold you
> back. ;-)
> 
> 
> Cheers,
> Dave
> 
> 
> 
> 
> On Mon, 2007-06-25 at 17:28 +0900, David Leangen wrote:
> > BTW, this problem came up when trying to apply the wicket-auth-example
> > example to Pax Wicket.
> > 
> > The Wicket example "registers" the correct authentication by tying it to
> > the Session like so:
> > 
> > 
> > public class RolesApplication extends WebApplication implements
> > ISessionFactory
> > {
> >     /**
> >      * User DB.
> >      */
> >     public static List<User> USERS = Arrays.asList(new User[] { new
> > User("jon", "ADMIN"),
> >                     new User("kay", "USER"), new User("pam", "") });
> > 
> >     /**
> >      * Construct.
> >      */
> >     public RolesApplication()
> >     {
> >             super();
> >     }
> > 
> >     /**
> >      * @see wicket.Application#getHomePage()
> >      */
> >     @Override
> >     public Class getHomePage()
> >     {
> >             return Example.class;
> >     }
> > 
> >     /**
> >      * @see wicket.ISessionFactory#newSession()
> >      */
> >     public Session newSession()
> >     {
> >             return new RolesSession(this);
> >     }
> > 
> >     @Override
> >     protected void init()
> >     {
> >             setSessionFactory(this);
> >             getSecuritySettings().setAuthorizationStrategy(
> >                             new RoleAuthorizationStrategy(new 
> > UserRolesAuthorizer()));
> > 
> > MetaDataRoleAuthorizationStrategy.authorize(AdminBookmarkablePage.class,
> > "ADMIN");
> >             
> > MetaDataRoleAuthorizationStrategy.authorize(AdminInternalPage.class,
> > "ADMIN");
> >     }
> > 
> > }
> > 
> > 
> > 
> > On Mon, 2007-06-25 at 17:24 +0900, David Leangen wrote:
> > > Hi (again) :-)
> > > 
> > > The docs for Pax Wicket explain authentication for Panels, but what
> > > about Pages?
> > > 
> > > I tried putting in some authentication in my PageFactory [1] but that
> > > didn't work as I hoped [2].
> > > 
> > > What is the expected mechanism for providing custom authentication logic
> > > for pages?
> > > 
> > > 
> > > Thanks!
> > > 
> > > [1] Relevant method of PageFactory for Page to be authenticated
> > > 
> > >     public Class<AdminBookmarkablePage> getPageClass()
> > >     {
> > >         final PaxWicketAuthentication auth = getAuthentication();
> > >         final Roles roles = auth.getRoles();
> > >         if( !roles.hasRole( null ) )
> > >         {
> > >             throw new
> > > UnauthorizedInstantiationException( AdminBookmarkablePage.class );
> > >         }
> > > 
> > >         return AdminBookmarkablePage.class;
> > >     }
> > > 
> > > 
> > > 
> > > [2] Error occurred from tracker when instantiating the Page from the
> > > registered PageFactory.
> > > 
> > > wicket.WicketRuntimeException: there is no session attached to current
> > > thread OSGi Console
> > >   at wicket.Session.get(Session.java:210)
> > >   at
> > > wicket.authentication.AuthenticatedWebSession.get(AuthenticatedWebSession.java:39)
> > >   at
> > > org.ops4j.pax.wicket.util.AbstractPageFactory.getAuthentication(AbstractPageFactory.java:119)
> > >   at
> > > com.bioscene.lucy.internal.AdminBookmarkablePageFactory.getPageClass(AdminBookmarkablePageFactory.java:35)
> > >   at
> > > org.ops4j.pax.wicket.internal.PaxWicketPageTracker.addingService(PaxWicketPageTracker.java:74)
> > > 
> > > 
> > > _______________________________________________
> > > general mailing list
> > > general@lists.ops4j.org
> > > http://lists.ops4j.org/mailman/listinfo/general
> > 
> > 
> > _______________________________________________
> > general mailing list
> > general@lists.ops4j.org
> > http://lists.ops4j.org/mailman/listinfo/general
> 
> 
> _______________________________________________
> general mailing list
> general@lists.ops4j.org
> http://lists.ops4j.org/mailman/listinfo/general


_______________________________________________
general mailing list
general@lists.ops4j.org
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to