Random User Generator + OpenID Connect Provider. Like Lorem Ipsum, but for user accounts and authentication.
The PhantAuth API documentation is available on the following API documentation sites:
apiary (primary source)
PhantAuth was designed to simplify testing for applications using OpenID Connect authentication by making use of random generated users.
endpoint | address |
---|---|
issuer | https://phantauth.net |
discovery | https://phantauth.net/.well-known/openid-configuration |
credential | value |
---|---|
client_id | test.client |
client_secret | UTBcWwt5 |
The OpenID Connect Provider of PhantAuth supports the flows listed in the OpenID Connect specifications (Hybrid, Implicit, Authorization Code), as well as the Resource Owner Password grant type, specified in the OAuth 2.0 specifications. PhantAuth as an OpenID Connect Provider can be integrated with a variety of web applications, mobil applications, and backend applications. The integration can be either direct, as in the case of the OpenID Connect Provider, or through an authentication integration service, as in the case of Auth0 or Azure Active Directory B2C. To learn more, please go to chapter Integration.
Examples:
The random user generator of PhantAuth can also be used separately, independent of the OpenID Connect Provider. You can generate an optional number of test users. In the knowledge of their user name, the data of the generated users can be regenerated at any time (OpenID Connect sub claim). The generated users have a unique, operational, disposable email address, a profile picture selected from one of the multiple pools of pictures, and the usual profile data. Custom email addresses and profile pictures may also be added. The random user generator of PhantAuth can be fully customized. Additionally, you can link an external generator to the application. For details,please go to chapter Generator.
Test pages:
Default Generator Test Page (embedded generator)
Greek Gods Generator Test Page (embedded generator working from a Google Sheet)
Faker Generator Test Page (external generator using Javascript Faker library)
Chance Generator Test Page (external generator using Javascript Chance library)
Casual Generator Test Page (external generator using Javascript Casual library)
Randomuser Generator Test Page (client side generator using https://randomuser.me)
uinames Generator Test Page (client side generator using https://uinames.com)
Mockaroo Generator Test Page (client side generator using https://mockaroo.com)
Every random generated user has a profile page, which contains their profile data in a simple one-page format.
Profile examples:
The use of the random user generator and the direct integration of the OpenID Connect is demonstrated through a set of CodeSandbox samples. The sample applications are run directly from CodeSandbox, so the source code is easy to view, edit, and test.
Examples:
The PhantAuth is extremely versatile and customizable. You can use your own random user service, or generate users from an external .csv file or Google Sheet. You can use a set of Bootstrap themes to tailor the look and feel of the profile, morover, you can fundamentally change the same look and feel by the use of your own HTML templates. To find out more, please go to chapter Tenant.
To customize the application, you need to use one or more so-called tenants. A tenant can be consiered as an independent PhantAuth service. A tenant has its own random user generator endpoints and OpenID Connect endpoints.
The tenants can be organised into so-called domains. Practically, a domain is a DNS zone, which contains the settings of the given tenant(s). The tenants as well as the domain can be configured by the use of DNS TXT records.
In addition to the default tenant, the PhantAuth domain contains some sample tenants, which are primarily designed to demonstrate customizability, a range of hosting possibilities, and the links to external services. In most cases, using the default tenant is enough.
PhantAuth Default - default tenant, based on a Java Fairy library
Greek Gods - based on a Google Sheet document
PhantAuth Faker - based on a Javascript Faker library, hosted at https://now.sh
PhantAuth Chance - based on a Javascript Chance library, hosted at https://now.sh
PhantAuth Casual - based on a Javascript Casual library, hosted at https://webtask.io
RANDOM USER - based on https://randomuser.me service
uinames - based on https://uinames.com service
Mockaroo - based on https://mockaroo.com service
Anyone can create a domain and the tenants. Sharing the tenants is facilitated by the PhantAuth Shared Domain. A shared domain is connected to the phantauth.cf DNS zone, where anyone can create tenant configuration nodes by the use of the FreeDNS service.
The internal structure of PhantAuth is modular enough to allow certain elements to be customized or even replaced. The customized PhantAuth instances can be considered as separate services, which are independent from the original one. For the sake of simplicity, the customized PhantAuth instances will be called tenants.
The customized PhantAuth instances (tenants) have a different URL from that of the default tenant. For technological and cloud hosting purposes, it is advised that only the beginning of the path component of these URLs differs from the default PhantAuth URL. Similarly, the path component of a tenant URL should start with a low line character ("_"). So the general format of a tenant URL is:
https://phantauth.net/_TENANT
where TENANT
is the name of the tenant. The tenant name is a DNS domain name at the same time, which may lack .phantauth.net
or .phantauth.cf
from the end.
When desiging PhantAuth, the aim is that PhantAuth can run without a database, and it is configurable by the users. This can be achieved if for the purpose of storing the tenant configuration, the system uses the special TXT records of the Domain Name System (DNS), in compliance with the RFC 6763 specifications. So the tenant name is one or more DNS TXT records. These TXT records contain the configuration properties in NAME=VALUE format.
This allows anyone to create their own tenants by creating a DNS domain and the TXT records in that domain. Freenom, a service provider, allows you to register some top-level domains (.tk, .ml, .ga, .cf, .gq) free charge. The domain registered this way can be managed on the online interface of Freenom or transferred to an other free service provider offering a more convenient DNS name server (e.g. CloudFlare). Additionally, FreeDNS allows you to create DNS records within a second- or third level domain that is privately owned or shared with a community. In this case, you are advised to create the entries within the phantauth.cf
domain, because here you can omit the .phantauth.cf
from the tenant name in the URL. This means that a tenant with a name of mytenant.phantauth.cf
can be referred to in the shorther https://phantauth.net/_mytenant
format, rather than the longer https://phantauth.net/_mytenant.phantauth.cf
URL . Similar to .phantauth.cf
, the phantauth.net
can be omitted, thus the officially supported and the example tenants can be referred to by their short names (e.g. https://phantauth.net/_faker).
In a nutshell, to create a tenant, you have the following options:
With TXT records in a domain registered at Freenom, either on the online interface of Freenom or that of another free DNS service provider (e.g. CloudFlare).
With TXT records created in a second- or third level domain shared with a community, by using FreeDNS.
With TXT records created in your own existing DNS domain, by the use of an any DNS software.
The below table contains a summary of the tenant parameters having an effect on the operation of the tenants.
Property | Description |
---|---|
name | the displayed name of the tenant |
flags | generator flags having an effect on the login page |
theme | the address of the Bootstrap theme |
template | the address of the HTML page templates |
factory | the address of the external user generator |
depot | the address of the external user database |
sheet | the identifier of the Google Sheets document containing the user database |
script | the JavaScript URL inserted in the HTML pages |
summary | a one-line summary of the tenant |
about | a detailed description of the tenant |
attribution | the specifications of the external source |
logo | the logo of the tenant |
favicon | the favicon of the tenant’s web pages |
The displayed name of the tenant is defined in the name
parameter. In lack of such a name, the tenant’s DNS name is displayed. This name appears in the address bar of the tenant’s webpages.
This parameter contains the flags that affect the operation of a tenant (see Flags). Currently, the flags affecting the team size are used in the login screen. If any of the flags is a team size flag, you can select the user from a list in the login screen, rather than using an input field. It can take the following values:
tiny
small
medium
large
The HTML page templates of a tenant are created by the use of the Bootstrap library. This allows you to customize the layout and the colours of the pages by using external Bootstrap CSS files. The theme
parameter contains the URL of the Bootstrap CSS file used in the pages. It is optional; in lack of such a parameter, the tenant’s HTML pages have the default layout provided in the PhantAuth developer portal.
The place of the HTML page templates of a tenant is specified by the template
parameter. The value of the parameter is n RFC 6570 - URI temaplate expression. The URI template receives the page name in a resource
parameter.
The default value of the template
parameter:
https://default.phantauth.net{/resource}
The resource
URI template parameter may take the following values:
Value | Description |
---|---|
tenant.html | the tenant’s webpage; it contains a short description and the entry points of the tenant |
user.html | the user’s profile page |
login.html | the login page used for signing in |
consent.html | the content page used for signing in |
team.html | the profile page of the user group |
client.html | the profile page of a client |
fleet.html | the profile page of the client group |
policy.html | the client’s privacy policy |
tos.html | a client’s terms of service |
test.html | a login test page of the user generator and OpenID Connect |
If you use your own template, the pages are fully customizable. The templates use a template engine called Thymeleaf, which provides flexible template options. The source of the default template is available in the phantauth-default GitHub repository. If you wish to create your own templates, you are advised to produce them from these templates.
PhantAuth allows you to use your own random resource (user, team) generator. To do so, you need to provide its address in the factory
tenant parameter. The value of the parameter is an RFC 6570 - URI temaplate expression. The URI template receives the type of the object (user, team) to be generated in the kind
parameter, and the identifier of the object to be generated in the name
parameter.
In the factories
parameter, you can specify the resource types that can be generated by the external generator set in the factory
parameter. It takes the value of one or more strings from the following: user
, team
.
Instead of generating a user and team resource, you can randomly select them from a pre-created inventory. In this case, the URL of the CSV file containing the resources can be specified in the depot
parameter. The value of the parameter is an RFC 6570 - URI temaplate expression. The URI template receives the type of the object (user, team) to be generated in the kind
parameter.
The first line of the CSV file contains the resource property names, the following lines, on the other hand, contain the relevant data. In the case of nested properties, a “.” character separates the elements of the property name (e.g. address.formatted).
In the depots
parameter, you can specify the purpose of the external source set in the depot
parameter. It takes the value of one or more strings from the following: user
, team
.
You can randomly select the user data from a Google Sheets document. In the sheet
parameter, you can specify the identifier of a public Google Sheets document. The first row of the table contains the user property names, the following rows contain the relating data. In the case of nested properties, a “.” character is used to separate the elements of the property name (e.g. address.formatted).
The tenant named gods
is an example for the use of the sheet
parameter. It provides the user data in a public Google Sheets document. In this case, the identifier of the sheet is 1Xa4mRcLWroJr2vUDhrJXGBcobYmpS8fNZxFpXw-M9DY
, and the associated TXT record is:
gods 120 IN TXT "sheet=1Xa4mRcLWroJr2vUDhrJXGBcobYmpS8fNZxFpXw-M9DY"
You can automatically insert a custom JavaScript file in the login.html, consent.html, and test.html pages. The URL of this file can be specified in the script
parameter. By inserting a custom JavaScript file, you can also integrate a client-side random user generator.
You can provide a short, one-line description, a watchword for the tenant in the summary
parameter. It appears on the tenant’s startup page and all the pages that contain a list of available tenants.
To provide a detailed description of the tenant, use the about
parameter. If it takes the value of a URL, the description is downloaded from the given URL; otherwise the value is the description itself. The description may have markdown formatting.
It is an external data source. If you use a random user generator, you can specify the attribution in the attribution
parameter. The attribution may have markdown formatting, that is, you can highlight any element or provide a link to an external source:
randomuser 120 IN TXT "attribution=User data generated using [RANDOM USER GENERATOR](https://randomuser.me/)."
It is the URL of the tenant’s logo. The image at this address appears in the address bar of the tenant’s webpages.
Use the favicon
parameter to provide the URL of the favicon. The image at this address appears as a shortcut icon in the browser when a user visits the tenant’s webpages.
PhantAuth offers several examples for creating a custom tenant. They are ready-to-use tenants, although primarily created to show examples for customization.
A PhantAuth Faker tenant contains a generator built on the JavaScript Faker library. The generator runs on the serverless deployment platform of ZEIT Now, available free of charge. Its source code is accessible in the phantauth-faker GitHub repository. Its DNS configuration is:
faker.phantauth.net. 120 IN TXT "factories=team"
faker.phantauth.net. 120 IN TXT "factories=user"
faker.phantauth.net. 120 IN TXT "flags=small"
faker.phantauth.net. 120 IN TXT "factory=https://phantauth-faker.now.sh/api{/kind,name}"
faker.phantauth.net. 120 IN TXT "userinfo=Dream Team"
faker.phantauth.net. 120 IN TXT "theme=https://stackpath.bootstrapcdn.com/bootswatch/4.2.1/united/bootstrap.min.css"
faker.phantauth.net. 120 IN TXT "logo=https://phantauth-faker.now.sh/faker-logo.svg"
faker.phantauth.net. 120 IN TXT "name=PhantAuth Faker"
A PhantAuth Chance tenant contains a generator built on the JavaScript Chance library. The generator runs on the serverless deployment platform of ZEIT Now, available free of charge. Its source code is accessible in the phantauth-chance GitHub repository. Its DNS configuration is:
chance.phantauth.net. 120 IN TXT "flags=small"
chance.phantauth.net. 120 IN TXT "name=PhantAuth Chance"
chance.phantauth.net. 120 IN TXT "factory=https://phantauth-chance.now.sh/api{/kind,name}"
chance.phantauth.net. 120 IN TXT "factories=team"
chance.phantauth.net. 120 IN TXT "factories=user"
chance.phantauth.net. 120 IN TXT "theme=https://stackpath.bootstrapcdn.com/bootswatch/4.2.1/united/bootstrap.min.css"
chance.phantauth.net. 120 IN TXT "logo=https://phantauth-chance.now.sh/chance-logo.png"
A PhantAuth Casual tenant contains a generator built on the JavaScript Casual library. The generator runs on the serverless deployment platform of Auth0 Webtask, available free of charge. Its source code is accessible in the phantauth-casual GitHub repository. Its DNS configuration is:
casual.phantauth.net. 120 IN TXT "logo=https://www.phantauth.net/logo/phantauth-logo-gray.svg"
casual.phantauth.net. 120 IN TXT "name=PhantAuth Casual"
casual.phantauth.net. 120 IN TXT "factory=https://wt-51217f7b3eee6aead0123eeafe3b83e8-0.sandbox.auth0-extend.com/user{?name}"
casual.phantauth.net. 120 IN TXT "theme=https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
For the Greek Gods tenant, the user data is contained in a public Google Sheets document. Its DNS configuration is:
gods.phantauth.net. 120 IN TXT "attribution=God pictures come from [Theoi Project](https://www.theoi.com/), a site exploring Greek mythology and the gods in classical literature and art."
gods.phantauth.net. 120 IN TXT "name=Greek Gods"
gods.phantauth.net. 120 IN TXT "flags=medium"
gods.phantauth.net. 120 IN TXT "theme=https://stackpath.bootstrapcdn.com/bootswatch/4.2.1/sandstone/bootstrap.min.css"
gods.phantauth.net. 120 IN TXT "logo=https://cdn.staticaly.com/favicons/www.theoi.com"
gods.phantauth.net. 120 IN TXT "sheet=1Xa4mRcLWroJr2vUDhrJXGBcobYmpS8fNZxFpXw-M9DY"
The RANDOM USER tenant uses the popular https://randomuser.me service to generate random users. The randomuser.me service is called on the client side, the call is contained in the randomuser.js script given in the script
parameter. Its DNS configuration is:
randomuser.phantauth.net. 120 IN TXT "attribution=User data generated using [RANDOM USER GENERATOR](https://randomuser.me/)."
randomuser.phantauth.net. 120 IN TXT "script=https://www.phantauth.net/selfie/randomuser.js"
randomuser.phantauth.net. 120 IN TXT "flags=small"
randomuser.phantauth.net. 120 IN TXT "name=RANDOM USER"
randomuser.phantauth.net. 120 IN TXT "logo=https://cdn.staticaly.com/favicons/randomuser.me"
randomuser.phantauth.net. 120 IN TXT "theme=https://stackpath.bootstrapcdn.com/bootswatch/4.2.1/sandstone/bootstrap.min.css"
The uinames tenant uses the https://uinames.com service to generate random users. The uinames.com service is called on the client side, the call is contained in the uinames.js script given in the script
parameter. Its DNS configuration is:
uinames.phantauth.net. 120 IN TXT "attribution=User data generated using [uinames.com API](https://uinames.com)."
uinames.phantauth.net. 120 IN TXT "logo=https://uinames.com/assets/img/ios-precomposed.png"
uinames.phantauth.net. 120 IN TXT "flags=small"
uinames.phantauth.net. 120 IN TXT "theme=https://stackpath.bootstrapcdn.com/bootswatch/4.2.1/minty/bootstrap.min.css"
uinames.phantauth.net. 120 IN TXT "name=uinames"
uinames.phantauth.net. 120 IN TXT "script=https://www.phantauth.net/selfie/uinames.js"
The Mockaroo tenant uses the https://mockaroo.com service to generate random users. The mockaroo.com service is called on the client side, the call is contained in the mockaroo.js script given in the script
parameter. Its DNS configuration is:
mockaroo.phantauth.net. 120 IN TXT "attribution=User data generated using [Mockaroo's Mock APIs](https://mockaroo.com/mock_apis)."
mockaroo.phantauth.net. 120 IN TXT "script=https://www.phantauth.net/selfie/mockaroo.js"
mockaroo.phantauth.net. 120 IN TXT "logo=https://www.phantauth.net/selfie/kongaroo.svg"
mockaroo.phantauth.net. 120 IN TXT "flags=small"
mockaroo.phantauth.net. 120 IN TXT "theme=https://stackpath.bootstrapcdn.com/bootswatch/4.2.1/minty/bootstrap.min.css"
mockaroo.phantauth.net. 120 IN TXT "name=Mockaroo"
PhantAuth is a free, open-source, non-profit application. If you find this service useful and can afford, please make a small donation as a contribution to the operation costs (domain registration, service hosting, etc.)
Donate on Ko-fi | Donate on Liberapay | Donate on PayPal
The basic concept of PhantAuth is that it generates data in a random but deterministic way. To achieve this goal, a so-called pseudorandom number generator (PRNG) is used. Each object type has an identifier (login name for user, client_id for client, etc.) By using a given hash algorithm, the value of the pseudorandom generator seed is produced from this identifier. Then, every property of the given object is generated with the pseudorandom generator started from this seed value. Taking advantage of the special feature of the pseudorandom number generator, also called as deterministic random bit generator (DRBG), that is, it generates the same random value series started from the same seed, the identifier clearly defines the object generated from it. That is, by the use of an identifier and generator, you can regenarate the properties of a given object at any time.
Based on the above concept, PhantAuth is absolutely stateless, and no storage medium is necessary. So, a randomly selected login name will “exist”, and the properties of the “associated” user can be generated.
In brief, an object is defined by its identifier. The name of the identifier of a user or client object is sub
or client_id
used in the OpenID Connect specifications. The name of the identifier property of other PhantAuth-specific objects that are not included in the specifications is sub
.
The identifier may contain any character.
Sometimes you may want to customize the properties generated from the identifier. Although the identifier may contain any character, and its structure is optional, you can customize the generated values if a certain structure is used.
You can use a variety of flags to customize or give the parameters of certain object properties (user, client, etc.). The flags can be grouped by their effect on the generation of the properties. Basically, a flag is a keyword. You can set more than one flags to affect the generation of a variety of properties at the same time. To separate the flags from one another and the rest of the identifier, you need to use a semicolon ;
:
joe;female;kitten
In the above example, the user generated by the user generator is female, and her avatar is a randomly selected sketched kitten avatar. The other features are deterministically generated from the name “joe”, that is, their values are not affected by the two flags. The profile page of this example can be found here.
Please note that the flags form part of the identifier, as a different flag allows you to generate a different object.
The following flags modify the gender of the generated user.
Flag | Description |
---|---|
male | The gender property of the generated user is male, independent of the user’s name |
female | The gender property of the generated user is female, independent of the user’s name |
guess | The gender property is defined on the basis of the generated user’s given name (default) |
nogender | The generated user doesn’t have a gender property |
The following flags modify the generated avatar image.
Avatar | Flag | Description |
---|---|---|
ai | AI type generated, photo-like avatars (default) | |
sketch | sketched photo-like avataaars avatars | |
photo | photo avatars | |
dice | pixel art-style DiceBear avatars | |
kitten | ROBOHASH-generated sketched kitten avatars | |
adorable | Adorable Avatars | |
mp | simple, cartoon-style silhouetted outline of a person (does not vary by user) | |
identicon | a geometric pattern based on an email hash | |
monsterid | a generated “monster” with different colors, faces, etc. | |
wavatar | generated faces with varying features and backgrounds | |
retro | awesome generated, 8-bit arcade-style pixelated faces | |
robohash | a generated robot with different colors, faces, etc. | |
blank | a transparent PNG image | |
notfound | return an HTTP 404 (File Not Found) response | |
noavatar | the user will not have a picture property |
The following flags modify the generated logo.
Logo | Flag | Description |
---|---|---|
icon | Game-icons.net icon as a logo (default) | |
fractal | Electric Sheep fractal as a logo |
Group
size flagsThe following flag modify the sizes of the generated team (group of users) and fleet (group of clients).
Flag | Size |
---|---|
tiny | 5 (default) |
small | 10 |
medium | 25 |
large | 50 |
huge | 100 |
In most cases, the generated objects have a full name, which is generated from the identifier. Instead of being generated, the full name can be produced from the identifier, if the identifier contains at least one period (.
) or space (
) character. In such cases, these characters play the role of separator between the parts of the full name (e.g. family name, given name). That is, the full name isn’t randomly generated from the identifier but, by taking the separator characters into account, it is produced from the single parts of the full name (with capitalised initial letters). For this purpose, it is advised to use a period character, rather than a space character.
joe.black;sketch
In the above example: The full name of the user generated by the user generator is Joe Black (and his avatar is a skecthed profile avatar). The profile page of this example can be found here.
In most cases, the generated objects have an image (avatar for a user, logo for a client), which is generated from the identifier. The flags determine which pre-defined inventory the image comes from (see flags). It can be further customized by the use of Gravatar.
Each object has a generated unique email address (email
for a user, logo_email
for any other objects). To customize the image of a given object, you need to assign the gravatar image to this email address. By default, an object has a gravatar image, and the generated image is the default value of the gravatar URL only. In other words, as soon as you create a gravatar image to a given email address, that image will appear as the image associated with the given object.
A disposable, operational email address suitable for receiving incoming emails is generated to each object. You can use your own email address (e.g. a previously set test email address) instead of a generated email address, if you prefer. In this case, the identifier contains an email address. Consequently, the image associated with the given object is the gravatar image assigned to the email address contained in the identifier.
ivan.test.szkiba@spam4.me
In the above example: The email address of the user generated by the user generator is ivan.test.szkiba@spam4.me (and his name is Ivan Test Szkiba). The profile page of this example can be found here.
PhantAuth can use external data sources and generators as well. The only restriction is that the external generator has to be deterministic. This means that even if called several times, it has to generate the same object to the same identifier.
A special case of external generators is if an external data source is used. In such cases, the properties of a given object can be provided in a comma separated value (CSV) file or a Google Sheets document.
The external data sources and generators can be defined by the use of so-called tenants. To learn more, please go to chapter Tenant.
Use this page to mock PhantAuth in your testing and development.
Run our mock API sample using the open source WireMock library, or in the free edition of WireMock Cloud. You'll have a working API server simulating the behavior of PhantAuth, which will allow you to keep building and testing even if the actual API you isn't currently available.