Sam van de Kreeke
Last updated: 27-08-2020
For this HowTo we'll create a new model named WebUser, but you can use every model you'd like for your authentication profile, as long as it has at least one unique, identifying property.
Let's say you want your customers to be able to order some nice products from your webshop. You'd probably identify them by an email address and a password. In that case you'll need:
Let's get started!
Head over to the Data Model of your application by clicking the Data Model icon in your builder bar, and create a new model. You can call it whatever you want, but simply calling it WebUser is the best practice for most applications. Create properties for an email address and a password. Be sure to give the properties their proper type. You don’t want to be storing passwords in plain text!
That's it for the Data Model, the first of three steps!
Create an authentication profile, matching your web user model.
Next up is creating the authentication profile for your web user.
If you've got no idea what you're doing here, take a look at What are Authentication Profiles. That will explain everything about the settings of an Authentication Profile.
As you can see, we've connected the page at /login to the authentication profile. If you don't have a login page yet, no worries. Choose a different endpoint, create a login page, and edit the authentication profile accordingly afterwards.
To learn how you can create a nice login page, take a look at HowTo create a login page using the UI Builder's grid system.
If you're all set on this, the only thing left to do is to connect the authentication profile to the page on which you want to use authentication.
When you want your entire website to require a login to access, setting the authentication profile for every single page can be quite a tedious task. That's why you can also select an authentication profile for an entire page group!
In this form you can set up your new page group by giving it a name, optionally giving it a prefixed path, and why we're here: an authentication profile.
All pages in this group will now have an extra, already checked checkbox option in their page settings: 'Inherit authentication profile'. This means these pages inherit the authentication profile of the group they’re in!
If you've got a page on which you don't want the authentication, but do want in this group, no worries! Just open the page's settings and uncheck this option.
This type of inheritance can also be applied to nested page groups. If you create another page group inside this page group, you'll have the option to inherit the authentication profile from the parent.