Saturday, January 26, 2013

V7 - Vaadin 7 RC2 Guice and Shiro

Vaadin RC2

I have updated the code to Vaadin 7 release candidate 2, with no issues found.  There was a bug in beta 11 using Chameleon styles, but that is now fixed.

Testing

I've improved the test harness a bit - it pretends now to be a Shiro Web environment, so Shiro generates things like ShiroWebSubject correctly.  This allows a bit more testing within JUnit.

There is a bug in one of the tests - the LoginStatusPanelTest is not configured correctly - but testing is gradually improving overall.

Standard Pages

I have introduced the idea of standard "pages" for things like login, logout and others, to help with some of the Shiro logic.  It is still configurable, so any View could be used to create the "page".


The documentation is still some way behind, and the forum unused, but at least one person contacted me to say they had found it useful.  It is always good to get feedback ...






Sunday, January 13, 2013

Vaadin Guice and Shiro - done

Progress

I got there eventually - there is now a working version of the V7 code, which integrates Vaadin 7, Guice 3.0 and Apache Shiro 1.2. 

V7 supports the direct coding of interaction with Shiro, and also the use of Shiro annotations.  If you are not familiar with Shiro then it is worth taking a look.  It greatly simplifies one of those time-consuming development tasks - authentication and authorisation.

Path filtering

The one aspect I have not been able to integrate is the Shiro path filter to apply security according to the URL.  A great idea, and something which could greatly reduce maintenance, but clearly will not work with an AJAX application.

I need to do some more work on that ...

General code state  

I have done quite a bit to tidy up the code, especially for testing.  The test harness is reasonable now, and allows quite a bit of testing of the Vaadin UI, and also incorporates Shiro.

But pretty it is not!  I really have not done justice to Vaadin with the user interface, but just now I am more concerned about function.

Sadly, the documentation  has fallen behind a bit, but I have opened a forum for anyone interested. Comments at the forum, or on this blog would be welcome.




Sunday, December 30, 2012

Vaadin, Guice and Shiro

Formalising

Once I made some progress integrating Apache Shiro, I realised that what started as an experimental integration of Vaadin and Guice is becoming a rather more substantial project - something for me to use as a base for future applications, and maybe something others could use too.

So I have started formalising things a bit more.  I've started some documentation, partly to clarify my thoughts, but also to share with anyone who is interested.

The code is still in the same place, but I will start using a proper branching model so that the master branch becomes more stable  - until now I haven't been concerned about that.

Shiro

The integration is extremely rough at the moment, but it does demonstrate a login (hard-coded for now).   I think I will go for the URL based model provided by Shiro, provided I can get that to work with Vaadin.

Refactoring

I've done quite a bit of moving code around to try and separate what should be the base V7 reference, and the demo code

Friday, December 21, 2012

Vaadin 7 beta 11

Changes from beta 10

I noticed a couple of small changes from beta 10:

VaadinRequest parameters

The parameter names have changed.  I was using "loc" to return the location from Page, using a mocked VaadinRequest.  The parameter name has changed to "v-loc".  I notice the width and height parameters are now pre-fixed with "v-" as well.

Chameleon Button style

I was using the "big" style for buttons, but this no longer works, and neither does "small".   I've changed to using "tall" for now, and posted a question on the Vaadin forum

Tuesday, December 18, 2012

A working model

Well, I do have a working model now, and the code does most of what I wanted to do.  The disappointment was the amount of classes I had to override in order to get this working - caused mainly by the native Vaadin Navigator being a concrete class.

I've suggested to the Vaadin team that Navigator should be an interface to make things more flexible, and hopefully that will be taken up.

I also noted the recent post about CDI on the Vaadin forum - I probably should make sure that my effort aligns to CDI even if I don't use CDI directly.

Monday, December 10, 2012

Vaadin 7 Navigator with Guice

Following my earlier work, I started out thinking that I only had to make a few changes around the   Vaadin 7 Navigator to make it Guice friendly.

It seems that is not the case!

The standard Vaadin 7 Navigator class is very closely coupled to a number of other classes, and I have ended up developing a parallel navigation scheme.  It was not what I intended, but it will allow me to make more use of Guice functionality - which in most ways Vaadin is very well suited to, as it is a component based framework.

So - work is in progress.

Monday, December 3, 2012

Vaadin 7 navigation and parameters

The good bit

URI parameter handling

Adding handling for URI parameters to the sample app was straightforward, the new Vaadin 7 architecture makes it easy. 

Error View

Putting in an error view, to deal with invalid URIs was equally simple.

Appearances

I have tidied up the appearance of the app - it won't win any design prizes but it does look a bit better.  More importantly it demonstrates more clearly some of the basics I was trying to establish.


The Not So Good Bit

Concrete classes

The use of some concrete classes (as opposed to interfaces) in the navigation scheme is getting in the way of some options I would like to use with Guice.  The Navigator itself is a concrete class, with constructor parameters, and although it is possible to get round this it would have been much easier if there had been a Navigator interface, and say, a DefaultNavigator implementation.