Kotlin

💡 본격적으로 JWT를 활용하여 로그인을 구현한다. 해당 장에서는 refreshToken 을 고려하지 않는다! (다음 장에서 구현 예정 ✅) ➡️ 1탄 바로가기: SpringSecurity 설정 및 회원가입 ➡️ 3탄 바로가기: RefreshToken CustomUser 생성 SpringSecurity에서 사용하는 `User` 클래스를 상속받아, 대체할 수 있는 `CustomUser` 클래스 생성 //CustomUser.kt class CustomUser ( val id: UUID, userName: String, password: String, authorities: Collection ): User(userName, password, authorities) CustomUserDetailsService..
💡 JWT + SpringSecurity를 사용하여 회원가입 Rest API 구현 ➡️ 2탄 바로가기: JWT 로그인 및 회원 정보 조회 ➡️ 3탄 바로가기: Refresh Token 개발환경 SpringBoot 3.1.4 kotlin / java 17 MariaDB 기본 JPA 설정은 다루지 않는다. 미리 설정한 상태의 프로젝트임을 가정!!! 1. build.gradle.kts 설정 dependencies { ... implementation("org.springframework.boot:spring-boot-starter-security") implementation("io.jsonwebtoken:jjwt-api:0.11.5") runtimeOnly("io.jsonwebtoken:jjwt-impl:0..
문제 https://leetcode.com/problems/find-eventual-safe-states/description/ 각 노드의 라벨이 0부터 n-1까지 붙어있는 n개의 노드로 이루어진 방향 그래프가 있다. 그래프는 0-indexed 인 이차원 정수 배열 `graph`로 표현되고, graph[i]는 노드 i와 인접한 정수 배열이다. 즉, 노드 i로부터 grape[i]에 있는 노드들 간에는 간선이 존재한다. 만약 한 노드에서 나가는 간선이 없다면 해당 노드는 terminal node이다. 한 노드가 safe node라는 것은 해당 노드로부터 시작하는 모든 가능한 경로가 terminal node 혹은 다른 safe node로 이어진다는 것이다. 그래프의 모든 safe node를 포함하는 배열을 ..
문제 https://leetcode.com/problems/minimum-depth-of-binary-tree/description/ 주어진 이진트리에서 트리의 최소 깊이를 구하여라. 최소 깊이는 루트 노드부터 가장 가까운 리프 노드까지 내려가는 최단 거리에 있는 노드의 수이다. Note: 리프 노드는 자식 노드를 가지고 있지 않다. 풀이 1. BFS - 너비 우선 탐색 fun minDepth(root: TreeNode?): Int { if(root == null) return 0 val q = ArrayDeque() q.add(root) var depth = 1 while (q.isNotEmpty()) { val curSize = q.size repeat(curSize) { val curNode = q..
점이
'Kotlin' 태그의 글 목록 (3 Page)