Auth Provider
#
Installation#
Basic configurationImport the authProvider
from the package and use it as-is with React-Admin
See the official React-Docs about authentication for more details.
You will also need to include the package-specific translations messages in React-Admin's i18nProvider
:
#
Adding user authentication to Archipelago layout#
Forcing user to loginBy default your app will be accessible to anonymous users.
If you wish to force all users to login, you can pass a allowAnonymous: false
param to the auth provider.
#
Checking allowed usersIf you only want certain types of users to access your app, you can pass a checkUser
function to the authProvider.
This function receives user data and must return true or false, depending on whether the user is granted access or not.
This
checkUser
function is also available to any of your components using the React-Admin'suseAuthProvider
hook.
#
Checking permissionsIf you want to check permissions based on WebACL, you need to provide additional parameters to the authProvider.
Additionally, you should use the <ListWithPermissions />
, <ShowWithPermissions />
and <EditWithPermissions />
components instead of React-Admin's default <List />
, <Show />
and <Edit />
components.
This will hide the Create, Edit and Delete buttons to users who are not allowed to do these actions, and show a Permissions button to users who have acl:Control
over a resource or a container.