Basic Security


In this Grails Example, we complete the ProjectTracker application by implementing basic security. Although this is not a comprehensive discussion on web application security, you learn how to create a login page that authenticates your users against the EndUser model, as well as how to add an interceptor method to your controllers that authorizes your end users before executing any additional methods in the controller. For a complete discussion on security, please see the information on the Spring Security Core Plugin.

Additional credit for content on this video comes from Scott Davis’ article: Mastering Grails: Authentication and Authorization.

23 thoughts on “Basic Security

  1. I am a little bit confused by the screencast.

    You recommend using the Spring Security Plugin, of course, what else.
    But you implemented a session based authentication with a lot of duplicated code.

    I don’t think the example if good, at least you should have action filters/parent controller for *all controllers* to handle the session checks and redirect appropriately.
    You should have gone straight to the Spring plugin.

  2. Amazing tutorial! Thank you so much for creating this.

    One thing, I’m on a mac and didn’t setup the bin director on my path so typing out commands to generate files got tiring 1/2 way though the first one.

    Instead:
    Right Click on the Model File
    Select the New Menu
    Select one of the generate options about 1/2 way down the menu

    You can generate controllers, controllers and view or just views!

    I’m using Grails 2.1.0 and STS 2.9.2, maybe this feature wasn’t available in 2.0?

    • Sean – Thanks for that feedback. When I recorded the install videos, I didn’t want to mess with system variables on OSX and Linux, since there are different shells that people use. I didn’t think it would be a big deal since Eclipse would keep track of everything, but then as you said, we come to that section on scaffolding. Another viewer showed me how to generate scaffolding from within Eclipse, which I think I will do when I redo that video. I am also going to redo all the installation videos for Grails 2.1 and I plan on showing how to set system variables for all three operating systems to make it a more complete setup.

      ~Mike

  3. If you think what can be next I suggest to cover integration with Apache Camel (as ESB layer, JMS messages, queues and so on..) and work with Web services. Services in Grails can be one topic also.

  4. Thanks a lot Mike!
    You did it step-by-step from beginning and all touched topics are clear so far.
    Whatever you do next I certainly want to try it out with Grails in my machine as well.

  5. Hi Mike, these videos are great and very helpful. Can you please demonstrate login and settings for multiple databases. For example,
    1. Login that needs “Company”, “user id” and “password” information.
    2. Based on the “company”, that company’s database will be used during the session.
    3. All companies will have the same database structure.

    I think multi-tenant architecture is quite common for SaaS applications.
    I also checked multi-tenant plugin documentation, but it didn’t cover how to integrate it with login.

    Thank you so much

  6. Im just starting with groovy on grails and those tuts save my LIFE!!!..
    keep going!!!.

    I will be waiting for more videos!.
    Do u have any about AJAX with grails?

    Thanks so much

    • Thanks Miguel, glad they were helpful. I don’t have anything on AJAX at the moment. I’ll keep it in mind though.

      • Great stuff, glad you starting to like Java, Netbeans is cool, I use it wneeevhr I have to develop an application in Java, except I havent tried Ruby on Rails or Groovy, but will try it out soon

  7. Hope you have more coming. I am done with the basic stuff and would prefer now to move on to more complex ones that can deal with enterprise integration issues.

    Also – I loved the font you used. It is really nice and crisp – can you share that info?

  8. Awesome set of tutorials. High quality work. You are to be commended for this accomplishment.

    I would love to see more from you about the Spring Security Core Plugin.

    Thank you very much for your work on this!

    –Reuben

  9. Hi Mike,

    Great videos. I find them very helpful.

    Are you planning to do anymore over the next month or two?

    • Thanks Myles. I may get one or two more done. I am working on another course for the blog that I will be releasing all at once as soon as it is finished. Are there any topics you are interested in for which you would like to see a video?

      • Mike! Thank for your tuts. I interested how use some popular api`s like Twitter API or youtube API. Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>