feat: integrate Kakao OAuth for user authentication and enhance user repository
- Added Kakao OAuth client implementation for handling authentication flows. - Updated user repository to support OAuth-based user creation and retrieval. - Introduced Redis-based session management for OAuth sessions. - Enhanced in-memory user repository to handle OAuth user data. - Updated environment configuration files to include new OAuth settings. - Modified API routes to support Kakao login and registration flows. - Added Prisma schema updates for user model to accommodate OAuth fields. - Implemented tests for the new authentication flow and user repository methods.
This commit is contained in:
@@ -4,6 +4,10 @@ export interface UserRecord {
|
||||
displayName: string;
|
||||
roles: string[];
|
||||
sanctions: UserSanctions;
|
||||
oauthType: 'NONE' | 'KAKAO';
|
||||
oauthId?: string;
|
||||
email?: string;
|
||||
oauthInfo?: UserOAuthInfo;
|
||||
passwordHash: string;
|
||||
passwordSalt: string;
|
||||
createdAt: string;
|
||||
@@ -38,10 +42,28 @@ export interface CreateUserInput {
|
||||
username: string;
|
||||
password: string;
|
||||
displayName?: string;
|
||||
oauth?: {
|
||||
type: 'KAKAO';
|
||||
id: string;
|
||||
email: string;
|
||||
info: UserOAuthInfo;
|
||||
};
|
||||
}
|
||||
|
||||
export interface UserRepository {
|
||||
findByUsername(username: string): Promise<UserRecord | null>;
|
||||
findByOauthId(type: 'KAKAO', oauthId: string): Promise<UserRecord | null>;
|
||||
findByEmail(email: string): Promise<UserRecord | null>;
|
||||
createUser(input: CreateUserInput): Promise<UserRecord>;
|
||||
verifyPassword(user: UserRecord, password: string): Promise<boolean>;
|
||||
updatePassword(userId: string, password: string): Promise<void>;
|
||||
updateOAuthInfo(userId: string, oauthInfo: UserOAuthInfo): Promise<void>;
|
||||
}
|
||||
|
||||
export interface UserOAuthInfo {
|
||||
accessToken?: string;
|
||||
refreshToken?: string;
|
||||
accessTokenValidUntil?: string;
|
||||
refreshTokenValidUntil?: string;
|
||||
nextPasswordChange?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user