
Research
/Security News
737 Chrome VPN Extensions Linked to Brand Impersonation and Browser Traffic Redirection
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.
@abpjs/identity
Advanced tools
ABP Framework identity components for React - translated from @abp/ng.identity
User and role management UI components for ABP Framework in React
@abpjs/identity provides a complete identity management interface for ABP-based React applications. It includes comprehensive user and role management with CRUD operations, role assignment, permission management integration, and pagination support.
This package is a React translation of the original @abp/ng.identity Angular package, bringing full identity management capabilities to React applications.
# Using npm
npm install @abpjs/identity
# Using yarn
yarn add @abpjs/identity
# Using pnpm
pnpm add @abpjs/identity
This package requires the following peer dependencies:
npm install @abpjs/core @abpjs/theme-shared @abpjs/permission-management @chakra-ui/react @emotion/react @emotion/styled framer-motion
The easiest way to add identity management to your app:
import { RolesComponent, UsersComponent } from '@abpjs/identity';
import { Tabs, TabList, TabPanels, Tab, TabPanel } from '@chakra-ui/react';
function IdentityManagement() {
return (
<Tabs>
<TabList>
<Tab>Users</Tab>
<Tab>Roles</Tab>
</TabList>
<TabPanels>
<TabPanel>
<UsersComponent
onUserCreated={(user) => console.log('User created:', user)}
onUserDeleted={(id) => console.log('User deleted:', id)}
/>
</TabPanel>
<TabPanel>
<RolesComponent
onRoleCreated={(role) => console.log('Role created:', role)}
onRoleDeleted={(id) => console.log('Role deleted:', id)}
/>
</TabPanel>
</TabPanels>
</Tabs>
);
}
Build your own identity UI using the provided hooks:
import { useUsers, useRoles, Identity } from '@abpjs/identity';
import { useEffect } from 'react';
function CustomUsersPage() {
const {
users,
totalCount,
isLoading,
fetchUsers,
createUser,
deleteUser,
} = useUsers();
useEffect(() => {
fetchUsers();
}, [fetchUsers]);
const handleCreateUser = async (data: Identity.UserSaveRequest) => {
const result = await createUser(data);
if (result.success) {
console.log('User created successfully!');
}
};
return (
<div>
<h1>Users ({totalCount})</h1>
{users.map(user => (
<div key={user.id}>
<span>{user.userName}</span>
<span>{user.email}</span>
<button onClick={() => deleteUser(user.id)}>Delete</button>
</div>
))}
</div>
);
}
Complete user management component with table, search, pagination, and modals.
import { UsersComponent } from '@abpjs/identity';
<UsersComponent
onUserCreated={(user) => console.log('Created:', user)}
onUserUpdated={(user) => console.log('Updated:', user)}
onUserDeleted={(id) => console.log('Deleted:', id)}
/>
Props:
| Prop | Type | Description |
|---|---|---|
onUserCreated | (user: UserItem) => void | Callback when user is created |
onUserUpdated | (user: UserItem) => void | Callback when user is updated |
onUserDeleted | (id: string) => void | Callback when user is deleted |
Features:
Complete role management component with table, search, and modals.
import { RolesComponent } from '@abpjs/identity';
<RolesComponent
onRoleCreated={(role) => console.log('Created:', role)}
onRoleUpdated={(role) => console.log('Updated:', role)}
onRoleDeleted={(id) => console.log('Deleted:', id)}
/>
Props:
| Prop | Type | Description |
|---|---|---|
onRoleCreated | (role: RoleItem) => void | Callback when role is created |
onRoleUpdated | (role: RoleItem) => void | Callback when role is updated |
onRoleDeleted | (id: string) => void | Callback when role is deleted |
Features:
Hook for managing users with full CRUD and pagination support.
import { useUsers } from '@abpjs/identity';
function MyUsersPage() {
const {
users, // Array of users
totalCount, // Total user count
selectedUser, // Currently selected user
selectedUserRoles, // Roles of selected user
isLoading, // Loading state
error, // Error message
pageQuery, // Current pagination params
fetchUsers, // Fetch users with optional params
getUserById, // Get single user
getUserRoles, // Get user's roles
createUser, // Create new user
updateUser, // Update existing user
deleteUser, // Delete user
setSelectedUser, // Set selected user
setPageQuery, // Update pagination params
reset, // Reset all state
} = useUsers();
// Fetch users on mount
useEffect(() => {
fetchUsers();
}, [fetchUsers]);
// Pagination example
const handlePageChange = (page: number) => {
const newQuery = {
...pageQuery,
skipCount: page * pageQuery.maxResultCount,
};
setPageQuery(newQuery);
fetchUsers(newQuery);
};
// Create user example
const handleCreate = async () => {
const result = await createUser({
userName: 'newuser',
email: 'user@example.com',
password: 'SecurePassword123!',
name: 'John',
surname: 'Doe',
phoneNumber: '',
lockoutEnabled: true,
twoFactorEnabled: false,
roleNames: ['admin'],
});
if (result.success) {
console.log('User created!');
} else {
console.error(result.error);
}
};
}
Hook for managing roles with full CRUD support.
import { useRoles } from '@abpjs/identity';
function MyRolesPage() {
const {
roles, // Array of roles
totalCount, // Total role count
selectedRole, // Currently selected role
isLoading, // Loading state
error, // Error message
fetchRoles, // Fetch all roles
getRoleById, // Get single role
createRole, // Create new role
updateRole, // Update existing role
deleteRole, // Delete role
setSelectedRole, // Set selected role
reset, // Reset all state
} = useRoles();
// Fetch roles on mount
useEffect(() => {
fetchRoles();
}, [fetchRoles]);
// Create role example
const handleCreate = async () => {
const result = await createRole({
name: 'Manager',
isDefault: false,
isPublic: true,
});
if (result.success) {
console.log('Role created!');
}
};
}
Combined hook for managing both users and roles.
import { useIdentity } from '@abpjs/identity';
function IdentityDashboard() {
const { roles, users, fetchRoles, fetchUsers } = useIdentity();
useEffect(() => {
fetchRoles();
fetchUsers();
}, []);
return (
<div>
<h2>Users: {users.length}</h2>
<h2>Roles: {roles.length}</h2>
</div>
);
}
Service class for direct API interaction.
import { IdentityService } from '@abpjs/identity';
import { useRestService } from '@abpjs/core';
function MyComponent() {
const restService = useRestService();
const identityService = new IdentityService(restService);
// Role operations
const roles = await identityService.getRoles();
const role = await identityService.getRoleById(roleId);
await identityService.createRole({ name: 'Editor', isDefault: false, isPublic: true });
await identityService.updateRole(roleId, { name: 'Senior Editor', isDefault: false, isPublic: true });
await identityService.deleteRole(roleId);
// User operations
const users = await identityService.getUsers({ maxResultCount: 10, skipCount: 0 });
const user = await identityService.getUserById(userId);
const userRoles = await identityService.getUserRoles(userId);
await identityService.createUser({ userName: 'john', email: 'john@example.com', password: 'Pass123!', ... });
await identityService.updateUser(userId, { ... });
await identityService.deleteUser(userId);
}
All identity types are exported under the Identity namespace:
import { Identity } from '@abpjs/identity';
// State shape
interface Identity.State {
roles: RoleResponse;
users: UserResponse;
selectedRole: RoleItem;
selectedUser: UserItem;
selectedUserRoles: RoleItem[];
}
// Role types
interface Identity.RoleItem {
id: string;
name: string;
isDefault: boolean;
isPublic: boolean;
isStatic: boolean;
concurrencyStamp: string;
}
interface Identity.RoleSaveRequest {
name: string;
isDefault: boolean;
isPublic: boolean;
}
// User types
interface Identity.UserItem {
id: string;
tenantId: string;
userName: string;
name: string;
surname: string;
email: string;
emailConfirmed: boolean;
phoneNumber: string;
phoneNumberConfirmed: boolean;
twoFactorEnabled: boolean;
lockoutEnabled: boolean;
isLockedOut: boolean;
concurrencyStamp: string;
}
interface Identity.UserSaveRequest {
userName: string;
name: string;
surname: string;
email: string;
phoneNumber: string;
password: string;
lockoutEnabled: boolean;
twoFactorEnabled: boolean;
roleNames: string[];
}
Complete identity management page:
import { useState } from 'react';
import { usePermission } from '@abpjs/core';
import { RolesComponent, UsersComponent } from '@abpjs/identity';
import {
Box,
Tabs,
TabList,
TabPanels,
Tab,
TabPanel,
Heading,
useToast,
} from '@chakra-ui/react';
function IdentityManagementPage() {
const toast = useToast();
const { hasPermission } = usePermission();
const canViewUsers = hasPermission('AbpIdentity.Users');
const canViewRoles = hasPermission('AbpIdentity.Roles');
const handleUserCreated = (user) => {
toast({ title: `User ${user.userName} created`, status: 'success' });
};
const handleUserDeleted = () => {
toast({ title: 'User deleted', status: 'success' });
};
const handleRoleCreated = (role) => {
toast({ title: `Role ${role.name} created`, status: 'success' });
};
const handleRoleDeleted = () => {
toast({ title: 'Role deleted', status: 'success' });
};
return (
<Box p={4}>
<Heading mb={4}>Identity Management</Heading>
<Tabs>
<TabList>
{canViewUsers && <Tab>Users</Tab>}
{canViewRoles && <Tab>Roles</Tab>}
</TabList>
<TabPanels>
{canViewUsers && (
<TabPanel>
<UsersComponent
onUserCreated={handleUserCreated}
onUserDeleted={handleUserDeleted}
/>
</TabPanel>
)}
{canViewRoles && (
<TabPanel>
<RolesComponent
onRoleCreated={handleRoleCreated}
onRoleDeleted={handleRoleDeleted}
/>
</TabPanel>
)}
</TabPanels>
</Tabs>
</Box>
);
}
export default IdentityManagementPage;
This package respects ABP's identity permissions:
| Permission | Description |
|---|---|
AbpIdentity.Users | View users |
AbpIdentity.Users.Create | Create users |
AbpIdentity.Users.Update | Update users |
AbpIdentity.Users.Delete | Delete users |
AbpIdentity.Users.ManagePermissions | Manage user permissions |
AbpIdentity.Roles | View roles |
AbpIdentity.Roles.Create | Create roles |
AbpIdentity.Roles.Update | Update roles |
AbpIdentity.Roles.Delete | Delete roles |
AbpIdentity.Roles.ManagePermissions | Manage role permissions |
This package is part of the ABP React monorepo. Contributions are welcome!
LGPL-3.0 - See LICENSE for details.
FAQs
ABP Framework identity components for React - translated from @abp/ng.identity
The npm package @abpjs/identity receives a total of 19 weekly downloads. As such, @abpjs/identity popularity was classified as not popular.
We found that @abpjs/identity demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.