This Week in Grails (2012-03)

Monday, January 23rd, 2012 8:53am

You only have a few more weeks to get your talk proposals in for GR8Conf EU and US. The EU page is here and the US page is here; both conferences have a February 15th deadline.

Lots of Spring Security items this week. I broke war deployment in the spring-security-core 1.2.7 release so I released version 1.2.7.1 to address that. There’s a new plugin to integrate a Shibboleth native SP, and one for mock authentication. And Carsten Block did a blog post on restricting concurrent user sessions (also see the updated post).

Check out Tsuyoshi Yamamoto’s summary of the Groovy & Grails eXchange 2011 in London. Lots of cool photos, including one of the three developers of the Acegi plugin – it was the first time we were all in the same place together.

I released a new plugin this week to help with deploying applications to JBoss. Each version of JBoss has various things that need to be done to get an app deployed, so I thought it’d be best to encapsulate that in a plugin that does the work for you. It works with version 5 and 6, but no support for version 7 since there isn’t one that supports Grails yet (due various bugs that will hopefully be addressed in 7.2).


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 4 new plugins released:

and 14 updated plugins:

  • build-info version 1.2.2. Provides a controller/view that display basic information about the war file
  • clover version 3.1.3. Integrates the Clover code coverage tool
  • commentable version 0.7.7. Mark up any of your domain classes as having comments and then use the tag library and partial templates to integrate comments into your views
  • dao-artefacts version 0.4. Provides a way of using DAOs in Grails applications.
  • external-config-reload version 0.4.8. Polls for changes to external configuration files (files added to grails.config.locations), reloads the configuration when a change has occurred, and notifies specified plugins by firing the onConfigChange event in each
  • hibernate-search version 0.4. Integrates Hibernate Search for domain classes
  • infinispan version 0.4.5. Adds support for the JBoss Infinispan distributed cache
  • jasypt-encryption version 1.1.0. Integration the Jasypt encryption library
  • mahout-recommender version 0.5.2. Use Apache Mahout recommendation algorithms in your project
  • marshallers version 0.1.1. Easy registration and usage of custom XML and JSON marshallers supporting hierarchical configurations
  • pusher version 0.2. Wrapper for pusher.com REST api
  • simpledb version 0.3. Integrates the AWS SimpleDB datastore into Grails, providing a GORM API onto it
  • spring-security-core version 1.2.7.1. The official Grails security plugin; integrates with Spring Security
  • spring-security-mock version 1.0.0. Mock authentication support for Spring Security

Interesting Tweets

Jobs



User groups and Conferences


Share

This Week in Grails (2012-02)

Tuesday, January 17th, 2012 11:40am

Gr8Conf Europe announced a new look this week for their site (based on Weceem) and that their Call for Papers is open. If you want to speak in Copenhagen be sure to get your proposals in by the February 15th deadline.

The plugin portal got a few new features recently. Plugin pages now display the syntax for declaring the plugin in BuildConfig.groovy instead of using install-plugin. For example the spring-security-core plugin’s value is compile ":spring-security-core:1.2.7". Plugins that use extra jar repositories also display that information, for example spring-mobile. Plugins now display usage data (although it’s limited so the numbers aren’t very valid yet). The spring-security-core plugin displays “Used by approximately 35% of Grails users”.

Peter’s started a project to collect HOWTO guides for Grails. Hopefully this will evolve into a large collection, created both by the core team and the community.

Bobby Warner is back this week with two screencasts, both on CoffeeScript. Check out
Getting Groovy with CoffeeScript and Another Adventure with Grails and CoffeeScript.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 4 new plugins released:

  • foundation version 2.1.4.1. Provides the Foundation CSS framework resources
  • fbootstrapp version 0.1.1. Provides FBootstrapp CSS framework resource files
  • spring-security-mock version 0.9.8. Mock authentication support for Spring Security
  • jquery-mobile-scaffolding version 0.1. Provides mobile templates that can be used during the scaffolding process

and 21 updated plugins:

  • atmosphere version 0.4.2. Provides integration with the Atmosphere project, a portable AjaxPush/Comet and WebSocket framework
  • bubbling version 2.1.4. Provides integration with the Bubbling Library YUI extension
  • build-info version 1.2.1. Provides a controller/view that display basic information about the war file
  • commentable version 0.7.6. Mark up any of your domain classes as having comments and then use the tag library and partial templates to integrate comments into your views
  • cucumber version 0.2.2. Test your Grails apps with Cucumber
  • dao version 0.4.2. Enables a grails-app/dao directory to setup beans. See https://github.com/basejump/grails-dao
  • dojo version 1.7.1.3. Integrates the Dojo javascript toolkit
  • excel-import version 1.0.0. Excel & CSV Importer & Exporter using Apache POI
  • facebook-sdk version 0.1.2. Allows your application to use the Facebook Platform and develop Facebook apps on Facebook.com or on web sites (with Facebook Connect)
  • geolocation version 0.4. Adds HTML5 geolocation support and offers some utility methods to calculate distances and range checks
  • gorm-jpa version 1.0.0.M1. Implementation of GORM for JPA 1.0
  • grails-ui version 1.2.3. Provides a standard UI tag library for ajaxy widgets using YUI
  • hibernate-jpa-provider version 1.0.0.M1. Integrates Hibernate as a JPA provider
  • jasper version 1.5.1. Enables use of JasperReports
  • jquery-validation-ui version 1.2.3. Client Side Validation without writing JavaScript
  • rateable version 0.7.1. Adds a generic mechanism for rating domain objects
  • release version 1.0.1. Publishes Grails plugins either to a public or private repository
  • routing version 1.1.6. Send and route messages to a wide variety of destination endpoints directly from your Controllers and Services using Camel
  • screencasts version 0.5.6. Allows the upload, management and display of screencasts
  • svn version 1.0.2. Provides SVNKit as a dependency; an SvnClient class that makes it easier to work with Subversion; and integration with the Release plugin
  • uploadr version 0.5.8. HTML5 Drag and Drop file uploader

Interesting Tweets

Jobs



User groups and Conferences


Share

“What’s New In Grails 2.0″ at NEJUG

Friday, January 13th, 2012 12:10am

I gave a talk at NEJUG tonight on the new features in Grails 2.0, with some coverage of the new features in Groovy 1.8 and a live coding demo of the “Twitter in 40 minutes” application. Many thanks to the organizers for the invitation, Constant Contact for hosting, and to the attendees for the great questions and enthusiasm.

You can download the talk slides here and the completed demo application here.

To see the earlier recorded talks that I based mine on check out Peter Ledbrook’s screencast of the new 2.0 features and Guillaume’s talk at Greach on Groovy 1.8.

Share

This Week in Grails (2012-01)

Monday, January 09th, 2012 10:38pm

Graeme updated his blog and has committed to posting more often – check out the new digs.

Bobby Warner’s published a great screencast this week on using Grails 2.0 and Spring Security – Jump Into Grails 2.0

Jochen Theodorou wrote up an in-depth overview of the invokedynamic API. I think I may need to read this one a couple of times before it sinks in :)


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 4 new plugins released:

  • jxl version 0.5. Export data to Excel using the JXL library
  • swiss-post-code version 0.1.2. Provides all available Swiss post codes
  • ajax-proxy version 0.1.1. Ajax Proxy Plugin (for cross-domain requests)
  • facebook-sdk version 0.1.1. Allows your application to use the Facebook Platform and develop Facebook apps on Facebook.com or on web sites (with Facebook Connect)

and 13 updated plugins:

  • asynchronous-mail version 0.3. Send email asynchronously by storing them in the database and sending with a Quartz job
  • audit-trail version 2.0.0. Adds created/updated audit fields to domain classes and updates them after a new insert or update
  • bulkload version 0.1.4. Export or bulkload all the instances of a given class from the client browser
  • compass-sass version 0.6. Compass, SASS and SCSS support for Grails. Automatically compiles .scss/.sass during run-app, and adds other framework functionality
  • cucumber version 0.2.1. Test your Grails apps with Cucumber
  • cxf-client version 1.2.5. Use existing (or new) Apache CXF wsdl2java generated content to invoke SOAP services
  • date-formatting version 0.2.3. Adds functions to the Date object to convert into various string formats
  • facebook-graph version 0.14. Provides access to the Facebook Graph API and makes easier the development of a single sign-on using the Facebook Authentication proposal.
  • jasper version 1.3.0. Enables use of JasperReports
  • routing version 1.1.5. Send and route messages to a wide variety of destination endpoints directly from your Controllers and Services using Camel
  • routing-jms version 1.1.5. JMS integration for the grails-routing plugin
  • translate version 1.2.1. Translates text from one language to another using the Google Translate API
  • uploadr version 0.5.7. HTML5 Drag and Drop file uploader

Interesting Tweets

Jobs



User groups and Conferences


Share

This Week in Grails (2011-52), and the year in review

Tuesday, January 03rd, 2012 9:25am

Happy new year! This is the final “This Week in Grails” for 2011. I went back through the previous 51 posts and counted up the totals for what I’d posted throughout the year (including this week): there were 840 miscellaneous items, 693 tweets, 888 Jobs (including several reposts), and 167 new plugins (only 3 weeks without a new plugin) and 724 plugin updates. I didn’t count meetup listings because I repeated most of them several times.

It was an interesting year for the Grails/Groovy ecosystem:

  • Grails had its final 1.3 release (1.3.7) and the big one, 2.0
  • There were four Groovy 1.7.x releases (1.7.7-1.7.10) and six 1.8.x releases (1.8.0-1.8.5) along with beta releases of 2.0 (currently at Beta 2)
  • Gradle also had several milestone releases and is getting close to a 1.0 beta and final 1.0 release
  • There were several Groovy++ releases, although development seems to have stalled given that Groovy code is getting static features
  • SpringSource Tool Suite had several releases, 2.5.2, 2.6.0, 2.6.1, 2.7.0, 2.7.1, 2.7.2, 2.8.0, and 2.9.0.M1 and the Groovy-Eclipse plugin also had several; both added tons of cool new features to help Groovy and Grails development
  • Grails now has excellent options for deployment to various cloud providers thanks to the aws (Amazon), cloud-foundry, cloud-bees, and heroku plugins
  • Marco Vermeulen created Ubuntu packages for Grails and Groovy
  • Stéphane Maldini and Damien Vitrac reworked the look and feel of the reference docs
  • We migrated JIRA from Codehaus to http://jira.grails.org/ and now each plugin has its own project instead of being a component in one huge project
  • Erik Pragt and Marcin Erdmann did some very cool stuff to get Groovy working in Android with their discobot project. I’m looking forward to seeing more of that
  • We now have the “This week in Spring”, “This week in Gradle”, and the occasional “This week in Discobot” series

There were nine conferences that were entirely based on the Groovy ecosystem or had multiple related talks:

  • Spring IO in Madrid
  • GR8Conf Europe in Copenhagen
  • GR8Conf US in Minneapolis
  • GeeCON 2011 in Krakow
  • SpringOne/2GX in Chicago
  • Greach in Madrid
  • CamelCaseCon in Düsseldorf
  • GR8Conf Australia in Canberra
  • Groovy & Grails eXchange in London

Lots of cool posts from a few notable bloggers: Mr Haki (http://mrhaki.blogspot.com/), Tomas Lin (http://fbflex.wordpress.com/), Bobby Warner (http://www.bobbywarner.com/), and Jochen Theodorou (http://blackdragsview.blogspot.com/). I won’t highlight anything in particular – just go to their blogs and read everything :) Set aside extra time for Mr Haki though; he’s done approximately one million posts so far.

I released 10 new plugins:

  • database-migration
  • spring-security-kerberos
  • spring-security-appinfo
  • cloud-foundry
  • cloud-foundry-ui
  • standalone
  • memcached
  • cloud-support
  • atomikos
  • heroku

(11 if you count reworking the webxml plugin and adding a new feature for filter-mapping element sorting).

This series is now translated into Spanish (Aitor Alzola), Chinese (Jian Hu), Portuguese (Paulo Pereira), and Italian (Luca Canducci). These guys do a great job every week.

If 2011 is any indication of the future, 2012 will be a very good year to be a Grails developer.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 2 new plugins released:

  • stripe version 1.0.M6. Use Stripe to process credit card transactions
  • quartz2 version 0.2.2. Integration with Quartz 2 framework from quartz-scheduler.org

and 18 updated plugins:

  • activiti version 5.8.2. Integrates the Activiti BPM Suite and workflow system
  • activiti-spring-security version 0.4.6. Integrates Spring Security to Activiti as custom IdentityService
  • ajax-uploader version 1.0. Tag Library which implements Andrew Valum’s excellent file uploader
  • browser-detection version 0.3.3. Provides a service and tag library for browser detection
  • bulkload version 0.1.2. Export or bulkload all the instances of a given class from the client browser
  • cloud-foundry version 1.2.1. Integrates Cloud Foundry’s cloud deployment services to manage the running of Grails applications in the cloud from the command line
  • cxf-client version 1.2.4. Use existing (or new) Apache CXF wsdl2java generated content to invoke SOAP services
  • jasypt-encryption version 1.0.1. Integration the Jasypt encryption library
  • oauth-scribe version 1.3. Provides oAuth integration for Grails, using the Scribe framework
  • quick-input version 0.1.2. Provides new input tags supporting some mass input capabilities
  • rabbitmq version 0.3.3. Integrates with Rabbit MQ messaging
  • routing version 1.1.4. Send and route messages to a wide variety of destination endpoints directly from your Controllers and Services using Camel
  • routing-jms version 1.1.4. JMS integration for the grails-routing plugin
  • spring-security-core version 1.2.7. The official Grails security plugin; integrates with Spring Security
  • spring-security-facebook version 0.5.4. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • spring-security-radius version 1.1.1. RADIUS support for the Spring Security plugin
  • twitter-bootstrap version 1.4.0.14. Twitter Bootstrap CSS framework resource files
  • viaboxx-dbmigrate version 1.3.2. Setup and migrate the database of your project

Interesting Tweets

User groups and Conferences


Share

This Week in Grails (2011-51)

Tuesday, December 27th, 2011 10:37am

This week was a bit quieter than last – it’d be hard to top the release of Grails 2.0. Things seem to be going very well with a few bumps, and the consensus seems to be that people are psyched about the new release.

The Groovy team released Groovy 1.8.5 and 2.0 Beta 2. Looks like Invoke Dynamic support, Static Type Checking and initial work on static compilation are coming along.

If you’re in the Boston area, I’ll be doing a talk at NEJUG on January 12th on what’s new in Grails 2.0 and Groovy 1.8.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 3 new plugins released:

  • feature-toggle version 0.1. The feature toggles plugin provides Tag Libraries and dynamic methods to implement configurable features
  • mahout-recommender version 0.5.1. Use Apache Mahout recommendation algorithms in your project
  • quick-input version 0.1.1. Provides new input tags supporting some mass input capabilities

and 16 updated plugins:

  • activiti version 5.8.1. Integrates the Activiti BPM Suite and workflow system
  • address-lookup-zpfour version 0.1.2. Provides address lookup service and tags so you can easily add address lookups to your web app if you have a ZP4 HTTPSERV service from Semaphore corp running on your network
  • browser-detection version 0.3.2. Provides a service and tag library for browser detection
  • bulkload version 0.1.1. Export or bulkload all the instances of a given class from the client browser
  • cloud-bees version 0.5.4. Adds scripts to integrate with the CloudBees client API
  • constraints version 0.7.0. Allows you to create custom domain Constraints for validating Domain objects
  • geb version 0.6.2. Geb is a library for headless web browsing on the JVM, suitable for automation and functional web testing
  • greenmail version 1.3.1. Provides a wrapper around GreenMail and provides a view that displays ‘sent’ messages – useful for testing
  • joda-time version 1.3.1. Integrates the Joda Time date/time library into Grails
  • mail version 1.0. Send email from your application
  • modernizr version 2.0.6. Provides the Modernizr Javascript library resource files from http://www.modernizr.com/
  • new-doc version 0.3.2. A backport of the additional functionality offered in the doc command in Grails 2.0.x
  • sanitizer version 0.7.1. Sanitizes markup(HTML, XHTML, CSS) using OWASP AntiSamy Filters
  • spring-security-facebook version 0.5.3. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • spring-security-saml version 1.0.0.M10. SAML 2.x support for the Spring Security Plugin
  • struts-menu version 1.2.1. Basic Grails wrapper for Struts Menu

Interesting Tweets

Jobs



User groups and Conferences


Share

This Week in Grails (2011-50)

Tuesday, December 20th, 2011 3:30am

The big news this week was the release of Grails 2.0. It took longer than expected since we were waiting on the final release of Spring 3.1 but it’s finally out and the response has been great so far. There are a ton of cool new features, usability improvements and fixes. Check out Peter’s screencast on the new usability features.

We also announced support for deploying Grails applications on Heroku. The heroku plugin makes it simple to deploy a 1.3.7 or 2.0 app that auto-reconfigures your settings for the DataSource, Mongo, Redis, Memcached, and RabbitMQ depending on which services are provisioned for the application.

STS 2.9.0.M1 was released along with Groovy-Eclipse 2.6.0. Check out the New and Noteworthy features – it’s a long list.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 5 new plugins released:

  • bulkload version 0.1. Export or bulkload all the instances of a given class from the client browser
  • sendgrid version 0.1. Allows the sending of Email via SendGrid’s services
  • spring-security-radius version 1.0.0. RADIUS support for the Spring Security plugin
  • heroku version 1.0. Integrates Heroku’s cloud platform
  • raphael version 2.0.1. Provides the JavaScript Vector Library Raphaël – cross-browser vector graphics the easy way

and 18 updated plugins:

  • build-test-data version 1.1.2. Enables the easy creation of test data by automatic inspection of constraints
  • cloud-bees version 0.5.2. Adds scripts to integrate with the CloudBees client API
  • cloud-support version 1.0.8. Support plugin to help cloud plugins update service provider connection information from the cloud environment
  • csv version 0.3.1. Easily parse and consume comma-separated values (CSV) from a number of input sources
  • memcached version 1.0.3.2. Helps integrate Memcached as the Hibernate 2nd-level cache provider
  • mongodb version 1.0.0.RC3. Aims to provide an object-mapping layer on top of MongoDB
  • redis version 1.1. Provides integration with a Redis datastore
  • redis-gorm version 1.0.0.M8. Integrates the Redis key/value datastore into Grails, providing a GORM-like API onto it
  • release version 1.0.0. Publishes Grails plugins either to a public or private repository
  • remote-control version 1.2. Execute code inside a remote Grails application
  • remote-pagination version 0.2.8. Provides tags for pagination and to sort columns without page refresh using Ajax and loads only the list of objects needed
  • resources version 1.1.6. A resource management and processing framework
  • riak version 1.0.0.M4. GORM for the Riak NoSQL datastore
  • spring-security-facebook version 0.5. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • svn version 1.0.1. Provides SVNKit as a dependency; an SvnClient class that makes it easier to work with Subversion; and integration with the Release plugin
  • translate version 1.2. Translates text from one language to another using the Google Translate API
  • twitter-bootstrap version 1.4.0.13. Twitter Bootstrap CSS framework resource files
  • uploadr version 0.5.6. HTML5 Drag and Drop file uploader

Interesting Tweets

Jobs



User groups and Conferences


Share

This Week in Grails (2011-49)

Tuesday, December 13th, 2011 8:00am

This week’s big event was the 5th annual Groovy & Grails eXchange at Skills Matter in London. With two tracks and over 20 talks there was a lot going on, and having concurrent tracks meant making some touch choices in a couple of slots about which talk to attend. But luckily Skills Matter is great about recording talks and were cranking them out in record time – announcing most published talks during the session that followed them. Click through to the talk abstracts in the conference schedule to get to each of the videos.

Next year’s conference has already been announced; it will be December 12th and 13th. The first 50 tickets are only £95, so what are you waiting for?

My talk was an intermediate/advanced Spring Security plugin talk – see it here and check out the corresponding blog post for the slides and sample application.

Like any conference there was a lot of Twitter activity; here are some of the ones I found interesting:

p.s. this is the 1st anniversary of the beginning of this series – I know it’s trite to say, but I can’t believe it’s been a year already.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There was 1 new plugin released:

  • marshallers version 0.1. Easy registration and usage of custom XML and JSON marshallers supporting hierarchical configurations

and 9 updated plugins:

  • cloud-bees version 0.5. Adds scripts to integrate with the CloudBees client API
  • dojo version 1.6.1.3. Integrates the Dojo javascript toolkit
  • jquery version 1.7.1. Integrates jQuery
  • proxool version 0.9.1.5. Proxool jdbc connection pool plugin
  • redis version 1.1. Provides integration with a Redis datastore
  • resources version 1.1.4. A resource management and processing framework
  • viaboxx-dbmigrate version 1.3.1. Setup and migrate the database of your project
  • webxml version 1.4.1. Add additional features to your web.xml, such as Filters, Config Listeners or Context Parameter definitions
  • weceem version 1.1.2. A content management system

Interesting Tweets

Jobs



User groups and Conferences


Share

“Hacking the Grails Spring Security Plugin” at Groovy & Grails Exchange

Friday, December 09th, 2011 6:34am

I gave a talk at the Groovy & Grails Exchange in London called “Hacking the Grails Spring Security Plugin”. I didn’t want to spend a lot of time discussing the sample app code since there was a lot of material to cover, so I’m making the code available here with a brief discussion of the implementation.


To support a custom login where the user’s organization must be specified in addition to the standard username and password, there’s a custom AuthenticationProvider (hacking.extralogin.auth.OrganizationAuthenticationProvider) which processes a subclass of UsernamePasswordAuthenticationToken (hacking.extralogin.OrganizationAuthentication) that adds an organizationName property, and a filter (hacking.extralogin.ui.OrganizationFilter) that creates the authentication from the request and initiates authentication.

In this example all authentication uses this approach, so the filter replaces the standard "authenticationProcessingFilter" bean (and subclasses the plugin’s RequestHolderAuthenticationFilter to maintain its functionality) and the provider replaces the "daoAuthenticationProvider" bean. The provider directly implements the AuthenticationProvider interface since using GORM directly is simple enough to not need to delegate to a UserDetailsService or other helper classes.

You can see the bean registrations for the filter and provider in grails-app/conf/spring/resources.groovy.

Note that the auth provider and filter are in separate packages to reinforce the idea that auth providers shouldn’t be aware of the UI. The filters that call the auth providers create an Authentication instance with all of the information that’s needed to authenticate, getting most or all of the data from the HTTP request. This keeps the auth providers modular and reusable outside of a web application.

No changes are required for the generated User, Role, or UserRole classes, but a new domain class Organization is needed to store the organization names, and OrgUser is needed to provide a link between users and organizations. auth.gsp has an extra input, a <select> box with all available Organization names.

If you request http://localhost:8080/hacking_london/secure you should see the text “not secured” since the index action is not guarded. But navigating to http://localhost:8080/hacking_london/secure/admin requires a user with ROLE_ADMIN, http://localhost:8080/hacking_london/secure/user requires a user with ROLE_USER, and http://localhost:8080/hacking_london/secure/adminOrUser requires a user with either ROLE_ADMIN or ROLE_USER. You can use one of the users created in BootStrap.groovy:

username Organization name password Role
admin Org1 password ROLE_ADMIN
user Org2 password ROLE_USER
disabled Org1 password ROLE_USER

There’s an extra user (“disabled”) with a disabled account to test that login fails with a correct username, org name, and password.

We also need to tweak an error message. The plugin’s i18n message bundle will display the error “Sorry, we were not able to find a user with that username and password” if the username, password, or organization are wrong. But we should include the organization in the message to indicate that it might have been wrong. To fix this, add this line to your application’s grails-app/i18n/messages.properties: springSecurity.errors.login.fail=Sorry, we were not able to find a user with that username, organization, and password.

To test this, log in as user ‘user’ with password ‘password’ but leave the organization name selected as ‘Org1′.

Note that since we’re not using the plugin’s UserDetailsService or Spring Security’s DaoAuthenticationProvider we don’t need the grails.plugins.springsecurity.userLookup.userDomainClassName, grails.plugins.springsecurity.userLookup.authorityJoinClassName, or
grails.plugins.springsecurity.authority.className properties added to Config.groovy by the s2-quickstart script. They’re commented out so you can switch back to the standard authentication approach by removing or commenting out the bean overrides in resources.groovy and the organization select box in auth.gsp.


The other significant customization I discussed was doing a custom post-logout redirect. It is possible to specify a spring-security-redirect request parameter when logging out, but this is too coarse an approach in general. If you need to use logic specific to the user, or something about the current authentication state, you need more control. So the sample application subclasses the default implementation of LogoutSuccessHandler, SimpleUrlLogoutSuccessHandler with hacking.logout.CustomLogoutSuccessHandler and registers it as the logoutSuccessHandler bean in resources.groovy.

The logic is contrived; if you’re in Organization ‘Org1′ you’re redirected to ‘http://yahoo.com’ and if you’re in Organization ‘Org2′ you’re redirected to ‘http://google.com’. Otherwise you’re redirected to the default location (‘/’ unless you’ve customized it with the grails.plugins.springsecurity.successHandler.defaultTargetUrl config attribute). But it shows an example of how you could use your own business logic to make a similar decision.

There’s one wrinkle here though; the only parameters for the overridden determineTargetUrl method are the HttpServletRequest and HttpServletResponse, but not the Authentication. And since this is the last step of the logout process, the user has already been logged out and the Authentication isn’t available from the request, springSecurityService, SecurityContextHolder, etc. But the public method (onLogoutSuccess) that calls this method has a parameter for the Authentication, so we save it in a ThreadLocal so it’s available for our override.


You can get the PDF of the presentation here, and the zip of the sample project here.

Share

This Week in Grails (2011-48)

Monday, December 05th, 2011 5:09am

There were some blocking issues in the 2.0 RC2 release, so we released RC3 on Friday. Please test this release – a lot of issues have been fixed and we’d like to make sure the 2.0 final release is as stable as possible.

Marc Palmer and I had some fun this week releasing and re-releasing the resources and spring-security-core plugins. Both plugins add filters to web.xml that need to be in particular positions, and if both were installed they would interfere with each other. So I added a feature to the webxml to handle filter-mapping reordering. There were some issues along the way but the latest versions should work well together.

If you haven’t gotten your ticket yet for the Groovy & Grails eXchange time is running out – it’s this week! I’ll be doing a new talk, “Hacking the Spring Security Plugin”, which will go into the details of how the plugin works and approaches you should use to customize its behavior and debug issues.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were no new plugins released but 18 updated:

  • activiti version 5.8. Integrates the Activiti BPM Suite and workflow system
  • browser-detection version 0.3.1. Provides a service and tag library for browser detection
  • console-enhancements version 0.5. Enhances the grails console output for better visibility
  • cxf-client version 1.2.3. Use existing (or new) Apache CXF wsdl2java generated content to invoke SOAP services
  • gemfire version 1.0.0.M5. The GemFire plugin provides integration with the GemFire in-memory distributed data management platform.
  • grails-melody version 1.10. Integrates the JavaMelody system monitoring tool
  • gwt version 0.6.1. Incorporates GWT into Grails
  • mongodb version 1.0.0.RC2. Aims to provide an object-mapping layer on top of MongoDB
  • mongodb-morphia version 0.7.6. Alternative MongoDB GORM based on the Morphia library (former gorm-mongodb)
  • remote-pagination version 0.2.7. Provides tags for pagination and to sort columns without page refresh using Ajax and loads only the list of objects needed
  • resources version 1.1.3. A resource management and processing framework
  • rich-domain version 1.0.5. Provides dependency injection for POGOs that are not Grails domain classes
  • routing version 1.1.2. Send and route messages to a wide variety of destination endpoints directly from your Controllers and Services using Camel
  • spring-security-core version 1.2.6. The official Grails security plugin; integrates with Spring Security
  • spring-security-facebook version 0.4. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • spring-security-saml version 1.0.0.M9. SAML 2.x support for the Spring Security Plugin
  • uploadr version 0.5.5. HTML5 Drag and Drop file uploader
  • webxml version 1.4. Add additional features to your web.xml, such as Filters, Config Listeners or Context Parameter definitions

Interesting Tweets

Jobs



User groups and Conferences



Share

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.