mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: missing authenticator (#6526)
This commit is contained in:
parent
44ee058730
commit
f7a81858ea
@ -11,6 +11,7 @@ import { Cache } from '@nocobase/cache';
|
|||||||
import { Model } from '@nocobase/database';
|
import { Model } from '@nocobase/database';
|
||||||
import { InstallOptions, Plugin } from '@nocobase/server';
|
import { InstallOptions, Plugin } from '@nocobase/server';
|
||||||
import { tval } from '@nocobase/utils';
|
import { tval } from '@nocobase/utils';
|
||||||
|
import { tokenPolicyCollectionName, tokenPolicyRecordKey } from '../constants';
|
||||||
import { namespace, presetAuthType, presetAuthenticator } from '../preset';
|
import { namespace, presetAuthType, presetAuthenticator } from '../preset';
|
||||||
import authActions from './actions/auth';
|
import authActions from './actions/auth';
|
||||||
import authenticatorsActions from './actions/authenticators';
|
import authenticatorsActions from './actions/authenticators';
|
||||||
@ -19,7 +20,6 @@ import { AuthModel } from './model/authenticator';
|
|||||||
import { Storer } from './storer';
|
import { Storer } from './storer';
|
||||||
import { TokenBlacklistService } from './token-blacklist';
|
import { TokenBlacklistService } from './token-blacklist';
|
||||||
import { TokenController } from './token-controller';
|
import { TokenController } from './token-controller';
|
||||||
import { tokenPolicyCollectionName, tokenPolicyRecordKey } from '../constants';
|
|
||||||
|
|
||||||
export class PluginAuthServer extends Plugin {
|
export class PluginAuthServer extends Plugin {
|
||||||
cache: Cache;
|
cache: Cache;
|
||||||
@ -139,7 +139,7 @@ export class PluginAuthServer extends Plugin {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.app.on('ws:message:auth:token', async ({ clientId, payload }) => {
|
this.app.on('ws:message:auth:token', async ({ clientId, payload }) => {
|
||||||
if (!payload || !payload.token || !payload.authenticator) {
|
if (!payload || !payload.token) {
|
||||||
this.app.emit(`ws:removeTag`, {
|
this.app.emit(`ws:removeTag`, {
|
||||||
clientId,
|
clientId,
|
||||||
tagKey: 'userId',
|
tagKey: 'userId',
|
||||||
@ -147,7 +147,7 @@ export class PluginAuthServer extends Plugin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auth = await this.app.authManager.get(payload.authenticator, {
|
const auth = await this.app.authManager.get(payload.authenticator || 'basic', {
|
||||||
getBearerToken: () => payload.token,
|
getBearerToken: () => payload.token,
|
||||||
app: this.app,
|
app: this.app,
|
||||||
db: this.app.db,
|
db: this.app.db,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user