Skip to content
  • Our Product
    • Namazu Elements
      • What is Elements?
      • Why open source?
      • Docs
        • Elements in Five Minutes or Less
        • RESTful APIs Library
        • Security Model
        • Accessing the Web UI (CMS)

    Our Product

    A logomark with three layered rhombuses adorning the lettermark that says Elements in bold all-caps sans-serif letters.
    • What is Namazu Elements? Discover our easy-to-use backend network solution built for online games. Rapidly enables full-scale multiplayer games or online solo adventures.
    • Why open source? Is there a truly open source server backend for connected games? There is now. Download and run a local copy of Namazu Elements and try it for yourself.
    Download Namazu Elements

    Get started

    • Quick start Read our Elements 5-minute quick start guide
    • Documentation Read our developer docs for learning more about Elements
    • RESTful APIs A full list of core API specs for working with the Elements framework
    • Security An overview of the server-authoritative security model of Elements
    • Accessing the CMS Manage your game with ease via the Namazu Elements CMS.

    Co-development Reimagined

    • Reduce your costs Would you rather outsource your backend development? Hire Namazu Studios to build your server backend with the power of Namazu Elements.
      Co-dev

    Recent Posts

    • The watercolor-styled Namazu Studios logo over a giant namazu lurking in the depth
      Namazu Studios Featured in San Diego Business Journal
      22 Sep 2025 Press
    • Namazu Elements 3.1 Released – Service Layer Fixes, Secure APIs, and Steam Bug Fix
      22 Apr 2025 Release Notes
  • Case Studies
  • About Us
  • News
  • Services
  • Book a call
namazu-studios-logo
Book a call

Getting Started

  • Elements in Five Minutes or Less
  • 🐧Ubuntu Linux Setup
  • 🍎 Mac OS Setup
  • 🖥️ Setup for Windows
  • Accessing the Web UI (CMS)
  • General Concepts
  • N-Tier Architecture
  • Security Model

Namazu Elements Core

  • User Authentication / Sign In
    • What is a User?
    • User Authentication in Elements
    • Auth Schemes
      • Auth Schemes
      • OAuth2
      • OIDC
  • Features
    • Applications
    • Sessions
    • Users and Profiles
    • Digital Goods
    • Progress and Missions
    • Progress and Missions (3.4+)
    • Leaderboards
    • Matchmaking – Comprehensive Guide
    • Followers
    • Friends
    • Reward Issuance
    • Save Data
    • Metadata
    • Metadata (3.4+)
    • Queries
    • Web3
      • Wallets
      • Vaults
      • Omni Chain Support
      • Smart Contracts
        • Smart Contracts
  • Queries
    • Advanced Operators
    • Object Graph Navigation
    • Boolean Queries
    • Base Query Syntax
  • Advanced Operators
    • .name
    • .ref

Custom Code

  • Custom Code Overview
  • Introduction to Guice and Jakarta in Elements
  • Structuring your Element
  • Packaging an Element with Maven
  • Deploying an Element
  • Preparing for Code Generation
  • Properties
  • Websockets
  • RESTful APIs
  • Direct MongoDB Access (3.5+)

Releases

  • 3.4 Release Notes
  • 3.3 Release Notes
  • 3.2 Release Notes
  • 3.1 Release Notes

Configuration

  • Matchmaking – Comprehensive Guide
  • Direct Database Access and Batch Configuration
  • Batch Samples
    • Mission Upload Bash Script Sample
    • Item Upload Bash Script Sample

RESTful APIs

  • RESTful APIs Library
  • Swagger and Swagger UI

Crossplay

  • Namazu Crossfire
  • Deploying Namazu Crossfire in Your Game
View Categories
  • Home
  • Docs
  • Getting Started
  • Security Model

Security Model

Est. read time: 4 min read


Elements offers a proven security model with three levels of access for users. Take advantage of SSO with Facebook and Apple accounts, or native account login – all with profile management. #

Elements uses a three-tiered security model through a single API. When accessing the API a user may access at one of three access levels. Briefly, these include:

  • Anonymous – the user is not logged in or has not provided any valid access credentials.
  • User – the user is a regular user and can access some APIs intended for the general purpose users.
  • Superuser – the user can access full APIs which generally includes access to all records in the system.

User Access Levels (Detailed Overview) #

Currently, a user may have one of the three following access levels. This applies to the User’s entire account. Across all of Elements, the security model applies as follows:

  1. Anonymous (or Unprivileged) provides access to information that is considered public. Few APIs will supply information when used without any kind of credentials. Some APIs may only return limited sets of data at this level. Anonymous is the default access level and tends to grant very little access. If the client supplies no credentials, Elements will process all requests at this level. It is possible to greatly restrict a logged-in User’s access by assigning this level. This will give the user the same access level as if they were not logged in. It may, however, still allow for valid session creation.
  2. User is the level of access for all authenticated users. This is what the average user will use when accessing your applications. When creating new accounts, the system will automatically assign users to this level of access. User is the access level for normal users. Additionally, it is the default level for making new accounts. Only a Superuser may escalate a user’s access level allowing for access to the whole system. In general, users of your application should always be assigned this level.
  3. Superuser allows for complete control over the system. APIs may return all information requested. Admins may perform operations such editing user accounts, resetting passwords for other users in the system, or adjust the application parameters. Using the admin console requires superuser access.

Note

Important:

  • Elements intercepts incoming requests as soon as possible, reads credentials information, and applies scope based on the user-supplied credentials.
  • For a majority of endpoints, including those defined as cloud functions in the scripting engine, the user scope will be set before the presentation layer receives the code.
  • Elements will instantiate the specific version of a Service based on the access level.

Additionally, when troubleshooting, it is often times useful to fetch the version endpoint which prints out the revision, build time, and version number by visiting this link in your local browser http://localhost:8080/api/rest/version. This information should also be visible upon logging in to the admin console.

At the time of this writing, Elements does not support full user segmentation by group and permission scheme. This is a feature slated for future releases. However, future versions will still operate against group-based access. (TODO: Describe in more detail)

Single Sign-On #

Facebook Single Sign-On #

Elements supports SSO through Facebook OAuth Tokens. Please review our Sessions > Facebook SSO documentation to implement Facebook SSO.

Apple Sign-In #

Elements supports SSO through Apple Sign-In. Please review our Sessions > Apple Sign-in documentation to implement Apple SSO.

Username/Password Sign-In #

Username/password sign in is the default method of authentication within Elements.

Create new User #

When someone signs up for Elements (via the UserSignupApi), they must provide a user name, a password, and an email address. This will provide you with the new User object in the response, which will be needed for the next step.

Sign in with existing User #

After creating the new User, or if someone has already created a User in Elements, they can retrieve a session key with just the Username and Password via the UsernamePasswordSessionApi. This will return a SessionCreation object that contains the SessionSecret property, which is your session key.

Once the session key has been retrieved, you can then authenticate User related requests by adding the session key to the singleton client configuration in your generated code. For example:

C#
Server.Elements.Client.Configuration.ApiKey["Elements-SessionSecret"] = <SessionSecret>;

Note

There will likely be two configurations, one for Elements and one for your application. It will be necessary to add the same session secret to both of these.

Adding this will automatically add the session key to any requests that require auth.

Warning

Most requests are profile related, so we are not quite done with the login process yet.

Now that the session secret for the User has been acquired, we can either retrieve all of the Profiles for that User, or create a new Profile.

Create New Profile #

Creating a new Profile will require a reference to the Application that it’s being created for. See Users and Profiles for more information on the relationship structure. The CreateProfileRequest object used to create a new Profile contains the following properties:

  • UserId (Required)
  • ApplicationId (Required)
  • DisplayName (Required, can be changed later)
  • ImageUrl (Optional, can be changed later)

The CreateProfile request will give you the created Profile object if the request was successful.

Fetch Existing Profiles #

If someone has already created a Profile and simply wishes to log back in to that Profile, then you can retrieve all profiles for a User and Application using the GetProfiles via the ProfilesApi. At this point it’s up to you to decide whether to let someone choose their Profile (for example, if you have a game that allows for multiple characters) or to choose for them.

Add Profile Id to Session Key #

Once the Profile has been acquired, to authenticate any Profile specific requests (e.g. Progress), the Profile Id must be appended to the session key using the following format:

//Session key string, then <space>, then 'p', then the profile id
<session key> p<profile id>

once this is created, overwrite the previous session key stored in the API configurations, for example:

C#
Server.Elements.Client.Configuration.ApiKey["Elements-SessionSecret"] = <New Session Secret>;

and with this, the login process is complete!

Note

Please review the Sessions > Scoping Rules documentation to ensure you’ve provided the proper access levels to new users.

What are your Feelings
Still stuck? How can we help?

How can we help?

Updated on August 27, 2025
N-Tier Architecture
Table of Contents
  • Elements offers a proven security model with three levels of access for users. Take advantage of SSO with Facebook and Apple accounts, or native account login - all with profile management.
  • User Access Levels (Detailed Overview)
  • Single Sign-On
    • Facebook Single Sign-On
    • Apple Sign-In
  • Username/Password Sign-In
    • Create new User
    • Sign in with existing User
    • Create New Profile
    • Fetch Existing Profiles
    • Add Profile Id to Session Key
  • Documentation
  • Terms of Service
  • Privacy Policy
  • Contact us
  • Linkedin
  • Join our Discord

Namazu Studios LLC is powered by Namazu Elements, an Elemental Computing Inc. product.

Elements
  • Download
  • About Elements
  • Open source
  • Documentation
  • Support
About Namazu
  • Case Studies
  • About Us
  • News
Get in Touch
  • info@namazustudios.com
  • Book a call
  • (619) 862-2890
  • Linkedin
  • Discord

©2008-2025 Namazu Studios. All Rights Reserved.