Skip to content

Commit 329bd64

Browse files
feature : make hashcheckservice a selective bean
1 parent b33f99a commit 329bd64

File tree

10 files changed

+177
-132
lines changed

10 files changed

+177
-132
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<dependency>
77
<groupId>io.github.patternknife.securityhelper.oauth2.api</groupId>
88
<artifactId>spring-security-oauth2-password-jpa-implementation</artifactId>
9-
<version>2.7.0</version>
9+
<version>2.8.0</version>
1010
</dependency>
1111
```
1212
* Set up the same access & refresh token APIs on both ``/oauth2/token`` and on our controller layer such as ``/api/v1/traditional-oauth/token``, both of which function same and have `the same request & response payloads for success and errors`. (However, ``/oauth2/token`` is the standard that "spring-authorization-server" provides.)

client/pom.xml

Lines changed: 59 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
77
<modelVersion>4.0.0</modelVersion>
88
<groupId>com.patternknife.securityhelper.oauth2.client</groupId>
99
<artifactId>spring-security-oauth2-password-jpa-implementation-client</artifactId>
10-
<version>2.7.0</version>
10+
<version>2.8.0</version>
1111
<packaging>jar</packaging>
1212

1313
<properties>
@@ -19,8 +19,15 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
1919
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2020
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2121

22-
<querydsl.version>5.0.0</querydsl.version>
23-
<spring-restdocs.version>3.0.0</spring-restdocs.version>
22+
<!-- The versions indicated are just the same as ones in spring-boot-dependencies. In the 1) 'build' section and 2) one with ;<classifier>jakarta</classifier>' don't automatically recognize the dependency management. -->
23+
<spring-boot-dependencies.version>3.3.2</spring-boot-dependencies.version>
24+
<querydsl.version>5.1.0</querydsl.version>
25+
<slf4j.version>2.0.7</slf4j.version>
26+
<querydsl.version>5.1.0</querydsl.version>
27+
<spring-restdocs.version>3.0.1</spring-restdocs.version>
28+
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
29+
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
30+
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
2431
</properties>
2532

2633
<dependencyManagement>
@@ -29,19 +36,19 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
2936
<!-- Import dependency management from Spring Boot -->
3037
<groupId>org.springframework.boot</groupId>
3138
<artifactId>spring-boot-dependencies</artifactId>
32-
<version>3.1.2</version>
39+
<version>${spring-boot-dependencies.version}</version>
3340
<type>pom</type>
3441
<scope>import</scope>
3542
</dependency>
3643
</dependencies>
3744
</dependencyManagement>
3845

39-
4046
<dependencies>
47+
4148
<dependency>
4249
<groupId>io.github.patternknife.securityhelper.oauth2.api</groupId>
4350
<artifactId>spring-security-oauth2-password-jpa-implementation</artifactId>
44-
<version>2.7.0</version>
51+
<version>2.8.0</version>
4552
</dependency>
4653

4754
<!-- DB -->
@@ -58,25 +65,52 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
5865
<scope>runtime</scope>
5966
</dependency>
6067

68+
<!-- 1. Necessary Libraries -->
69+
6170
<dependency>
6271
<groupId>org.projectlombok</groupId>
6372
<artifactId>lombok</artifactId>
64-
<version>1.18.24</version>
73+
<!-- Follow ${spring-boot-dependencies.version} -->
6574
<optional>true</optional>
6675
</dependency>
76+
<!-- Expose API -->
77+
<dependency>
78+
<groupId>org.springframework.boot</groupId>
79+
<artifactId>spring-boot-starter-web</artifactId>
80+
<!-- Follow ${spring-boot-dependencies.version} -->
81+
</dependency>
82+
<!-- Text Utils -->
83+
<dependency>
84+
<groupId>org.codehaus.jackson</groupId>
85+
<artifactId>jackson-jaxrs</artifactId>
86+
<version>1.9.13</version>
87+
</dependency>
88+
<dependency>
89+
<groupId>org.apache.commons</groupId>
90+
<artifactId>commons-lang3</artifactId>
91+
<!-- Follow ${spring-boot-dependencies.version} -->
92+
</dependency>
93+
<!-- Validation -->
94+
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation -->
95+
<dependency>
96+
<groupId>org.springframework.boot</groupId>
97+
<artifactId>spring-boot-starter-validation</artifactId>
98+
<!-- Follow ${spring-boot-dependencies.version} -->
99+
</dependency>
67100

68101

69-
<!-- ORM -->
102+
<!-- 2. This module uses JPA and QueryDSL -->
70103

71104
<dependency>
72105
<groupId>org.springframework.boot</groupId>
73106
<artifactId>spring-boot-starter-data-jpa</artifactId>
107+
<!-- Follow ${spring-boot-dependencies.version} -->
74108
</dependency>
75109

76110
<dependency>
77111
<groupId>com.querydsl</groupId>
78112
<artifactId>querydsl-core</artifactId>
79-
<version>${querydsl.version}</version>
113+
<!-- Follow ${spring-boot-dependencies.version} -->
80114
<exclusions>
81115
<exclusion>
82116
<groupId>com.google.guava</groupId>
@@ -89,91 +123,64 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
89123
</exclusions>
90124
</dependency>
91125

92-
93126
<dependency>
94127
<groupId>com.querydsl</groupId>
95128
<artifactId>querydsl-jpa</artifactId>
96129
<version>${querydsl.version}</version>
130+
<!-- Follow ${spring-boot-dependencies.version} -->
97131
<classifier>jakarta</classifier>
98132
</dependency>
99133

100134
<dependency>
101135
<groupId>com.querydsl</groupId>
102136
<artifactId>querydsl-sql</artifactId>
103-
<version>${querydsl.version}</version>
137+
<!-- Follow ${spring-boot-dependencies.version} -->
104138
</dependency>
105139
<dependency>
106140
<groupId>com.querydsl</groupId>
107141
<artifactId>querydsl-sql-spring</artifactId>
108-
<version>${querydsl.version}</version>
109-
</dependency>
110-
111-
<!-- Expose API -->
112-
113-
<dependency>
114-
<groupId>org.springframework.boot</groupId>
115-
<artifactId>spring-boot-starter-web</artifactId>
142+
<!-- Follow ${spring-boot-dependencies.version} -->
116143
</dependency>
117144

118145

119-
<!-- spring-security & spring-security-oauth2-authorization-server -->
146+
<!-- 3. spring-security & spring-security-oauth2-authorization-server -->
120147

121148
<dependency>
122149
<groupId>org.springframework.boot</groupId>
123150
<artifactId>spring-boot-starter-security</artifactId>
151+
<!-- Follow ${spring-boot-dependencies.version} -->
124152
</dependency>
125153
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-oauth2-authorization-server -->
126154
<dependency>
127155
<groupId>org.springframework.security</groupId>
128156
<artifactId>spring-security-oauth2-authorization-server</artifactId>
129-
<version>1.2.3</version>
157+
<!-- Follow ${spring-boot-dependencies.version} -->
130158
</dependency>
131159

132160

133-
<!-- https://mvnrepository.com/artifact/com.warrenstrange/googleauth -->
134-
<dependency>
135-
<groupId>com.warrenstrange</groupId>
136-
<artifactId>googleauth</artifactId>
137-
<version>1.5.0</version>
138-
</dependency>
139-
140-
<dependency>
141-
<groupId>org.codehaus.jackson</groupId>
142-
<artifactId>jackson-jaxrs</artifactId>
143-
<version>1.9.13</version>
144-
</dependency>
145-
<dependency>
146-
<groupId>org.apache.commons</groupId>
147-
<artifactId>commons-lang3</artifactId>
148-
<version>3.4</version>
149-
</dependency>
150161

151-
<!--TEST-->
162+
<!--4. TEST-->
152163
<dependency>
153164
<groupId>org.springframework.boot</groupId>
154165
<artifactId>spring-boot-starter-test</artifactId>
166+
<!-- Follow ${spring-boot-dependencies.version} -->
155167
<scope>test</scope>
156168
</dependency>
157169

158170
<dependency>
159171
<groupId>org.springframework.security</groupId>
160172
<artifactId>spring-security-test</artifactId>
173+
<!-- Follow ${spring-boot-dependencies.version} -->
161174
<scope>test</scope>
162175
</dependency>
163176

164177
<dependency>
165178
<groupId>org.springframework.restdocs</groupId>
166179
<artifactId>spring-restdocs-mockmvc</artifactId>
180+
<!-- Follow ${spring-boot-dependencies.version} -->
167181
<scope>test</scope>
168182
</dependency>
169183

170-
<!-- Validation -->
171-
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation -->
172-
<dependency>
173-
<groupId>org.springframework.boot</groupId>
174-
<artifactId>spring-boot-starter-validation</artifactId>
175-
</dependency>
176-
177184

178185
<dependency>
179186
<groupId>javax.annotation</groupId>
@@ -184,12 +191,14 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
184191
<dependency>
185192
<groupId>org.slf4j</groupId>
186193
<artifactId>slf4j-api</artifactId>
194+
<!-- Follow ${spring-boot-dependencies.version} -->
187195
</dependency>
188196

189197

190198
<dependency>
191199
<groupId>org.springframework.boot</groupId>
192200
<artifactId>spring-boot-devtools</artifactId>
201+
<!-- Follow ${spring-boot-dependencies.version} -->
193202
<optional>true</optional>
194203
</dependency>
195204

@@ -202,6 +211,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
202211
<plugin>
203212
<groupId>org.springframework.boot</groupId>
204213
<artifactId>spring-boot-maven-plugin</artifactId>
214+
<version>${spring-boot-dependencies.version}</version>
205215
<configuration>
206216
<executable>true</executable>
207217
</configuration>
@@ -225,7 +235,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
225235
<dependency>
226236
<groupId>com.querydsl</groupId>
227237
<artifactId>querydsl-apt</artifactId>
228-
<version>5.0.0</version>
238+
<version>${querydsl.version}</version>
229239
<classifier>jakarta</classifier>
230240
<scope>runtime</scope>
231241
<exclusions>
@@ -264,7 +274,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
264274
</plugin>
265275
<plugin>
266276
<artifactId>maven-resources-plugin</artifactId>
267-
<version>2.7</version>
277+
<version>${maven-resources-plugin.version}</version>
268278
<executions>
269279
<execution>
270280
<id>copy-resources</id>
@@ -290,7 +300,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
290300
<plugin>
291301
<groupId>org.apache.maven.plugins</groupId>
292302
<artifactId>maven-surefire-plugin</artifactId>
293-
<version>2.22.2</version>
303+
<version>${maven-surefire-plugin.version}</version>
294304
<configuration>
295305
<excludes>
296306
<exclude>**/SecretCustomerIntegrationTest.java</exclude>

client/src/main/java/com/patternknife/securityhelper/oauth2/client/domain/customer/api/CustomerApi.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ public Map<String, Boolean> logoutCustomer(HttpServletRequest request) {
103103

104104
@PreAuthorize("@resourceServerAuthorityChecker.hasRole('CUSTOMER_ADMIN')")
105105
@GetMapping("/customers/{id}")
106-
public @Nullable CustomerResDTO.Id getCustomerForAuthorizationTest(@PathVariable final long id)
106+
public CustomerResDTO.Id getCustomerForAuthorizationTest(@PathVariable("id") final long id)
107107
throws ResourceNotFoundException {
108-
return null;
108+
return new CustomerResDTO.Id(id);
109109
}
110110

111111
@PreAuthorize("@resourceServerAuthorityChecker.hasRole('CUSTOMER_ADMIN')")
112112
@PutMapping("/customers/{id}")
113-
public CustomerResDTO.Id update(@PathVariable final long id, @Valid @RequestBody final CustomerReqDTO.Update dto)
113+
public CustomerResDTO.Id update(@PathVariable("id") final long id, @Valid @RequestBody final CustomerReqDTO.Update dto)
114114
throws ResourceNotFoundException {
115115
return customerService.update(id, dto);
116116
}

0 commit comments

Comments
 (0)