Skip to main content

User Mapping

  • Map User Table:
    • Identify which table in your database stores user accounts.
    • Map the key columns required for authentication: a unique ID column, an email (or username) column, and a password column containing hashed passwords.
    • Passwords must be stored hashed; SWAIN never requires plain‑text passwords.
    • You can also map additional fields like name or profile attributes.
  • Map Roles and Permissions (if using RBAC):
    • Define which tables represent roles and permissions and how they relate to users.
    • Map the relationships between users, roles, and permissions so the platform can enforce access control.
  • Map Session / Refresh Tokens:
    • Provide a session table with columns such as id, userId, refreshToken, expiresAt, and lastUsed to enable refresh token flows.
  • Map API Keys (optional, for server‑to‑server or SDK access):
    • Create an API keys table with columns like id, userId (or accountId), key, createdAt, and revokedAt (nullable).
    • Mapping this table enables issuing and revoking API keys for users or tenants.
  • Map Social Profiles (optional):
    • If you enable social login, map a social profile table that links external provider IDs to your users.
  • Accurate mapping ensures SWAIN knows how to read and write user‑related data for authentication, authorization, session management, and API key management.