Skip to content

Commit 68d5a48

Browse files
committed
feat:token generator, controller, service added
1 parent 98c4702 commit 68d5a48

File tree

19 files changed

+539
-93
lines changed

19 files changed

+539
-93
lines changed

.docker-compose/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ services:
3434
container_name: redis
3535
restart: always
3636
ports:
37-
- 9379:9379
37+
- 9379:6379
3838
volumes:
3939
- .docker-volumes/redis/data:/data
4040
command: [ "redis-server", "--appendonly", "yes" , "--requirepass", "root!23" ]

.idea/workspace.xml

Lines changed: 67 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@
5454
<artifactId>spring-boot-starter-data-jpa</artifactId>
5555
</dependency>
5656
<dependency>
57-
<groupId>org.springframework.session</groupId>
58-
<artifactId>spring-session-data-redis</artifactId>
57+
<groupId>org.springframework.boot</groupId>
58+
<artifactId>spring-boot-starter-data-redis</artifactId>
5959
</dependency>
6060
<dependency>
61-
<groupId>org.springframework.kafka</groupId>
62-
<artifactId>spring-kafka</artifactId>
61+
<groupId>org.springframework.session</groupId>
62+
<artifactId>spring-session-data-redis</artifactId>
6363
</dependency>
64+
6465
<dependency>
6566
<groupId>org.springframework.security</groupId>
6667
<artifactId>spring-security-crypto</artifactId>
@@ -77,24 +78,6 @@
7778
<version>42.7.3</version>
7879
</dependency>
7980

80-
<dependency>
81-
<groupId>io.jsonwebtoken</groupId>
82-
<artifactId>jjwt-api</artifactId>
83-
<version>0.12.3</version>
84-
</dependency>
85-
<dependency>
86-
<groupId>io.jsonwebtoken</groupId>
87-
<artifactId>jjwt-impl</artifactId>
88-
<version>0.12.3</version>
89-
<scope>runtime</scope>
90-
</dependency>
91-
<dependency>
92-
<groupId>io.jsonwebtoken</groupId>
93-
<artifactId>jjwt-jackson</artifactId>
94-
<version>0.12.3</version>
95-
<scope>runtime</scope>
96-
</dependency>
97-
9881
<dependency>
9982
<groupId>com.google.api-client</groupId>
10083
<artifactId>google-api-client</artifactId>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.woobeee.artmarketplace.auth.api;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import lombok.Builder;
5+
import org.springframework.http.HttpStatus;
6+
7+
import java.time.LocalDateTime;
8+
9+
@JsonInclude(JsonInclude.Include.NON_NULL)
10+
@Builder
11+
public record ApiResponse<T>(
12+
Header header,
13+
T data
14+
) {
15+
@Builder
16+
public record Header(
17+
boolean isSuccessful,
18+
String message
19+
) {}
20+
21+
public static <T> ApiResponse<T> success(T data, String message) {
22+
return new ApiResponse<>(
23+
new Header(true, message),
24+
data
25+
);
26+
}
27+
28+
public static <T> ApiResponse<T> success(String message) {
29+
return new ApiResponse<>(
30+
new Header(true, message),
31+
null
32+
);
33+
}
34+
35+
public static <T> ApiResponse<T> createSuccess(T data, String message) {
36+
return new ApiResponse<>(
37+
new Header(true, message),
38+
data
39+
);
40+
}
41+
42+
public static <T> ApiResponse<T> createSuccess(String message) {
43+
return new ApiResponse<>(
44+
new Header(true, message),
45+
null
46+
);
47+
}
48+
49+
public static <T> ApiResponse<T> deleteSuccess(T data, String message) {
50+
return new ApiResponse<>(
51+
new Header(true, message),
52+
data
53+
);
54+
}
55+
56+
public static ApiResponse<LocalDateTime> fail(HttpStatus errorCode, String message) {
57+
return new ApiResponse<>(
58+
new Header(false, message),
59+
LocalDateTime.now()
60+
);
61+
}
62+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.woobeee.artmarketplace.auth.api.request;
2+
3+
public record TokenIssueRequest(
4+
Long memberId,
5+
String role,
6+
String device
7+
) {
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.woobeee.artmarketplace.auth.api.request;
2+
3+
public record TokenRefreshRequest(
4+
String refreshToken,
5+
String device
6+
) {
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.woobeee.artmarketplace.auth.api.response;
2+
3+
public record TokenResponse(
4+
String accessToken,
5+
long accessTokenExpiresInSeconds,
6+
String refreshToken,
7+
long refreshTokenExpiresInSeconds
8+
) {
9+
}

0 commit comments

Comments
 (0)