Skip to content

Getting started with User Authentication

To get started with user authentication, you'll need to add the appropriate authorization middleware to your panel, create and register a user model, and mark your panel as authorized.

Creating a user model

Internally, Iridium's permissions system operates over a IUser interface. You need to create or update an existing User model that implements this interface and register it with Iridium.

IUser interface

go
type IUser interface {
    GetId() string
    GetEmail() string
    GetPasswordHash() string
}

Create a new user model

go
type User struct {
    Id uint
    Email string
    PasswordHash string
}

You'll need to register your type somewhere in Iridium's initialization logic so we can properly recreate and pass you back your custom user model throughout the application

go
// Where User is your custom User struct
auth.RegisterUserType[User]()

Released under the MIT License.