Authentication Guide

OS.js provides options for customizing the authentication procedure.

By default the client is set up to automatically log in with a "demo user" account and the server responds to any authentication request successfully.

This functionality can be changed by configuration and using a different adapter

These are the available client adapters:

  • server - Authenticate via the server (default)
  • localStorage - Null authentication (used in standalone mode)

And these are the available server adaters:

  • null - Accepts any authentication request (default)
  • pam - Log in via host PAM (unix only)
  • database - Log in via a database

Removing automatic login

In your src/client/config.js file either comment out or remove this section entirely:

{
  auth: {
    login: {
      username: 'demo',
      password: 'demo'
    }
  }
}

Configuring adapter

Adapters are listed in the official resource list and above.

The README file of the module should provide more specific examples.

See provider guide for more information about provider setup.

If you have sensitive information in your configuration, consider using dotenv.

Modifying the adapter requires changing the AuthServiceProvider options:

Client

You can set up a custom client adapter to modify the requests etc.:

import customAdapter from 'custom-adapter';

core.register(AuthServiceProvider, {
  args: {
    adapter: customAdapter,
    config: { /* Your configuration here */}
  }
});

Server

const customAdapter = require('custom-adapter');

core.register(AuthServiceProvider, {
  args: {
    adapter: customAdapter,
    config: { /* Your configuration here */}
  }
});

results matching ""

    No results matching ""