質問編集履歴
1
<code>を見やすいようにしました
test
CHANGED
File without changes
|
test
CHANGED
@@ -184,21 +184,97 @@
|
|
184
184
|
|
185
185
|
|
186
186
|
|
187
|
+
```
|
188
|
+
|
187
189
|
**UserDetailsServiceImpl**
|
188
190
|
|
191
|
+
```Java
|
192
|
+
|
193
|
+
package co.jp.yuki.koike.sample.domain.service.user;
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
/**
|
198
|
+
|
199
|
+
* UserDetails実装クラス
|
200
|
+
|
201
|
+
*/
|
202
|
+
|
203
|
+
public class UserDetailsServiceImpl implements UserDetailsService {
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
/**
|
208
|
+
|
209
|
+
* Logger
|
210
|
+
|
211
|
+
*/
|
212
|
+
|
213
|
+
private final static Logger logger =
|
214
|
+
|
215
|
+
LoggerFactory.getLogger("co.jp.yuki.koike.sample.app.controller.UserDetailsServiceImpl");
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
/**
|
220
|
+
|
221
|
+
* UserRepository
|
222
|
+
|
223
|
+
*/
|
224
|
+
|
225
|
+
@Autowired
|
226
|
+
|
227
|
+
UserRepository userRepository;
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
/*
|
232
|
+
|
233
|
+
* (非 Javadoc)
|
234
|
+
|
235
|
+
* @see org.springframework.security.core.userdetails.UserDetailsService#loadUserByUsername(java.lang.String)
|
236
|
+
|
237
|
+
*/
|
238
|
+
|
239
|
+
@Override
|
240
|
+
|
241
|
+
public UserDetails loadUserByUsername(String username)
|
242
|
+
|
243
|
+
throws UsernameNotFoundException {
|
244
|
+
|
245
|
+
User user = Optional.ofNullable(userRepository.findOne(username))
|
246
|
+
|
247
|
+
.orElseThrow(() -> new UsernameNotFoundException(username + " is not found."));
|
248
|
+
|
249
|
+
logger.debug("userId = " + user.getUserId() + "%n" + "password = " + user.getPassword());
|
250
|
+
|
251
|
+
return new UserDetailsImpl(user);
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
}
|
256
|
+
|
257
|
+
|
258
|
+
|
189
259
|
```
|
190
260
|
|
261
|
+
|
262
|
+
|
263
|
+
```Java
|
264
|
+
|
191
|
-
package co.jp.yuki.koike.sample.
|
265
|
+
package co.jp.yuki.koike.sample.app.controller;
|
192
266
|
|
193
267
|
|
194
268
|
|
195
269
|
/**
|
196
270
|
|
197
|
-
*
|
271
|
+
* 位置情報取得画面コントローラー
|
198
272
|
|
199
273
|
*/
|
200
274
|
|
275
|
+
@Controller
|
276
|
+
|
201
|
-
public class
|
277
|
+
public class GettingLocationController {
|
202
278
|
|
203
279
|
|
204
280
|
|
@@ -210,43 +286,29 @@
|
|
210
286
|
|
211
287
|
private final static Logger logger =
|
212
288
|
|
213
|
-
LoggerFactory.getLogger("co.jp.yuki.koike.sample.app.controller.
|
289
|
+
LoggerFactory.getLogger("co.jp.yuki.koike.sample.app.controller.LoginFormController");
|
214
|
-
|
215
|
-
|
216
|
-
|
290
|
+
|
291
|
+
|
292
|
+
|
217
|
-
/**
|
293
|
+
/**
|
218
|
-
|
294
|
+
|
219
|
-
*
|
295
|
+
* 位置情報取得画面のView名を返す
|
296
|
+
|
220
|
-
|
297
|
+
*
|
298
|
+
|
299
|
+
* @return 位置情報取得画面のView名
|
300
|
+
|
221
|
-
*/
|
301
|
+
*/
|
222
|
-
|
223
|
-
|
302
|
+
|
224
|
-
|
225
|
-
UserRepository userRepository;
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
/*
|
230
|
-
|
231
|
-
* (非 Javadoc)
|
232
|
-
|
233
|
-
* @see org.springframework.security.core.userdetails.UserDetailsService#loadUserByUsername(java.lang.String)
|
234
|
-
|
235
|
-
*/
|
236
|
-
|
237
|
-
@Override
|
238
|
-
|
239
|
-
|
303
|
+
@RequestMapping("/gettingLocation")
|
240
|
-
|
304
|
+
|
241
|
-
|
305
|
+
String gettingLocation() {
|
242
|
-
|
243
|
-
|
306
|
+
|
244
|
-
|
245
|
-
|
307
|
+
logger.info("enter GettingLocationController.");
|
246
|
-
|
308
|
+
|
247
|
-
logger.
|
309
|
+
logger.info("exit GettingLocationController.");
|
248
|
-
|
310
|
+
|
249
|
-
return
|
311
|
+
return "gettingLocation";
|
250
312
|
|
251
313
|
}
|
252
314
|
|
@@ -254,60 +316,4 @@
|
|
254
316
|
|
255
317
|
|
256
318
|
|
257
|
-
```Java
|
258
|
-
|
259
|
-
package co.jp.yuki.koike.sample.app.controller;
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
/**
|
264
|
-
|
265
|
-
* 位置情報取得画面コントローラー
|
266
|
-
|
267
|
-
*/
|
268
|
-
|
269
|
-
@Controller
|
270
|
-
|
271
|
-
public class GettingLocationController {
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
/**
|
276
|
-
|
277
|
-
* Logger
|
278
|
-
|
279
|
-
*/
|
280
|
-
|
281
|
-
private final static Logger logger =
|
282
|
-
|
283
|
-
LoggerFactory.getLogger("co.jp.yuki.koike.sample.app.controller.LoginFormController");
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
/**
|
288
|
-
|
289
|
-
* 位置情報取得画面のView名を返す
|
290
|
-
|
291
|
-
*
|
292
|
-
|
293
|
-
* @return 位置情報取得画面のView名
|
294
|
-
|
295
|
-
*/
|
296
|
-
|
297
|
-
@RequestMapping("/gettingLocation")
|
298
|
-
|
299
|
-
String gettingLocation() {
|
300
|
-
|
301
|
-
logger.info("enter GettingLocationController.");
|
302
|
-
|
303
|
-
logger.info("exit GettingLocationController.");
|
304
|
-
|
305
|
-
return "gettingLocation";
|
306
|
-
|
307
|
-
}
|
308
|
-
|
309
|
-
}
|
310
|
-
|
311
|
-
|
312
|
-
|
313
319
|
```
|