
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@aplus-frontend/aplus-auth-sdk
Advanced tools
aplus前端项目登录SDK,适用于aplus单体项目或者微前端项目,提供快速接入登录功能,无需在鉴权的业务逻辑担心。
#根路径加 -w
pnpm add @aplus-frontend/aplus-auth-sdk
//vue3 项目 main.ts中
import { authHub, authClass } from '@aplus-frontend/aplus-auth-sdk';
//初始化链接
const authClient = authHub({
platform: 'aplus',
used: 'login', //指明用途
env: import.meta.env.MODE,
debug: true,
apiUrl: import.meta.env.VITE_GLOB_API_URL,
urlPrefix: import.meta.env.VITE_GLOB_API_URL_PREFIX
});
//用途是login,init什么都不返回
await authClient.init();
//这里是一些登录请求逻辑
//成功之后设置token
await authClient?.setAuthToken(res.token);
//vue3 项目 main.ts中
import { authHub, authClass } from '@aplus-frontend/aplus-auth-sdk';
//初始化链接
authClient = authHub({
platform: 'aplus',
used: 'site', //指明用途
env: import.meta.env.MODE,
debug: true,
apiUrl: import.meta.env.VITE_GLOB_API_URL,
urlPrefix: import.meta.env.VITE_GLOB_API_URL_PREFIX
});
//用途是site init会返回token
const token = await authClient.init();
console.log('token:', token);
if (token) {
tokenRef.value = token;
}
const userInfo = await authClient.getUserInfo();
if (userInfo) {
console.log('userInfo:', userInfo);
}
const menus = await authClient.getUserMenus();
if (menus) {
console.log('menus:', menus);
}
const permissions = await authClient.getUserPermissions();
if (permissions) {
console.log('permissions:', permissions);
}
属性 | 类型 | 描述 | 是否必传填 |
---|---|---|---|
env | 'development' | 'dev' | 'test' | 'uat' | 'prod' | 环境设置 | 否 默认dev |
hubUrl | string | Hub URL | 否 默认dev的hub |
redirectUrl | string | 重定向 URL | 否 默认dev的登录 |
whetherRedirect | boolean | 是否重定向 | 否 默认true |
platform | 'aplus' | 'admin' | 平台 | 否 默认aplus |
used | 'login' | 'site' | 用途类型 | 否 默认site |
debug | boolean | 调试模式 | 否 默认false |
maxRetries | number | 最大重试次数 | 否 默认3 |
apiUrl | string | API URL | 是 建议直接设置import.meta.env.VITE_GLOB_API_URL |
urlPrefix | string | URL 前缀 | 是 建议直接设置import.meta.env.VITE_GLOB_API_URL_PREFIX |
方法名 | 描述 | 参数 | 返回值 |
---|---|---|---|
init | 初始化认证中心 | options: UserConfig | `Promise<string |
getAuthToken | 获取认证 token | 无 | Promise<string> |
setAuthToken | 设置认证 token | token: string | Promise<void> |
isHasAuthToken | 检查是否存在认证 token | 无 | Promise<boolean> |
isLegalToken | 检查 token 是否合法 | 无 | Promise<boolean> |
removeAuthToken | 移除认证 token | 无 | Promise<{ code: number; message: string }> |
getUserInfo | 获取用户信息 | 无 | `Promise<CurrentUserInfo |
getUserMenus | 获取用户菜单 | 无 | `Promise<UserMenus |
redirectLogin | 重定向到登录页面 | 无 | Promise<void> |
init
方法在used
为'login'
时不会返回任何值,为site
时会返回token。另外开发环境下,因为vite热重载会提示报错:init方法已经被调用过
这是正常现象。setAuthToken
方法需要在登录接口成功后再调用,以设置用户的认证 token。redirectLogin
方法会清空浏览器历史记录并重定向到登录页面。
FAQs
aplus auth sdk for aplus frontend project
The npm package @aplus-frontend/aplus-auth-sdk receives a total of 183 weekly downloads. As such, @aplus-frontend/aplus-auth-sdk popularity was classified as not popular.
We found that @aplus-frontend/aplus-auth-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.