Logging In
Before we get into creating filters and building our security system, let’s talk about what we want the system to do. First, we want to know who is currently using the system; that is, are they an anonymous user (which is fine), or are they represented by a TekUser instance? Next, we want to restrict access to certain areas of the application based on the current user. For example, only organizers should be able to edit a TekEvent instance, and only organizers or volunteers should be able to participate in the event’s forum.
For the first step, we will need some sort of login process. We will create two new actions in the TekUserController: login and logout. We will also create a new login view.
Open TekDays/grails-app/controllers/com/tekdays/TekUserController.groovy ...
Get Grails 2: A Quick-Start Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.