fix(big fix upgrade): upgrade multiple areas of the core functionalities
This commit is contained in:
@@ -28,6 +28,10 @@ export class CloudlyAuthManager {
|
||||
this.cloudlyRef.typedrouter.addTypedRouter(this.typedrouter);
|
||||
}
|
||||
|
||||
public async createNewSecureToken() {
|
||||
return plugins.smartunique.uniSimple('secureToken', 64);
|
||||
}
|
||||
|
||||
public async start() {
|
||||
// lets setup the smartjwtInstance
|
||||
this.smartjwtInstance = new plugins.smartjwt.SmartJwt();
|
||||
@@ -53,6 +57,7 @@ export class CloudlyAuthManager {
|
||||
const user = await User.findUserByUsernameAndPassword(dataArg.username, dataArg.password);
|
||||
if (!user) {
|
||||
logger.log('warn', 'login failed');
|
||||
throw new plugins.typedrequest.TypedResponseError('login failed');
|
||||
} else {
|
||||
jwt = await this.smartjwtInstance.createJWT({
|
||||
userId: user.id,
|
||||
@@ -96,7 +101,7 @@ export class CloudlyAuthManager {
|
||||
});
|
||||
|
||||
public adminIdentityGuard = new plugins.smartguard.Guard<{identity: plugins.servezoneInterfaces.data.IIdentity}>(async (dataArg) => {
|
||||
await plugins.smartexpect.expectAsync(this.validIdentityGuard.exec(dataArg)).toBeTrue();
|
||||
await plugins.smartguard.passGuardsOrReject(dataArg, [this.validIdentityGuard]);
|
||||
const jwt = dataArg.identity.jwt;
|
||||
const jwtData: IJwtData = await this.smartjwtInstance.verifyJWTAndGetData(jwt);
|
||||
const user = await this.CUser.getInstance({id: jwtData.userId});
|
||||
|
Reference in New Issue
Block a user