Warning: This package is deprecated and no longer maintained. We recommend using @genesislcap/pbc-auth instead.
This micro front-end includes a set of identity management functions, such as authentication (including via SSO) and password reset. Many of the features can be turned on and off as desired, and parts of the login screen (such as the logo) can be customised.
Login uses the Credential Management API, falling back to cookies when unavailable.
An example of the main login screen:
An example of authentication via SSO:
An example of the change password screen:
:::info
If you build a project upon one of the Genesis seed apps, then the Login
micro front-end will already be set up for you.
:::
To enable this micro front-end in your application, follow the steps below.
- Add
@genesislcap/foundation-login
as a dependency in your package.json file. Whenever you change the dependencies of your project, always run the$ npm run bootstrap
or$ npm run bootstrap:ignore-scripts
command again. You can see more information on the package.json basics page.
{
...
"dependencies": {
"@genesislcap/foundation-login": "latest"
},
...
}
:::note
This page assumes you're using the routing systems that are part of foundation-ui
, and will cover set-up as part of that routing system.
:::
Once installed, you can either use Login
as is or re-configure it. As with all our micro front-ends, you also have the option of lazy loading it.
You may need to set up a NavigationContributor
in your application's router config class to handle public
and autoAuth
route settings.
-
public
, which indicates that a route doesn't require the user to be authenticated to view it -
autoAuth
, where, if the user already has an authenticated session, they are automatically logged in again if they navigate away from a page and then return
{
path: 'info',
element: Info,
title: 'Info',
name: 'info',
settings: { public: true },
},
{
path: 'admin',
element: Admin,
title: 'Admin',
name: 'admin',
settings: { autoAuth: true },
}
:::warning
By default, a route that isn't marked public is not. However, a non-public route isn't automatically going to block non-authenticated users from viewing them. This must be implemented in a NavigationContributor
; see example.
:::
For authentication, most configuration is set in the back end. You should familiarise yourself with the authentication section of the back-end.
The standard authentication method is the user supplying their username and password. Even when SSO is enabled as an authentication method, the user will still have the option to sign in with their normal credentials.
:::note
Setting the DEFAULT_USER
and DEFAULT_PASSWORD
environment variables automatically populates the credentials in the login form, which can be useful during development so developers don't need to write out their credentials continuously. However, the browser may also offer auto-filling if you have previously chosen to save your credentials, which can make setting these unnecessary.
:::
SSO functionality allows the Login
micro front-end to work with your company's existing authentication system, enabling them to have a single set of credentials - including those built on the Genesis low-code platform. Genesis supports SSO with both JWT and SAML.
Setting up SSO is primarily a back-end task; however, there is a small amount of front-end sso configuration required.
:::note
The standard process of SSO is that the SSO authentication provider flow is opened via a redirect in the current page. However, many authentication providers block their system when running in an iframe to prevent clickjacking attacks. Because of this, if the Login
micro front-end detects that it is running in an iframe, it opens up the authentication provider in a popup instead.
:::
The Login
micro front-end can be customised using an exported configure
function. See configure in the API docs for more information.
To enable this module in your application, follow the steps below.
- Add
@genesislcap/foundation-login
as a dependency in yourpackage.json
file. Whenever you change the dependencies of your project, ensure you run the$ npm run bootstrap
command again. You can find more information in the package.json basics page.
{
...
"dependencies": {
...
"@genesislcap/foundation-login": "latest"
...
},
...
}
Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact Genesis Global for more details.
Genesis low-code platform