묻고 답해요
141만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결CS 지식의 정석 | 디자인패턴 네트워크 운영체제 데이터베이스 자료구조
클라이언트에서 jwt 토큰 핸들링 방식 질문 있습니다.
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.안녕하세요 늘 감사히 잘 듣고 있습니다.localStorage에 토큰을 넣는 방식은 좋은 방식인건가요?저는 XSS (Cross-Site Scripting)와 CSRF (Cross-Site Request Forgery) 같은 해킹 방법에 대비하기 위해, Access Token은 전역 변수로 메모리에 저장하고, Refresh Token은 HttpOnly 및 Secure 속성을 가진 쿠키에 저장하는 것이 좋다고 들었습니다. 저도 프론트엔드 프로젝트를 진행할 때 이와 같은 인증 방식을 채택했습니다.하지만 가끔 LocalStorage에 Access Token과 Refresh Token을 보관하는 경우를 보곤 했습니다. 이 방식에는 제가 모르는 다른 이점이 있는 것인지 궁금합니다.현업에서는 클라이언트에서 jwt 토큰을 어떻게 보관하나요?
-
해결됨Spring Boot JWT Tutorial
토큰반환이 안되는거같아요
회원가입 까지는 db에 값이 잘 들어갔는데 그 정보로 포스트맨을 통해 로그인하려고 하면 아무런 에러없이 토큰도 반환해주지 않는데 어떻게 해결하나요 ㅜ "C:\Program Files\Java\jdk-17\bin\java.exe" -XX:TieredStopAtLevel=1 -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-Dmanagement.endpoints.jmx.exposure.include=*" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.3\lib\idea_rt.jar=60002:C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.3\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\qkral\Desktop\GoJiSik_BE\out\production\classes;C:\Users\qkral\Desktop\GoJiSik_BE\out\production\resources;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.projectlombok\lombok\1.18.28\a2ff5da8bcd8b1b26f36b806ced63213362c6dcc\lombok-1.18.28.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-data-jpa\3.1.2\a37d54373b11d2de70dfb8bcd6612dc63787f4a8\spring-boot-starter-data-jpa-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-security\3.1.2\f51204b86f626c2a7f0d41f88e8e3bd86091dd1d\spring-boot-starter-security-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-validation\3.1.2\1e2f4bdd1913af954d3a929e692807cb3a19b0b4\spring-boot-starter-validation-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\3.1.2\30b824817e764a5a5a1e9fb46e7ace40bcfa3185\spring-boot-starter-web-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\com.h2database\h2\2.1.214\d5c2005c9e3279201e12d4776c948578b16bf8b2\h2-2.1.214.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\io.jsonwebtoken\jjwt-api\0.11.5\f742940045619d06383e7df37b21ac422b476cf1\jjwt-api-0.11.5.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-aop\3.1.2\e882bf8c8853807a8e69cce9465ec12233fb5437\spring-boot-starter-aop-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-jdbc\3.1.2\e864f6a34d620e7e698c115881ea23b08f7125e9\spring-boot-starter-jdbc-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.hibernate.orm\hibernate-core\6.2.6.Final\9c4586a4a2dc721439ee454d5c858c1235b6ecba\hibernate-core-6.2.6.Final.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-jpa\3.1.2\e9507688bc27006a5fb9ae4d13c1a5685354eb4a\spring-data-jpa-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aspects\6.0.11\7b6fcc5d4f06c36c332b7a122dca863163a127d4\spring-aspects-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\3.1.2\c09a48df6fbc2b07b7aef1256b45260a3478b49f\spring-boot-starter-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.security\spring-security-config\6.1.2\f6391123f7c3cb7a158266fc81cc4c82c5c4fe19\spring-security-config-6.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.security\spring-security-web\6.1.2\c1f133de05e895e58b34461f6b1189a8d6a0d56a\spring-security-web-6.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aop\6.0.11\15b85c825558fadb85e3c77779d7225ce7e4a7bc\spring-aop-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-el\10.1.11\97aa65b1f036f722e869f582f8d607d01508d420\tomcat-embed-el-10.1.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.hibernate.validator\hibernate-validator\8.0.1.Final\e49e116b3d3928060599b176b3538bb848718e95\hibernate-validator-8.0.1.Final.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-json\3.1.2\c48d521879dbbcebe1a99f47257612968e022f5b\spring-boot-starter-json-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-webmvc\6.0.11\892b4a63b5d930c2c43058c6db0c2c65401fb078\spring-webmvc-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\3.1.2\2e7284f8ecf2989e1a6ffc7faf964eccb309bfd4\spring-boot-starter-tomcat-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-web\6.0.11\c32a7bf6b88b83bac6aa63866fcf208892640446\spring-web-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.aspectj\aspectjweaver\1.9.19\afbffb1210239fbba5cad73093c5b216d515838f\aspectjweaver-1.9.19.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\com.zaxxer\HikariCP\5.0.1\a74c7f0a37046846e88d54f7cb6ea6d565c65f9c\HikariCP-5.0.1.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jdbc\6.0.11\dc495b5cb8052f044fd29aa68bb2231b1895b8f4\spring-jdbc-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\jakarta.persistence\jakarta.persistence-api\3.1.0\66901fa1c373c6aff65c13791cc11da72060a8d6\jakarta.persistence-api-3.1.0.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\jakarta.transaction\jakarta.transaction-api\2.0.1\51a520e3fae406abb84e2e1148e6746ce3f80a1a\jakarta.transaction-api-2.0.1.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-context\6.0.11\a7b10f3d3c1492bfc4e6d7c966cd2e21f4d441f5\spring-context-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-orm\6.0.11\dde0c5f956052c8c3865e95202dd35b7437b2c6f\spring-orm-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-commons\3.1.2\cf75c8a2a11d24df5bdb4d796d4b449bab3bed07\spring-data-commons-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-tx\6.0.11\59cd03d2ba6968ade8c192b4d6488efb48ec36f\spring-tx-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-beans\6.0.11\8513efc6e94b407b5cd85f69eeec511f1ef34164\spring-beans-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-core\6.0.11\87834b5cf95c6fa28f5bdf8a85e0daf0bff918a8\spring-core-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.antlr\antlr4-runtime\4.10.1\10839f875928f59c622d675091d51a43ea0dc5f7\antlr4-runtime-4.10.1.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\2.1.1\48b9bda22b091b1f48b13af03fe36db3be6e1ae3\jakarta.annotation-api-2.1.1.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\2.0.7\41eb7184ea9d556f23e18b5cb99cad1f8581fc00\slf4j-api-2.0.7.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\3.1.2\ea294976f925441fc1d5a5414d5d31717f06aa3c\spring-boot-autoconfigure-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\3.1.2\3cf070561716277ec91ebadc07362dd0b4a9f63f\spring-boot-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\3.1.2\4e47bd132fdd0d60ad57d70bdc99198b182166ee\spring-boot-starter-logging-3.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.33\2cd0a87ff7df953f810c344bdf2fe3340b954c69\snakeyaml-1.33.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.security\spring-security-core\6.1.2\acd42f051b0f38d043ad807ca542f1f53bfa2fe\spring-security-core-6.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-expression\6.0.11\1d0940120a275719c3988c592068f4acf807fe59\spring-expression-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\jakarta.validation\jakarta.validation-api\3.0.2\92b6631659ba35ca09e44874d3eb936edfeee532\jakarta.validation-api-3.0.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.jboss.logging\jboss-logging\3.5.3.Final\c88fc1d8a96d4c3491f55d4317458ccad53ca663\jboss-logging-3.5.3.Final.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\com.fasterxml\classmate\1.5.1\3fe0bed568c62df5e89f4f174c101eab25345b6c\classmate-1.5.1.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.15.2\30d16ec2aef6d8094c5e2dce1d95034ca8b6cb42\jackson-datatype-jsr310-2.15.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-parameter-names\2.15.2\75f8d2788db20f6c587c7a19e94fb6248c314241\jackson-module-parameter-names-2.15.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.15.2\66a50e089cfd2f93896b9b6f7a734cea7bcf2f31\jackson-datatype-jdk8-2.15.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.15.2\9353b021f10c307c00328f52090de2bdb4b6ff9c\jackson-databind-2.15.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-websocket\10.1.11\ac9ecc8a2b6a2cd8123554259faabc2e7b4aa013\tomcat-embed-websocket-10.1.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-core\10.1.11\9d1ba230cbe0dfb410b0beba102eff20e14793a1\tomcat-embed-core-10.1.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\io.micrometer\micrometer-observation\1.11.2\704e145c4801320b4c7abf6c1a5b000155b069db\micrometer-observation-1.11.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jcl\6.0.11\c9b16cdb6d4874ba4118fcdd4b0335f6278b378\spring-jcl-6.0.11.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.4.8\f00ba91d993e4d14301b11968d3cacc3be7ef3e1\logback-classic-1.4.8.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.20.0\d37f81f8978e2672bc32c82712ab4b3f66624adc\log4j-to-slf4j-2.20.0.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\2.0.7\a48f44aeaa8a5ddc347007298a28173ac1fbbd8b\jul-to-slf4j-2.0.7.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.springframework.security\spring-security-crypto\6.1.2\3acab1c7979cc9d44d5e12e7f5acd4d9552e6b83\spring-security-crypto-6.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.15.2\4724a65ac8e8d156a24898d50fd5dbd3642870b8\jackson-annotations-2.15.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.15.2\a6fe1836469a69b3ff66037c324d75fc66ef137c\jackson-core-2.15.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\io.micrometer\micrometer-commons\1.11.2\f03f87bd7eacf79b00aa89907c6e30e0ec86b4\micrometer-commons-1.11.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.4.8\3fba9c105e0efc5ffdcda701379687917d5286f7\logback-core-1.4.8.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.20.0\1fe6082e660daf07c689a89c94dc0f49c26b44bb\log4j-api-2.20.0.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\io.jsonwebtoken\jjwt-impl\0.11.5\40a599f0e8a8e4e0701596fbb15e67bfda64fdf0\jjwt-impl-0.11.5.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\io.jsonwebtoken\jjwt-jackson\0.11.5\3b83a06809e98a69402d7333dcf67df6f6ea4579\jjwt-jackson-0.11.5.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.hibernate.common\hibernate-commons-annotations\6.0.6.Final\77a5f94b56d49508e0ee334751db5b78e5ccd50c\hibernate-commons-annotations-6.0.6.Final.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\io.smallrye\jandex\3.0.5\c548a4871b552292dbdd65409d3fda145c8925c1\jandex-3.0.5.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy\1.14.5\28a424c0c4f362568e904d992c239c996cf7adc7\byte-buddy-1.14.5.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\jaxb-runtime\4.0.3\93af25be25b2c92c83e0ce61cb8b3ed23568f316\jaxb-runtime-4.0.3.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\jakarta.xml.bind\jakarta.xml.bind-api\4.0.0\bbb399208d288b15ec101fa4fcfc4bd77cedc97a\jakarta.xml.bind-api-4.0.0.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\jakarta.inject\jakarta.inject-api\2.0.1\4c28afe1991a941d7702fe1362c365f0a8641d1e\jakarta.inject-api-2.0.1.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\jaxb-core\4.0.3\e9093b4a82069a1d78ee9a3233ca387bca88861f\jaxb-core-4.0.3.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\jakarta.activation\jakarta.activation-api\2.1.2\640c0d5aff45dbff1e1a1bc09673ff3a02b1ba12\jakarta.activation-api-2.1.2.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.eclipse.angus\angus-activation\2.0.1\eaafaf4eb71b400e4136fc3a286f50e34a68ecb7\angus-activation-2.0.1.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\txw2\4.0.3\47b8fe31c6d1a3382203af919400527389e01e9c\txw2-4.0.3.jar;C:\Users\qkral\.gradle\caches\modules-2\files-2.1\com.sun.istack\istack-commons-runtime\4.1.2\18ec117c85f3ba0ac65409136afa8e42bc74e739\istack-commons-runtime-4.1.2.jar com.likelion.nsu.gojisik.GojisikApplication . ____ _ /\\ / ___'_ __ (_)_ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v3.1.2)2023-08-14T05:24:36.414+09:00 INFO 18164 --- [ main] c.l.nsu.gojisik.GojisikApplication : Starting GojisikApplication using Java 17.0.6 with PID 18164 (C:\Users\qkral\Desktop\GoJiSik_BE\out\production\classes started by qkral in C:\Users\qkral\Desktop\GoJiSik_BE)2023-08-14T05:24:36.417+09:00 INFO 18164 --- [ main] c.l.nsu.gojisik.GojisikApplication : No active profile set, falling back to 1 default profile: "default"2023-08-14T05:24:37.478+09:00 INFO 18164 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.2023-08-14T05:24:37.579+09:00 INFO 18164 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 89 ms. Found 2 JPA repository interfaces.2023-08-14T05:24:38.352+09:00 INFO 18164 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http)2023-08-14T05:24:38.367+09:00 INFO 18164 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]2023-08-14T05:24:38.367+09:00 INFO 18164 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.11]2023-08-14T05:24:38.521+09:00 INFO 18164 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext2023-08-14T05:24:38.522+09:00 INFO 18164 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2049 ms2023-08-14T05:24:38.574+09:00 INFO 18164 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...2023-08-14T05:24:38.669+09:00 INFO 18164 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection conn0: url=jdbc:h2:tcp://localhost/~/GoJiSik_BE1 user=SA2023-08-14T05:24:38.671+09:00 INFO 18164 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.2023-08-14T05:24:38.682+09:00 INFO 18164 --- [ main] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:tcp://localhost/~/GoJiSik_BE1'2023-08-14T05:24:38.881+09:00 INFO 18164 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]2023-08-14T05:24:38.958+09:00 INFO 18164 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.2.6.Final2023-08-14T05:24:38.961+09:00 INFO 18164 --- [ main] org.hibernate.cfg.Environment : HHH000406: Using bytecode reflection optimizer2023-08-14T05:24:39.169+09:00 INFO 18164 --- [ main] o.h.b.i.BytecodeProviderInitiator : HHH000021: Bytecode provider name : bytebuddy2023-08-14T05:24:39.352+09:00 INFO 18164 --- [ main] o.s.o.j.p.SpringPersistenceUnitInfo : No LoadTimeWeaver setup: ignoring JPA class transformer2023-08-14T05:24:39.773+09:00 INFO 18164 --- [ main] o.h.b.i.BytecodeProviderInitiator : HHH000021: Bytecode provider name : bytebuddy2023-08-14T05:24:40.918+09:00 INFO 18164 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]2023-08-14T05:24:40.950+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : drop table if exists answer cascade Hibernate: drop table if exists answer cascade 2023-08-14T05:24:40.953+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : drop table if exists authority cascade Hibernate: drop table if exists authority cascade 2023-08-14T05:24:40.954+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : drop table if exists file cascade Hibernate: drop table if exists file cascade 2023-08-14T05:24:40.955+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : drop table if exists member cascade Hibernate: drop table if exists member cascade 2023-08-14T05:24:40.955+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : drop table if exists question cascade Hibernate: drop table if exists question cascade 2023-08-14T05:24:40.956+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : drop table if exists user_authority cascade Hibernate: drop table if exists user_authority cascade 2023-08-14T05:24:40.957+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : drop sequence if exists answer_seqHibernate: drop sequence if exists answer_seq2023-08-14T05:24:40.957+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : drop sequence if exists file_seqHibernate: drop sequence if exists file_seq2023-08-14T05:24:40.957+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : drop sequence if exists question_seqHibernate: drop sequence if exists question_seq2023-08-14T05:24:40.963+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : create sequence answer_seq start with 1 increment by 50Hibernate: create sequence answer_seq start with 1 increment by 502023-08-14T05:24:40.964+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : create sequence file_seq start with 1 increment by 50Hibernate: create sequence file_seq start with 1 increment by 502023-08-14T05:24:40.964+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : create sequence question_seq start with 1 increment by 50Hibernate: create sequence question_seq start with 1 increment by 502023-08-14T05:24:40.968+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : create table answer ( is_adopted boolean, created_date timestamp(6), id bigint not null, member_id bigint, question_id bigint, contents varchar(255), primary key (id) )Hibernate: create table answer ( is_adopted boolean, created_date timestamp(6), id bigint not null, member_id bigint, question_id bigint, contents varchar(255), primary key (id) )2023-08-14T05:24:40.969+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : create table authority ( authority_name varchar(50) not null, primary key (authority_name) )Hibernate: create table authority ( authority_name varchar(50) not null, primary key (authority_name) )2023-08-14T05:24:40.971+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : create table file ( file_size bigint, id bigint not null, origin_file_name varchar(255), saved_file_name varchar(255), type varchar(255) check (type in ('Image','Audio')), primary key (id) )Hibernate: create table file ( file_size bigint, id bigint not null, origin_file_name varchar(255), saved_file_name varchar(255), type varchar(255) check (type in ('Image','Audio')), primary key (id) )2023-08-14T05:24:40.973+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : create table member ( activated boolean not null, font integer not null, grade tinyint check (grade between 0 and 2), birthday timestamp(6), member_id bigint generated by default as identity, point bigint, password varchar(255), phone_number varchar(255), username varchar(255), primary key (member_id) )Hibernate: create table member ( activated boolean not null, font integer not null, grade tinyint check (grade between 0 and 2), birthday timestamp(6), member_id bigint generated by default as identity, point bigint, password varchar(255), phone_number varchar(255), username varchar(255), primary key (member_id) )2023-08-14T05:24:40.975+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : create table question ( created_date timestamp(6), file_id bigint unique, hits bigint, id bigint not null, user_id bigint, category varchar(255), contents varchar(255), title varchar(255), primary key (id) )Hibernate: create table question ( created_date timestamp(6), file_id bigint unique, hits bigint, id bigint not null, user_id bigint, category varchar(255), contents varchar(255), title varchar(255), primary key (id) )2023-08-14T05:24:40.978+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : create table user_authority ( member_id bigint not null, authority_name varchar(50) not null, primary key (member_id, authority_name) )Hibernate: create table user_authority ( member_id bigint not null, authority_name varchar(50) not null, primary key (member_id, authority_name) )2023-08-14T05:24:40.981+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : alter table if exists answer add constraint FKn2sp5pa6h0u2kixjl2r4vfluf foreign key (member_id) references memberHibernate: alter table if exists answer add constraint FKn2sp5pa6h0u2kixjl2r4vfluf foreign key (member_id) references member2023-08-14T05:24:40.982+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : alter table if exists answer add constraint FK8frr4bcabmmeyyu60qt7iiblo foreign key (question_id) references questionHibernate: alter table if exists answer add constraint FK8frr4bcabmmeyyu60qt7iiblo foreign key (question_id) references question2023-08-14T05:24:40.983+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : alter table if exists question add constraint FK6fsg3647bhqmogxrp2bqksnf3 foreign key (file_id) references fileHibernate: alter table if exists question add constraint FK6fsg3647bhqmogxrp2bqksnf3 foreign key (file_id) references file2023-08-14T05:24:40.985+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : alter table if exists question add constraint FK1f5tvh6o6n30k5h6iqefshhu5 foreign key (user_id) references memberHibernate: alter table if exists question add constraint FK1f5tvh6o6n30k5h6iqefshhu5 foreign key (user_id) references member2023-08-14T05:24:40.986+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : alter table if exists user_authority add constraint FK6ktglpl5mjosa283rvken2py5 foreign key (authority_name) references authorityHibernate: alter table if exists user_authority add constraint FK6ktglpl5mjosa283rvken2py5 foreign key (authority_name) references authority2023-08-14T05:24:40.989+09:00 DEBUG 18164 --- [ main] org.hibernate.SQL : alter table if exists user_authority add constraint FKb27h85xa52amfh4qk85mlxudl foreign key (member_id) references memberHibernate: alter table if exists user_authority add constraint FKb27h85xa52amfh4qk85mlxudl foreign key (member_id) references member2023-08-14T05:24:40.996+09:00 INFO 18164 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'2023-08-14T05:24:41.596+09:00 WARN 18164 --- [ main] ocalVariableTableParameterNameDiscoverer : Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.likelion.nsu.gojisik.repository.UserRepository2023-08-14T05:24:41.845+09:00 WARN 18164 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning2023-08-14T05:24:42.025+09:00 INFO 18164 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter@3fc7abf6, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@1016b44e, org.springframework.security.web.context.SecurityContextHolderFilter@565030b7, org.springframework.security.web.header.HeaderWriterFilter@43c3354, org.springframework.security.web.authentication.logout.LogoutFilter@6bbac73d, org.springframework.web.filter.CorsFilter@5e593b08, com.likelion.nsu.gojisik.security.JwtFilter@6c6c93f8, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@2eb31735, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@73753326, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@38e88e13, org.springframework.security.web.session.SessionManagementFilter@750adad8, org.springframework.security.web.access.ExceptionTranslationFilter@2fafa9bf, org.springframework.security.web.access.intercept.AuthorizationFilter@7ec75228]2023-08-14T05:24:42.643+09:00 INFO 18164 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8081 (http) with context path ''2023-08-14T05:24:42.652+09:00 INFO 18164 --- [ main] c.l.nsu.gojisik.GojisikApplication : Started GojisikApplication in 6.984 seconds (process running for 7.725)2023-08-14T05:24:56.675+09:00 INFO 18164 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'2023-08-14T05:24:56.675+09:00 INFO 18164 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'2023-08-14T05:24:56.677+09:00 INFO 18164 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms2023-08-14T05:24:57.142+09:00 DEBUG 18164 --- [nio-8081-exec-1] org.hibernate.SQL : select m1_0.member_id, m1_0.activated, a1_0.member_id, a1_1.authority_name, m1_0.birthday, m1_0.font, m1_0.grade, m1_0.password, m1_0.phone_number, m1_0.point, m1_0.username from member m1_0 left join (user_authority a1_0 join authority a1_1 on a1_1.authority_name=a1_0.authority_name) on m1_0.member_id=a1_0.member_id where m1_0.username=?Hibernate: select m1_0.member_id, m1_0.activated, a1_0.member_id, a1_1.authority_name, m1_0.birthday, m1_0.font, m1_0.grade, m1_0.password, m1_0.phone_number, m1_0.point, m1_0.username from member m1_0 left join (user_authority a1_0 join authority a1_1 on a1_1.authority_name=a1_0.authority_name) on m1_0.member_id=a1_0.member_id where m1_0.username=?2023-08-14T05:24:57.143+09:00 TRACE 18164 --- [nio-8081-exec-1] org.hibernate.orm.jdbc.bind : binding parameter [1] as [VARCHAR] - [01084912125]2023-08-14T05:25:00.654+09:00 DEBUG 18164 --- [nio-8081-exec-3] org.hibernate.SQL : select m1_0.member_id, m1_0.activated, a1_0.member_id, a1_1.authority_name, m1_0.birthday, m1_0.font, m1_0.grade, m1_0.password, m1_0.phone_number, m1_0.point, m1_0.username from member m1_0 left join (user_authority a1_0 join authority a1_1 on a1_1.authority_name=a1_0.authority_name) on m1_0.member_id=a1_0.member_id where m1_0.username=?Hibernate: select m1_0.member_id, m1_0.activated, a1_0.member_id, a1_1.authority_name, m1_0.birthday, m1_0.font, m1_0.grade, m1_0.password, m1_0.phone_number, m1_0.point, m1_0.username from member m1_0 left join (user_authority a1_0 join authority a1_1 on a1_1.authority_name=a1_0.authority_name) on m1_0.member_id=a1_0.member_id where m1_0.username=?2023-08-14T05:25:00.655+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [1] as [VARCHAR] - [01084912125]2023-08-14T05:25:00.775+09:00 DEBUG 18164 --- [nio-8081-exec-3] org.hibernate.SQL : insert into member (activated,birthday,font,grade,password,phone_number,point,username,member_id) values (?,?,?,?,?,?,?,?,default)Hibernate: insert into member (activated,birthday,font,grade,password,phone_number,point,username,member_id) values (?,?,?,?,?,?,?,?,default)2023-08-14T05:25:00.790+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BOOLEAN] - [true]2023-08-14T05:25:00.790+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [2] as [TIMESTAMP] - [null]2023-08-14T05:25:00.790+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [3] as [INTEGER] - [0]2023-08-14T05:25:00.790+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [4] as [TINYINT] - [null]2023-08-14T05:25:00.790+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [5] as [VARCHAR] - [$2a$10$lXqx/USXvQtMk5U7tGg7.OIcNUGHOSRTGzpigXehAMAahzcYpcHJO]2023-08-14T05:25:00.791+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [6] as [VARCHAR] - [01084912125]2023-08-14T05:25:00.791+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [7] as [BIGINT] - [null]2023-08-14T05:25:00.791+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [8] as [VARCHAR] - [null]2023-08-14T05:25:00.824+09:00 DEBUG 18164 --- [nio-8081-exec-3] org.hibernate.SQL : insert into authority (authority_name) values (?)Hibernate: insert into authority (authority_name) values (?)2023-08-14T05:25:00.825+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [1] as [VARCHAR] - [ROLE_USER]2023-08-14T05:25:00.830+09:00 DEBUG 18164 --- [nio-8081-exec-3] org.hibernate.SQL : insert into user_authority (member_id,authority_name) values (?,?)Hibernate: insert into user_authority (member_id,authority_name) values (?,?)2023-08-14T05:25:00.831+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [1] as [BIGINT] - [1]2023-08-14T05:25:00.831+09:00 TRACE 18164 --- [nio-8081-exec-3] org.hibernate.orm.jdbc.bind : binding parameter [2] as [VARCHAR] - [ROLE_USER]2023-08-14T05:25:04.414+09:00 DEBUG 18164 --- [nio-8081-exec-4] org.hibernate.SQL : select m1_0.member_id, m1_0.activated, a1_0.member_id, a1_1.authority_name, m1_0.birthday, m1_0.font, m1_0.grade, m1_0.password, m1_0.phone_number, m1_0.point, m1_0.username from member m1_0 left join (user_authority a1_0 join authority a1_1 on a1_1.authority_name=a1_0.authority_name) on m1_0.member_id=a1_0.member_id where m1_0.username=?Hibernate: select m1_0.member_id, m1_0.activated, a1_0.member_id, a1_1.authority_name, m1_0.birthday, m1_0.font, m1_0.grade, m1_0.password, m1_0.phone_number, m1_0.point, m1_0.username from member m1_0 left join (user_authority a1_0 join authority a1_1 on a1_1.authority_name=a1_0.authority_name) on m1_0.member_id=a1_0.member_id where m1_0.username=?2023-08-14T05:25:04.414+09:00 TRACE 18164 --- [nio-8081-exec-4] org.hibernate.orm.jdbc.bind : binding parameter [1] as [VARCHAR] - [01084912125]2023-08-14T05:38:49.268+09:00 DEBUG 18164 --- [io-8081-exec-10] org.hibernate.SQL : select m1_0.member_id, m1_0.activated, a1_0.member_id, a1_1.authority_name, m1_0.birthday, m1_0.font, m1_0.grade, m1_0.password, m1_0.phone_number, m1_0.point, m1_0.username from member m1_0 left join (user_authority a1_0 join authority a1_1 on a1_1.authority_name=a1_0.authority_name) on m1_0.member_id=a1_0.member_id where m1_0.username=?Hibernate: select m1_0.member_id, m1_0.activated, a1_0.member_id, a1_1.authority_name, m1_0.birthday, m1_0.font, m1_0.grade, m1_0.password, m1_0.phone_number, m1_0.point, m1_0.username from member m1_0 left join (user_authority a1_0 join authority a1_1 on a1_1.authority_name=a1_0.authority_name) on m1_0.member_id=a1_0.member_id where m1_0.username=?2023-08-14T05:38:49.269+09:00 TRACE 18164 --- [io-8081-exec-10] org.hibernate.orm.jdbc.bind : binding parameter [1] as [VARCHAR] - [01084912125]
-
미해결[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!
회원가입 당시의 토큰 발행 문의 드립니다.
질문1.강좌에는 회원가입이 없는것 같은데요.. 아이디와, 패스워드 입력으로 회원가입을 했다는 전재하에 토큰인증을 하고 있다고 보면되는 건가요?그 아이디와 패스워드는 각각 {test@codefactory.ai:testtest} 으로 사용하는 것으로 보면되는 거죠?질문2.그렇다면 회원가입 시점(id, pw를 db에 저장하는 시점)에 토큰을 발급해 주는 내용을 알 수가 없어서 질문드립니다. db에 id, pw 넣고 토큰을 즉시 발급해 주는 내용이 강좌에 없는것 같습니다. 이부분에 대한 의견을 듣고 싶습니다. 혹시 제가 못 알아보고 있는지도 알고 싶습니다.
-
미해결[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!
토큰 인증 시스템 관련
안녕하세요? 초보부터 중급까지 아주 재미있게 진행해 나가고 있습니다.강의와 직접적인 연관은 아니지만, 간접적인 연관인 부분이 궁금해서 질문 드립니다.클라이언트 기반의 로직은 대부분 강의에 나와 있어서 프로세스가 이해가 되는데요.서버쪽은 대략은 짐작이 되나, 구체적으로 어떻게 돌아가는지 알고 싶은데, 어떤 자료를 어디서 참고해야 될지 조언을 구합니다.예를 들면 인증 API 중에 /auth/login API를 사용하면 정해진 유저 (test@codefactory.ai:testtest)에 대해 Base64로 인코딩된 값으로 서버로 던지면서버에서 디코딩해서 원래의 값을 찾은 후 DB를 검색할 거 같은데,PPT에 설명해주신 자료에 보면 DB를 사용하지 않는다? 라고 하셔서 그럼 어떻게 인증을 하지? 라는 궁금증이 생겼습니다.결론적으로 토큰기반 인증시스템에 대해 서버쪽 프로세스를 알고 싶은데, 관련 자료 알고 계신부분이 있다면 조언 부탁드립니다.아울러 자바 (또는 스프링) 기반의 샘플 소스 코드도 있다면 더욱 좋고요..두서 없이 질문 드려서 죄송합니다.
-
미해결
refresh token 저장 및 관리에 대한 고찰
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 안녕하세요. 지나가던 개발자 1입니다. 현재 고민중인 부분에 있어 다른 분들의 의견을 얻고자 글 남겨봅니다. 일반적으로 소셜로그인을 구현한다고 하면 여러 방법이 존재합니다. 모바일을 이용한 소셜로그인을 구현한다고 하면, Firebase을 이용하여 구현할수도있고 웹페이지에서 소셜로그인을 구현한다고 하면 OAuth2.0 방식을 이용하여 각각의 Resource server 에서 access token을 받아 구현할수도 있습니다. 이런 소셜로그인을 구현하기에 앞서 토큰 관리에 대해 고민중입니다. access token을 이용할때 탈취의 위험성및 여러 이유들로 기한을 짧게 가져가게 됩니다, 혹은 제공되어지는 access token의 유효시간은 매우 짧습니다. 이런 부분을 보완하고자 refresh token을 이용하게 되는데 결국 이 refresh token이 노출되게되면 위험요소가 발생하게 됩니다. 그럼 이 refresh token을 어디에 저장하는게 가장 좋을까요? Server session에 저장후 Timeout을 걸어 만료되게끔 한다던가, Database에 저장하여 API 요청으로 Index값이 출력되게끔 한다던가, 여러 방안을 고민중인데 혹시 다른분들은 어떤식으로 생각하시는지 의견을 듣고자 합니다. 긴 글 읽어주셔서 감사합니다.
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
토큰저장위치에 관하여
안녕하세요, 강의 듣다가 질문드립니다. cookie-parser를 이용하여 client의 cookie에 토큰을 넣는 것으로 이해하였는데 왜 mongoDB에도 token이 저장되는 것인가요?? 또한 사용자가 logout했을때, client쪽의 token을 지워버리면 안되는 것인가요?? **우선 왜 DB에 토큰이 저장되는지 모르겠습니다!!**