fix auth test

This commit is contained in:
dswbx
2024-11-21 08:30:29 +01:00
parent 0df5c761ec
commit c75add2058
2 changed files with 14 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ describe("AppAuth", () => {
await auth.build(); await auth.build();
const config = auth.toJSON(); const config = auth.toJSON();
expect(config.jwt).toBeUndefined(); expect(config.jwt.secret).toBeUndefined();
expect(config.strategies.password.config).toBeUndefined(); expect(config.strategies.password.config).toBeUndefined();
}); });

View File

@@ -1,6 +1,6 @@
import { type AuthAction, Authenticator, type ProfileExchange, Role, type Strategy } from "auth"; import { type AuthAction, Authenticator, type ProfileExchange, Role, type Strategy } from "auth";
import { Exception } from "core"; import { Exception } from "core";
import { Const, StringRecord, Type, transformObject } from "core/utils"; import { transformObject } from "core/utils";
import { import {
type Entity, type Entity,
EntityIndex, EntityIndex,
@@ -263,7 +263,17 @@ export class AppAuth extends Module<typeof authConfigSchema> {
return this.configDefault; return this.configDefault;
} }
// fixes freezed config object const obj = {
return mergeWith({ ...this.config }, this.authenticator.toJSON(secrets)); ...this.config,
...this.authenticator.toJSON(secrets)
};
return {
...obj,
jwt: {
...obj.jwt,
fields: this.config.jwt.fields
}
};
} }
} }