fix issues in core
This commit is contained in:
@@ -4,13 +4,12 @@
|
||||
* Manages user session using cookies. This is a placeholder implementation.
|
||||
*/
|
||||
|
||||
import type { AuthenticatedUserDTO } from '@core/identity/application/dto/AuthenticatedUserDTO';
|
||||
import type { AuthSessionDTO } from '@core/identity/application/dto/AuthSessionDTO';
|
||||
import type { IdentitySessionPort } from '@core/identity/application/ports/IdentitySessionPort';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { AuthenticatedUser } from '@core/identity/application/ports/IdentityProviderPort';
|
||||
import type { AuthSession, IdentitySessionPort } from '@core/identity/application/ports/IdentitySessionPort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
export class CookieIdentitySessionAdapter implements IdentitySessionPort {
|
||||
private currentSession: AuthSessionDTO | null = null;
|
||||
private currentSession: AuthSession | null = null;
|
||||
|
||||
constructor(private readonly logger: Logger) {
|
||||
this.logger.info('CookieIdentitySessionAdapter initialized.');
|
||||
@@ -18,14 +17,14 @@ export class CookieIdentitySessionAdapter implements IdentitySessionPort {
|
||||
// For demo, we'll start with no session.
|
||||
}
|
||||
|
||||
async getCurrentSession(): Promise<AuthSessionDTO | null> {
|
||||
async getCurrentSession(): Promise<AuthSession | null> {
|
||||
this.logger.debug('[CookieIdentitySessionAdapter] Getting current session.');
|
||||
return Promise.resolve(this.currentSession);
|
||||
}
|
||||
|
||||
async createSession(user: AuthenticatedUserDTO): Promise<AuthSessionDTO> {
|
||||
async createSession(user: AuthenticatedUser): Promise<AuthSession> {
|
||||
this.logger.debug(`[CookieIdentitySessionAdapter] Creating session for user: ${user.id}`);
|
||||
const newSession: AuthSessionDTO = {
|
||||
const newSession: AuthSession = {
|
||||
user: user,
|
||||
issuedAt: Date.now(),
|
||||
expiresAt: Date.now() + 3600 * 1000, // 1 hour expiration
|
||||
|
||||
Reference in New Issue
Block a user