38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/web/error/EmailAlreadyExistException.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.web.error;
27 |
28 | /**
29 | * @author 박경서 (Kyungseo.Park@gmail.com)
30 | * @version 1.0
31 | */
32 | @SuppressWarnings("serial")
33 | public class EmailAlreadyExistException extends Throwable {
34 |
35 | public EmailAlreadyExistException(final String message) {
36 | super(message);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/resources/templates/view/sample/th/string.html:
--------------------------------------------------------------------------------
1 |
22 |
23 |
24 |
25 |
26 |
27 | Example String
28 |
29 |
30 |
31 |
text
32 |
neo
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/dto/request/DeviceInfo.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.security.dto.request;
24 |
25 | import javax.validation.constraints.NotBlank;
26 | import javax.validation.constraints.NotNull;
27 |
28 | import lombok.Getter;
29 |
30 | /**
31 | * @author 박경서 (Kyungseo.Park@gmail.com)
32 | * @version 1.0
33 | */
34 | @Getter
35 | public class DeviceInfo {
36 |
37 | @NotBlank(message = "Device id 항목은 필수 값입니다.")
38 | private String deviceId;
39 |
40 | @NotNull(message = "Device id 항목은 필수 값입니다.")
41 | private String deviceType;
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/resources/templates/view/common/fileupload/from_file.html:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/converter/StringTrimConverter.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.converter;
24 |
25 | import org.springframework.core.convert.converter.Converter;
26 | import org.springframework.stereotype.Component;
27 |
28 | /**
29 | * @author 박경서 (Kyungseo.Park@gmail.com)
30 | * @version 1.0
31 | */
32 | @Component
33 | public class StringTrimConverter implements Converter {
34 |
35 | @Override
36 | public String convert(String source) {
37 | if (source == null) return source;
38 | return source.trim();
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/site/common/web/controller/SwaggerRedirector.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.site.common.web.controller;
24 |
25 | import org.springframework.stereotype.Controller;
26 | import org.springframework.web.bind.annotation.GetMapping;
27 | import org.springframework.web.bind.annotation.RequestMapping;
28 |
29 | /**
30 | * @author 박경서 (Kyungseo.Park@gmail.com)
31 | * @version 1.0
32 | */
33 | @Controller
34 | @RequestMapping("/api/usage")
35 | public class SwaggerRedirector {
36 | @GetMapping
37 | public String api() { return "redirect:/swagger-ui/index.html"; }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/dto/response/UserProfile.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.security.dto.response;
24 |
25 | import lombok.AllArgsConstructor;
26 | import lombok.Getter;
27 | import lombok.NoArgsConstructor;
28 | import lombok.Setter;
29 |
30 | /**
31 | * @author 박경서 (Kyungseo.Park@gmail.com)
32 | * @version 1.0
33 | */
34 | @Getter
35 | @Setter
36 | @NoArgsConstructor
37 | @AllArgsConstructor
38 | public class UserProfile {
39 |
40 | private Long id;
41 |
42 | private String email;
43 |
44 | private String membername;
45 |
46 | private Boolean active;
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/config/ServiceConfig.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.config;
27 |
28 | import org.springframework.context.annotation.ComponentScan;
29 | import org.springframework.context.annotation.Configuration;
30 |
31 | /**
32 | * @author 박경서 (Kyungseo.Park@gmail.com)
33 | * @version 1.0
34 | */
35 | @Configuration
36 | @ComponentScan({ "kyungseo.poc.simple.web.security.service" })
37 | public class ServiceConfig {
38 |
39 | //
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/resources/static/vendor/bootstrap3-dialog-1.35.3/examples/play/reopen-dialog.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Reopen Dialog
11 |
12 |
13 |
14 |
15 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/dto/request/TokenRefreshRequest.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.security.dto.request;
24 |
25 | import javax.validation.constraints.NotBlank;
26 |
27 | import lombok.AllArgsConstructor;
28 | import lombok.Getter;
29 | import lombok.NoArgsConstructor;
30 | import lombok.Setter;
31 |
32 | /**
33 | * @author 박경서 (Kyungseo.Park@gmail.com)
34 | * @version 1.0
35 | */
36 | @Getter
37 | @Setter
38 | @AllArgsConstructor
39 | @NoArgsConstructor
40 | public class TokenRefreshRequest {
41 |
42 | @NotBlank(message = "Refresh token은 필수 값입니다.")
43 | private String refreshToken;
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/resources/static/vendor/bootstrap3-dialog-1.35.3/css/bootstrap-dialog.min.css:
--------------------------------------------------------------------------------
1 | .bootstrap-dialog .modal-header{border-top-left-radius:4px;border-top-right-radius:4px}.bootstrap-dialog .bootstrap-dialog-title{color:#fff;display:inline-block;font-size:16px}.bootstrap-dialog .bootstrap-dialog-message{font-size:14px}.bootstrap-dialog .bootstrap-dialog-button-icon{margin-right:3px}.bootstrap-dialog .bootstrap-dialog-close-button{font-size:20px;float:right;opacity:.9;filter:alpha(opacity=90)}.bootstrap-dialog .bootstrap-dialog-close-button:hover{cursor:pointer;opacity:1;filter:alpha(opacity=100)}.bootstrap-dialog.type-default .modal-header{background-color:#fff}.bootstrap-dialog.type-default .bootstrap-dialog-title{color:#333}.bootstrap-dialog.type-info .modal-header{background-color:#5bc0de}.bootstrap-dialog.type-primary .modal-header{background-color:#337ab7}.bootstrap-dialog.type-success .modal-header{background-color:#5cb85c}.bootstrap-dialog.type-warning .modal-header{background-color:#f0ad4e}.bootstrap-dialog.type-danger .modal-header{background-color:#d9534f}.bootstrap-dialog.size-large .bootstrap-dialog-title{font-size:24px}.bootstrap-dialog.size-large .bootstrap-dialog-close-button{font-size:30px}.bootstrap-dialog.size-large .bootstrap-dialog-message{font-size:18px}.bootstrap-dialog .icon-spin{display:inline-block;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/validation/ValidationMarkers.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.validation;
24 |
25 | /**
26 | * Validation Markers interface for @Validated annotation
27 | *
28 | * @author 박경서 (Kyungseo.Park@gmail.com)
29 | * @version 1.0
30 | */
31 | public interface ValidationMarkers {
32 |
33 | // Validation Marker for Create-request
34 | interface Create {}
35 |
36 | // Validation Marker for Retrieve-request
37 | interface Retrieve {}
38 |
39 | // Validation Marker for Update-request
40 | interface Update {}
41 |
42 | // Validation Marker for Delete-request
43 | interface Delete {}
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/dto/SessionScopeModel.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.security.dto;
24 |
25 | import org.springframework.stereotype.Component;
26 | import org.springframework.web.context.annotation.SessionScope;
27 |
28 | import lombok.Getter;
29 | import lombok.Setter;
30 | import lombok.ToString;
31 |
32 | /**
33 | * @author 박경서 (Kyungseo.Park@gmail.com)
34 | * @version 1.0
35 | */
36 | @SessionScope
37 | @Component
38 | @Getter
39 | @Setter
40 | @ToString
41 | public class SessionScopeModel {
42 |
43 | private String membername;
44 |
45 | private String password;
46 |
47 | private String role;
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/data/enums/ExcelColumnType.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.data.enums;
24 |
25 | /**
26 | * @author 박경서 (Kyungseo.Park@gmail.com)
27 | * @version 1.0
28 | */
29 | public enum ExcelColumnType {
30 |
31 | /** Column type : String */
32 | STRING
33 | /** Column type : Integer */
34 | , INTEGER
35 | /** Column type : Double */
36 | , DOUBLE
37 | /** Column type : Date (yyyy-MM-dd) */
38 | , DATE
39 | /** Column type : Date (yyyy-MM-dd HH:mm) */
40 | , DATEHHMM
41 | /** Column type : Date (yyyy-MM-dd HH:mm:ss) */
42 | , DATETIME
43 | /** Column type : Header */
44 | , HEADER
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/annotation/profile/Dev.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.annotation.profile;
24 |
25 | import static java.lang.annotation.ElementType.METHOD;
26 | import static java.lang.annotation.ElementType.TYPE;
27 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
28 |
29 | import java.lang.annotation.Retention;
30 | import java.lang.annotation.Target;
31 |
32 | import org.springframework.context.annotation.Profile;
33 |
34 | /**
35 | * @author 박경서 (Kyungseo.Park@gmail.com)
36 | * @version 1.0
37 | */
38 | @Retention(RUNTIME)
39 | @Target({ TYPE, METHOD })
40 | @Profile("dev")
41 | public @interface Dev {
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/annotation/profile/Local.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.annotation.profile;
24 |
25 | import static java.lang.annotation.ElementType.METHOD;
26 | import static java.lang.annotation.ElementType.TYPE;
27 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
28 |
29 | import java.lang.annotation.Retention;
30 | import java.lang.annotation.Target;
31 |
32 | import org.springframework.context.annotation.Profile;
33 |
34 | /**
35 | * @author 박경서 (Kyungseo.Park@gmail.com)
36 | * @version 1.0
37 | */
38 | @Retention(RUNTIME)
39 | @Target({ TYPE, METHOD })
40 | @Profile("local")
41 | public @interface Local {
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/annotation/profile/Prod.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.annotation.profile;
24 |
25 | import static java.lang.annotation.ElementType.METHOD;
26 | import static java.lang.annotation.ElementType.TYPE;
27 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
28 |
29 | import java.lang.annotation.Retention;
30 | import java.lang.annotation.Target;
31 |
32 | import org.springframework.context.annotation.Profile;
33 |
34 | /**
35 | * @author 박경서 (Kyungseo.Park@gmail.com)
36 | * @version 1.0
37 | */
38 | @Retention(RUNTIME)
39 | @Target({ TYPE, METHOD })
40 | @Profile("prod")
41 | public @interface Prod {
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/site/sample/persistence/mapper/ds1/CustomerMapper.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.site.sample.persistence.mapper.ds1;
24 |
25 | import java.util.List;
26 |
27 | import org.apache.ibatis.annotations.Mapper;
28 |
29 | import kyungseo.poc.simple.web.site.sample.model.Customer;
30 |
31 | /**
32 | * @author 박경서 (Kyungseo.Park@gmail.com)
33 | * @version 1.0
34 | */
35 | @Mapper
36 | public interface CustomerMapper {
37 |
38 | List selectCustomer(Integer customerId);
39 |
40 | void insertCustomer(Customer customer);
41 |
42 | void updateCustomer(Customer customer);
43 |
44 | void deleteCustomer(int customerId);
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/resources/templates/view/sample/th/list.html:
--------------------------------------------------------------------------------
1 |
22 |
23 |
24 |
25 |
26 |
27 | Example list
28 |
29 |
30 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/persistence/repository/ds1/JwtRefreshTokenRepository.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.security.persistence.repository.ds1;
24 |
25 | import java.util.Optional;
26 |
27 | import org.springframework.data.jpa.repository.JpaRepository;
28 |
29 | import kyungseo.poc.simple.web.security.persistence.entity.ds1.JwtRefreshToken;
30 |
31 | /**
32 | * @author 박경서 (Kyungseo.Park@gmail.com)
33 | * @version 1.0
34 | */
35 | public interface JwtRefreshTokenRepository extends JpaRepository {
36 |
37 | @Override
38 | Optional findById(Long id);
39 |
40 | Optional findByToken(String token);
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/dto/file/MultiFileBucket.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.dto.file;
24 |
25 | import java.util.ArrayList;
26 | import java.util.List;
27 |
28 | /**
29 | * @author 박경서 (Kyungseo.Park@gmail.com)
30 | * @version 1.0
31 | */
32 | public class MultiFileBucket {
33 |
34 | List files = new ArrayList();
35 |
36 | public MultiFileBucket() {
37 | files.add(new FileBucket());
38 | files.add(new FileBucket());
39 | files.add(new FileBucket());
40 | }
41 |
42 | public List getFiles() {
43 | return files;
44 | }
45 |
46 | public void setFiles(List files) {
47 | this.files = files;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/persistence/repository/ds1/RoleRepository.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.persistence.repository.ds1;
27 |
28 | import org.springframework.data.jpa.repository.JpaRepository;
29 |
30 | import kyungseo.poc.simple.web.security.persistence.entity.ds1.Role;
31 |
32 | /**
33 | * @author 박경서 (Kyungseo.Park@gmail.com)
34 | * @version 1.0
35 | */
36 | public interface RoleRepository extends JpaRepository {
37 |
38 | Role findByName(String name);
39 |
40 | @Override
41 | void delete(Role role);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/config/SpringTaskConfig.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.config;
27 |
28 | import org.springframework.context.annotation.Configuration;
29 | import org.springframework.context.annotation.ComponentScan;
30 | import org.springframework.scheduling.annotation.EnableScheduling;
31 |
32 | /**
33 | * @author 박경서 (Kyungseo.Park@gmail.com)
34 | * @version 1.0
35 | */
36 | @Configuration
37 | @EnableScheduling
38 | @ComponentScan({ "kyungseo.poc.simple.web.security.task" })
39 | public class SpringTaskConfig {
40 |
41 | //
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/service/CurrentUser.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.security.service;
24 |
25 | import java.lang.annotation.Documented;
26 | import java.lang.annotation.ElementType;
27 | import java.lang.annotation.Retention;
28 | import java.lang.annotation.RetentionPolicy;
29 | import java.lang.annotation.Target;
30 |
31 | import org.springframework.security.core.annotation.AuthenticationPrincipal;
32 |
33 | /**
34 | * @author 박경서 (Kyungseo.Park@gmail.com)
35 | * @version 1.0
36 | */
37 | @Target({ElementType.PARAMETER, ElementType.TYPE})
38 | @Retention(RetentionPolicy.RUNTIME)
39 | @Documented
40 | @AuthenticationPrincipal
41 | public @interface CurrentUser {
42 |
43 | //
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/config/ApplicationConfig.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.config;
27 |
28 | import org.springframework.context.annotation.Bean;
29 | import org.springframework.context.annotation.Configuration;
30 |
31 | import kyungseo.poc.simple.web.security.components.ActiveUserStore;
32 |
33 | /**
34 | * @author 박경서 (Kyungseo.Park@gmail.com)
35 | * @version 1.0
36 | */
37 | @Configuration
38 | public class ApplicationConfig {
39 |
40 | @Bean
41 | public ActiveUserStore activeUserStore() {
42 | return new ActiveUserStore();
43 | }
44 |
45 | }
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/exception/ViolationException.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.exception;
24 |
25 | /**
26 | * @author 박경서 (Kyungseo.Park@gmail.com)
27 | * @version 1.0
28 | */
29 | public class ViolationException extends RuntimeException {
30 |
31 | private static final long serialVersionUID = 1L;
32 |
33 | public ViolationException() {
34 | super();
35 | }
36 |
37 | public ViolationException(String message) {
38 | super(message);
39 | }
40 |
41 | public ViolationException(String message, Throwable cause) {
42 | super(message, cause);
43 | }
44 |
45 | public ViolationException(Throwable cause) {
46 | super(cause);
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/persistence/repository/ds1/PrivilegeRepository.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.persistence.repository.ds1;
27 |
28 | import org.springframework.data.jpa.repository.JpaRepository;
29 |
30 | import kyungseo.poc.simple.web.security.persistence.entity.ds1.Privilege;
31 |
32 | /**
33 | * @author 박경서 (Kyungseo.Park@gmail.com)
34 | * @version 1.0
35 | */
36 | public interface PrivilegeRepository extends JpaRepository {
37 |
38 | Privilege findByName(String name);
39 |
40 | @Override
41 | void delete(Privilege privilege);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/resources/templates/view/sample/th/currencies.html:
--------------------------------------------------------------------------------
1 |
22 |
23 |
24 |
25 |
26 |
27 | Currency table
28 |
29 |
30 |
Currency format by Locale
31 |
32 |
33 |
Currency Arrays format by Locale
34 |
35 |
36 |
Remove decimal values
37 |
38 |
39 |
Replace decimal points
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/dto/request/LogOutRequest.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.security.dto.request;
24 |
25 | import javax.validation.Valid;
26 | import javax.validation.constraints.NotNull;
27 |
28 | import lombok.AllArgsConstructor;
29 | import lombok.Getter;
30 | import lombok.NoArgsConstructor;
31 | import lombok.Setter;
32 |
33 | /**
34 | * @author 박경서 (Kyungseo.Park@gmail.com)
35 | * @version 1.0
36 | */
37 | @Getter
38 | @Setter
39 | @AllArgsConstructor
40 | @NoArgsConstructor
41 | public class LogOutRequest {
42 |
43 | @Valid
44 | @NotNull(message = "기존 토큰을 전달해야 합니다.")
45 | private String token;
46 |
47 | @Valid
48 | @NotNull(message = "Device 정보는 필수 값입니다.")
49 | private DeviceInfo deviceInfo;
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/resources/static/js/ks.mini/ksm.message.js:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * KyungSeo's Mini JavaScript Development Templates - KSM.js
3 | *
4 | * Copyright (c) 2016 by Kyungseo.Park@gmail.com
5 | * ============================================================================
6 | * AUTHOR : Kyungseo Park
7 | * DESCRIPTION : KSM JavaScript Templates > MESSAGE
8 | * ============================================================================
9 | * Revision History
10 | * Author Date Description
11 | * ------ ---------- ---------------------------------------------------
12 | * 박경서 2016-10-22 initial version
13 | * ========================================================================= */
14 |
15 | //============================================================================
16 | // Mesages
17 | //============================================================================
18 |
19 | var KSM_MESSAGE = {
20 |
21 | // 시스템 Core와 관련한 메지시 map
22 | systemErrorMessageMap : {
23 | '901': "현재 브라우저는 HTML5의 local storage 기능을 지원하지 않습니다.",
24 | '902': "유효하지않은 ACTION 값입니다.",
25 | '903': "유효하지않은 DATATYPE입니다."
26 | },
27 |
28 | // status와 관련한 메지시 map
29 | // - https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
30 | statusErrorMessageMap : {
31 | '0': "Not connected. 네트워크 연결을 확인하시기 바랍니다.",
32 | '400': "Bad Request. 잘못된 요청입니다.",
33 | '401': "Unauthorized. 인증되지 않은 사용자입니다. ",
34 | '403': "Forbidden. 권한이 없습니다.",
35 | '404': "Not Found. 요청한 서비스(API)를 찾을 수 없습니다.",
36 | '415': "Unsupported Media Type. 지원하지 않는 미디어 형식입니다.",
37 | '500': "Internal Server Error. 서버에서 예기치 않은 에러가 발생하였습니다.",
38 | '503': "Service Unavailable. 서비스가 불가합니다.",
39 | '999': "Unknown Error. 알 수 없는 에러가 발생하였습니다."
40 | },
41 |
42 | // Application(Project) 업무와 관련한 메시지 map
43 | applicationMessageMap : {
44 | '101': "정상적으로 조회되었습니다.",
45 | '105': "데이터가 존재하지 않습니다.",
46 | '201': "세션 시간이 만료되었습니다."
47 | }
48 |
49 | };
50 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/geoip/CityResponse.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.geoip;
24 |
25 | import java.io.IOException;
26 | import java.net.InetAddress;
27 | import java.util.HashMap;
28 | import java.util.List;
29 | import java.util.Map;
30 |
31 | /**
32 | * 임시 - 구현 예정
33 | *
34 | * @author 박경서 (Kyungseo.Park@gmail.com)
35 | * @version 1.0
36 | */
37 | public final class CityResponse {
38 |
39 | private final Map>> records = new HashMap<>();
40 |
41 | private InetAddress ipAddress;
42 |
43 | public CityResponse(InetAddress ipAddress) {
44 | this.ipAddress = ipAddress;
45 | }
46 |
47 | public City getCity() throws IOException {
48 | return new City();
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/components/ActiveUserStore.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.components;
27 |
28 | import java.util.ArrayList;
29 | import java.util.List;
30 |
31 | /**
32 | * @author 박경서 (Kyungseo.Park@gmail.com)
33 | * @version 1.0
34 | */
35 | public class ActiveUserStore {
36 |
37 | public List users;
38 |
39 | public ActiveUserStore() {
40 | users = new ArrayList<>();
41 | }
42 |
43 | public List getUsers() {
44 | return users;
45 | }
46 |
47 | public void setUsers(List users) {
48 | this.users = users;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/captcha/ICaptchaService.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.captcha;
27 |
28 | import kyungseo.poc.simple.web.security.web.error.ReCaptchaInvalidException;
29 |
30 | /**
31 | * @author 박경서 (Kyungseo.Park@gmail.com)
32 | * @version 1.0
33 | */
34 | public interface ICaptchaService {
35 |
36 | default void processResponse(final String response) throws ReCaptchaInvalidException {}
37 |
38 | default void processResponse(final String response, String action) throws ReCaptchaInvalidException {}
39 |
40 | String getReCaptchaSite();
41 |
42 | String getReCaptchaSecret();
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/data/mybatis/handler/EmptyToNullTypeHandler.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.data.mybatis.handler;
24 |
25 | import java.sql.PreparedStatement;
26 | import java.sql.SQLException;
27 |
28 | import org.apache.ibatis.type.JdbcType;
29 | import org.apache.ibatis.type.StringTypeHandler;
30 |
31 | /**
32 | * @author 박경서 (Kyungseo.Park@gmail.com)
33 | * @version 1.0
34 | */
35 | public class EmptyToNullTypeHandler extends StringTypeHandler {
36 |
37 | @Override
38 | public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException {
39 | if ("".equals(parameter)) {
40 | parameter = null;
41 | }
42 | ps.setString(i, (parameter));
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/persistence/repository/ds1/UserLocationRepository.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.persistence.repository.ds1;
27 |
28 | import org.springframework.data.jpa.repository.JpaRepository;
29 |
30 | import kyungseo.poc.simple.web.security.persistence.entity.ds1.User;
31 | import kyungseo.poc.simple.web.security.persistence.entity.ds1.UserLocation;
32 |
33 | /**
34 | * @author 박경서 (Kyungseo.Park@gmail.com)
35 | * @version 1.0
36 | */
37 | public interface UserLocationRepository extends JpaRepository {
38 |
39 | UserLocation findByCountryAndUser(String country, User user);
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/geoip/CountryResponse.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.geoip;
24 |
25 | import java.io.IOException;
26 | import java.net.InetAddress;
27 | import java.util.HashMap;
28 | import java.util.List;
29 | import java.util.Map;
30 |
31 | /**
32 | * 임시 - 구현 예정
33 | *
34 | * @author 박경서 (Kyungseo.Park@gmail.com)
35 | * @version 1.0
36 | */
37 | public final class CountryResponse {
38 |
39 | private final Map>> records = new HashMap<>();
40 |
41 | private InetAddress ipAddress;
42 |
43 | public CountryResponse(InetAddress ipAddress) {
44 | this.ipAddress = ipAddress;
45 | }
46 |
47 | public Country getCountry() throws IOException {
48 | return new Country();
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/resources/static/vendor/bootstrap3-dialog-1.35.3/README.md:
--------------------------------------------------------------------------------
1 | bootstrap-dialog
2 | ================
3 |
4 | [](https://github.com/nakupanda/bootstrap3-dialog/releases/latest)
5 |
6 | Make use of Bootstrap Modal more monkey-friendly.
7 |
8 | See live examples here: http://nakupanda.github.io/bootstrap3-dialog/
9 |
10 | Please note that this project is for Bootstrap 3.
11 |
12 | Thanks for [akinoniku](https://github.com/akinoniku)'s suggestions on dialog appearance.
13 |
14 | ================
15 |
16 | ## Ask a question
17 |
18 | It's recommended to provide online examples when asking questions or reporting bugs.
19 | Fork this all-ready jsfiddle and start writing your example:
20 | http://jsfiddle.net/o5k0eaws/1/
21 |
22 | ================
23 |
24 | ## Use Guidances from contributors
25 |
26 | How to use bootstrap-dialog as Rails 4 confirm - @[Genkilabs](https://github.com/Genkilabs)
27 |
28 | ================
29 | ## Reference to CDN
30 |
31 | ```
32 | https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.7/css/bootstrap-dialog.min.css
33 | https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.7/js/bootstrap-dialog.min.js
34 | ```
35 | ================
36 |
37 | ## Install using Bower
38 |
39 | ```
40 | bower install bootstrap-dialog
41 | ```
42 |
43 | Or
44 |
45 | ```
46 | bower install bootstrap3-dialog
47 | ```
48 |
49 | ================
50 |
51 | ## Install using npm
52 |
53 | ```
54 | npm install --save bootstrap3-dialog
55 | ```
56 |
57 | ================
58 |
59 | ## Build instructions:
60 |
61 | Prepare:
62 |
63 | ```
64 | npm install
65 | ```
66 |
67 | Build:
68 |
69 | ```
70 | gulp dist
71 | ```
72 |
73 | ================
74 |
75 | Licensed under The MIT License.
76 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/site/common/base/persistence/IOperations.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.site.common.base.persistence;
24 |
25 | import java.io.Serializable;
26 | import java.util.List;
27 |
28 | import org.springframework.data.domain.Page;
29 |
30 | /**
31 | * @author 박경서 (Kyungseo.Park@gmail.com)
32 | * @version 1.0
33 | */
34 | public interface IOperations {
35 |
36 | // read - one
37 |
38 | T findById(final long id);
39 |
40 | // read - all
41 |
42 | List findAll();
43 |
44 | Page findPaginated(int page, int size);
45 |
46 | // write
47 |
48 | T create(final T entity);
49 |
50 | T update(final T entity);
51 |
52 | void delete(final T entity);
53 |
54 | void deleteById(final long entityId);
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/test/java/kyungseo/poc/simple/web/config/ConfigTest.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.config;
24 |
25 | import org.springframework.context.annotation.Bean;
26 | import org.springframework.context.annotation.Configuration;
27 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
28 | import org.springframework.security.crypto.password.PasswordEncoder;
29 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
30 |
31 | /**
32 | * @author 박경서 (Kyungseo.Park@gmail.com)
33 | * @version 1.0
34 | */
35 | @Configuration
36 | public class ConfigTest implements WebMvcConfigurer {
37 |
38 | public ConfigTest() {
39 | super();
40 | }
41 |
42 | @Bean
43 | public PasswordEncoder encoder() {
44 | return new BCryptPasswordEncoder(11);
45 | }
46 |
47 | }
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/persistence/repository/ds1/DeviceMetadataRepository.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.persistence.repository.ds1;
27 |
28 | import java.util.List;
29 |
30 | import org.springframework.data.jpa.repository.JpaRepository;
31 |
32 | import kyungseo.poc.simple.web.security.persistence.entity.ds1.DeviceMetadata;
33 | import kyungseo.poc.simple.web.security.persistence.entity.ds1.JwtRefreshToken;
34 |
35 | /**
36 | * @author 박경서 (Kyungseo.Park@gmail.com)
37 | * @version 1.0
38 | */
39 | public interface DeviceMetadataRepository extends JpaRepository {
40 |
41 | List findByUserId(Long userId);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/web/error/UnusualLocationException.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.web.error;
27 |
28 | import org.springframework.security.core.AuthenticationException;
29 |
30 | /**
31 | * @author 박경서 (Kyungseo.Park@gmail.com)
32 | * @version 1.0
33 | */
34 | public final class UnusualLocationException extends AuthenticationException {
35 |
36 | private static final long serialVersionUID = 5861310537366287163L;
37 |
38 | public UnusualLocationException(final String message, final Throwable cause) {
39 | super(message, cause);
40 | }
41 |
42 | public UnusualLocationException(final String message) {
43 | super(message);
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/persistence/repository/ds1/JwtUserDeviceRepository.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.security.persistence.repository.ds1;
24 |
25 | import java.util.Optional;
26 |
27 | import org.springframework.data.jpa.repository.JpaRepository;
28 |
29 | import kyungseo.poc.simple.web.security.persistence.entity.ds1.JwtRefreshToken;
30 | import kyungseo.poc.simple.web.security.persistence.entity.ds1.JwtUserDevice;
31 |
32 | /**
33 | * @author 박경서 (Kyungseo.Park@gmail.com)
34 | * @version 1.0
35 | */
36 | public interface JwtUserDeviceRepository extends JpaRepository {
37 |
38 | @Override
39 | Optional findById(Long id);
40 |
41 | Optional findByRefreshToken(JwtRefreshToken jwtRefreshToken);
42 |
43 | Optional findByUserId(Long userId);
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/site/common/service/FileService.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.site.common.service;
24 |
25 | import org.springframework.stereotype.Service;
26 | import org.springframework.web.multipart.MultipartFile;
27 |
28 | import kyungseo.poc.simple.web.appcore.util.FileUtil;
29 | import lombok.RequiredArgsConstructor;
30 |
31 | /**
32 | * @author 박경서 (Kyungseo.Park@gmail.com)
33 | * @version 1.0
34 | */
35 | @Service
36 | @RequiredArgsConstructor
37 | public class FileService {
38 |
39 | private final FileUtil fileUtil;
40 |
41 | /**
42 | * upload
43 | * @param multipartFiles
44 | */
45 | public void upload(final MultipartFile[] multipartFiles) {
46 | int i=0;
47 | for(MultipartFile multipartFile : multipartFiles) {
48 | this.fileUtil.upload(multipartFile, "/test", "testNewFilename" + (++i));
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/validation/FileValidator.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.validation;
24 |
25 | import org.springframework.stereotype.Component;
26 | import org.springframework.validation.Errors;
27 | import org.springframework.validation.Validator;
28 |
29 | import kyungseo.poc.simple.web.appcore.dto.file.FileBucket;
30 |
31 | /**
32 | * @author 박경서 (Kyungseo.Park@gmail.com)
33 | * @version 1.0
34 | */
35 | @Component
36 | public class FileValidator implements Validator {
37 |
38 | public boolean supports(Class> clazz) {
39 | return FileBucket.class.isAssignableFrom(clazz);
40 | }
41 |
42 | public void validate(Object obj, Errors errors) {
43 | FileBucket file = (FileBucket) obj;
44 | if (file.getFile() != null && file.getFile().getSize() == 0) {
45 | errors.rejectValue("file", "missing.file");
46 | }
47 | }
48 |
49 | }
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/persistence/repository/ds1/NewLocationTokenRepository.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.persistence.repository.ds1;
27 |
28 | import org.springframework.data.jpa.repository.JpaRepository;
29 |
30 | import kyungseo.poc.simple.web.security.persistence.entity.ds1.NewLocationToken;
31 | import kyungseo.poc.simple.web.security.persistence.entity.ds1.UserLocation;
32 |
33 | /**
34 | * @author 박경서 (Kyungseo.Park@gmail.com)
35 | * @version 1.0
36 | */
37 | public interface NewLocationTokenRepository extends JpaRepository {
38 |
39 | NewLocationToken findByToken(String token);
40 |
41 | NewLocationToken findByUserLocation(UserLocation userLocation);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/exception/ResourceConflictException.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.exception;
24 |
25 | /**
26 | * @author 박경서 (Kyungseo.Park@gmail.com)
27 | * @version 1.0
28 | */
29 | @SuppressWarnings("serial")
30 | public class ResourceConflictException extends RuntimeException {
31 |
32 | public ResourceConflictException() {}
33 |
34 | public ResourceConflictException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
35 | super(message, cause, enableSuppression, writableStackTrace);
36 | }
37 |
38 | public ResourceConflictException(String message, Throwable cause) {
39 | super(message, cause);
40 | }
41 |
42 | public ResourceConflictException(String message) {
43 | super(message);
44 | }
45 |
46 | public ResourceConflictException(Throwable cause) {
47 | super(cause);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/formatter/LocalDateFormatter.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.formatter;
24 |
25 | import java.time.LocalDate;
26 | import java.time.format.DateTimeFormatter;
27 | import java.util.Locale;
28 |
29 | import org.springframework.format.Formatter;
30 |
31 | import kyungseo.poc.simple.web.appcore.AppConstants;
32 |
33 | /**
34 | * @author 박경서 (Kyungseo.Park@gmail.com)
35 | * @version 1.0
36 | */
37 | public class LocalDateFormatter implements Formatter {
38 |
39 | @Override
40 | public LocalDate parse(String text, Locale locale) {
41 | return LocalDate.parse(text, DateTimeFormatter.ofPattern(AppConstants.DATE_FORMAT));
42 | }
43 |
44 | @Override
45 | public String print(LocalDate object, Locale locale) {
46 | return DateTimeFormatter.ofPattern(AppConstants.DATE_FORMAT).format(object);
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/test/java/kyungseo/poc/simple/web/security/IntegrationSuite.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security;
27 |
28 | import org.junit.platform.suite.api.SelectClasses;
29 |
30 | /**
31 | * @author 박경서 (Kyungseo.Park@gmail.com)
32 | * @version 1.0
33 | */
34 | @SelectClasses({ // @formatter:off
35 | ChangePasswordIntegrationTest.class,
36 | DeviceServiceIntegrationTest.class,
37 | TokenExpirationIntegrationTest.class,
38 | RegistrationControllerIntegrationTest.class,
39 | GetLoggedUsersIntegrationTest.class,
40 | UserServiceIntegrationTest.class,
41 | UserIntegrationTest.class,
42 | SpringSecurityRolesIntegrationTest.class,
43 | LocalizationIntegrationTest.class
44 | })// @formatter:on
45 | public class IntegrationSuite {
46 | //
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/config/AtomikosJtaPlatform.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.config;
24 |
25 | import org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform;
26 |
27 | import javax.transaction.TransactionManager;
28 | import javax.transaction.UserTransaction;
29 |
30 | /**
31 | * @author 박경서 (Kyungseo.Park@gmail.com)
32 | * @version 1.0
33 | */
34 | public class AtomikosJtaPlatform extends AbstractJtaPlatform {
35 |
36 | private static final long serialVersionUID = 1L;
37 |
38 | static TransactionManager transactionManager;
39 | static UserTransaction transaction;
40 |
41 | @Override
42 | protected TransactionManager locateTransactionManager() {
43 | return transactionManager;
44 | }
45 |
46 | @Override
47 | protected UserTransaction locateUserTransaction() {
48 | return transaction;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/converter/StringToDateConverter.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.converter;
24 |
25 | import java.text.ParseException;
26 | import java.text.SimpleDateFormat;
27 | import java.util.Date;
28 |
29 | import org.springframework.core.convert.converter.Converter;
30 |
31 | import kyungseo.poc.simple.web.appcore.AppConstants;
32 |
33 | /**
34 | * @author 박경서 (Kyungseo.Park@gmail.com)
35 | * @version 1.0
36 | */
37 | //@Component
38 | public class StringToDateConverter implements Converter {
39 |
40 | @Override
41 | public Date convert(String source) {
42 | SimpleDateFormat format = new SimpleDateFormat(AppConstants.DATE_FORMAT);
43 | try {
44 | return format.parse(source);
45 | } catch (ParseException e) {
46 | e.printStackTrace();
47 | return null;
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/site/common/service/CommonService.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.site.common.service;
24 |
25 | import org.springframework.stereotype.Service;
26 |
27 | import kyungseo.poc.simple.web.site.common.model.Member;
28 | import kyungseo.poc.simple.web.site.common.persistence.mapper.ds1.CommonMapper;
29 | import lombok.RequiredArgsConstructor;
30 |
31 | /**
32 | * @author 박경서 (Kyungseo.Park@gmail.com)
33 | * @version 1.0
34 | */
35 | @Service
36 | @RequiredArgsConstructor
37 | public class CommonService {
38 |
39 | private final CommonMapper commonMapper;
40 |
41 | /**
42 | * Get Member info
43 | * @param username
44 | * @return
45 | */
46 | public Member getUser(final String username) {
47 | return this.commonMapper.getUser(username);
48 | }
49 |
50 | public Member getUserByEmail(final String email) {
51 | return this.commonMapper.getUserByEmail(email);
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/dto/request/LogInForm.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.security.dto.request;
24 |
25 | import javax.validation.Valid;
26 | import javax.validation.constraints.NotBlank;
27 | import javax.validation.constraints.NotNull;
28 | import javax.validation.constraints.Size;
29 |
30 | import lombok.AllArgsConstructor;
31 | import lombok.Getter;
32 | import lombok.NoArgsConstructor;
33 | import lombok.Setter;
34 |
35 | /**
36 | * @author 박경서 (Kyungseo.Park@gmail.com)
37 | * @version 1.0
38 | */
39 | @Getter
40 | @Setter
41 | @NoArgsConstructor
42 | @AllArgsConstructor
43 | public class LogInForm {
44 |
45 | @NotBlank
46 | @Size(min = 3, max = 60)
47 | private String email;
48 |
49 | @NotBlank
50 | @Size(min = 6, max = 40)
51 | private String password;
52 |
53 | @Valid
54 | @NotNull(message = "Device 정보는 필수 값입니다.")
55 | private DeviceInfo deviceInfo;
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/formatter/LocalDateTimeFormatter.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.formatter;
24 |
25 | import java.time.LocalDateTime;
26 | import java.time.format.DateTimeFormatter;
27 | import java.util.Locale;
28 |
29 | import org.springframework.format.Formatter;
30 |
31 | import kyungseo.poc.simple.web.appcore.AppConstants;
32 |
33 | /**
34 | * @author 박경서 (Kyungseo.Park@gmail.com)
35 | * @version 1.0
36 | */
37 | public class LocalDateTimeFormatter implements Formatter {
38 |
39 | @Override
40 | public LocalDateTime parse(String text, Locale locale) {
41 | return LocalDateTime.parse(text, DateTimeFormatter.ofPattern(AppConstants.DATETIME_FORMAT));
42 | }
43 |
44 | @Override
45 | public String print(LocalDateTime object, Locale locale) {
46 | return DateTimeFormatter.ofPattern(AppConstants.DATETIME_FORMAT).format(object);
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/web/error/TokenRefreshException.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.security.web.error;
24 |
25 | import org.springframework.http.HttpStatus;
26 |
27 | import org.springframework.web.bind.annotation.ResponseStatus;
28 |
29 | import lombok.Getter;
30 | import lombok.Setter;
31 |
32 | /**
33 | * @author 박경서 (Kyungseo.Park@gmail.com)
34 | * @version 1.0
35 | */
36 | @Getter
37 | @Setter
38 | @ResponseStatus(HttpStatus.EXPECTATION_FAILED)
39 | public class TokenRefreshException extends RuntimeException {
40 |
41 | private static final long serialVersionUID = 1L;
42 |
43 | private final String token;
44 |
45 | private final String message;
46 |
47 | public TokenRefreshException(String token, String message) {
48 | super(String.format("Couldn't refresh token for [%s]: [%s])", token, message));
49 | this.token = token;
50 | this.message = message;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/web/error/UserNotFoundException.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.web.error;
27 |
28 | /**
29 | * @author 박경서 (Kyungseo.Park@gmail.com)
30 | * @version 1.0
31 | */
32 | public final class UserNotFoundException extends RuntimeException {
33 |
34 | private static final long serialVersionUID = 5861310537366287163L;
35 |
36 | public UserNotFoundException() {
37 | super();
38 | }
39 |
40 | public UserNotFoundException(final String message, final Throwable cause) {
41 | super(message, cause);
42 | }
43 |
44 | public UserNotFoundException(final String message) {
45 | super(message);
46 | }
47 |
48 | public UserNotFoundException(final Throwable cause) {
49 | super(cause);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/formatter/NameFormatter.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.formatter;
24 |
25 | import java.text.ParseException;
26 | import java.util.Locale;
27 |
28 | import org.apache.commons.lang3.StringUtils;
29 | import org.springframework.format.Formatter;
30 |
31 | /**
32 | * name(문자열)을 포맷, 공백(' ')을 ','로 대체한 값을 반환
33 | *
34 | * @author 박경서 (Kyungseo.Park@gmail.com)
35 | * @version 1.0
36 | */
37 | public class NameFormatter implements Formatter {
38 |
39 | @Override
40 | public String print(String input, Locale locale) {
41 | return formatName(input, locale);
42 | }
43 |
44 | @Override
45 | public String parse(String input, Locale locale) throws ParseException {
46 | return formatName(input, locale);
47 | }
48 |
49 | private String formatName(String input, Locale locale) {
50 | return StringUtils.replace(input, " ", ",");
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/resources/static/vendor/bootstrap3-dialog-1.35.3/examples/play/only-one-dialog.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Only one dialog
12 |
13 |
24 |
25 |
26 |
27 |
28 |
29 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/web/error/ReCaptchaInvalidException.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.web.error;
27 |
28 | /**
29 | * @author 박경서 (Kyungseo.Park@gmail.com)
30 | * @version 1.0
31 | */
32 | public final class ReCaptchaInvalidException extends RuntimeException {
33 |
34 | private static final long serialVersionUID = 5861310537366287163L;
35 |
36 | public ReCaptchaInvalidException() {
37 | super();
38 | }
39 |
40 | public ReCaptchaInvalidException(final String message, final Throwable cause) {
41 | super(message, cause);
42 | }
43 |
44 | public ReCaptchaInvalidException(final String message) {
45 | super(message);
46 | }
47 |
48 | public ReCaptchaInvalidException(final Throwable cause) {
49 | super(cause);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/web/error/UserAlreadyExistException.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.web.error;
27 |
28 | /**
29 | * @author 박경서 (Kyungseo.Park@gmail.com)
30 | * @version 1.0
31 | */
32 | public final class UserAlreadyExistException extends RuntimeException {
33 |
34 | private static final long serialVersionUID = 5861310537366287163L;
35 |
36 | public UserAlreadyExistException() {
37 | super();
38 | }
39 |
40 | public UserAlreadyExistException(final String message, final Throwable cause) {
41 | super(message, cause);
42 | }
43 |
44 | public UserAlreadyExistException(final String message) {
45 | super(message);
46 | }
47 |
48 | public UserAlreadyExistException(final Throwable cause) {
49 | super(cause);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/site/sample/model/Customer.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.site.sample.model;
24 |
25 | import javax.validation.constraints.NotEmpty;
26 |
27 | import kyungseo.poc.simple.web.appcore.validation.ValidationMarkers.Create;
28 | import kyungseo.poc.simple.web.appcore.validation.ValidationMarkers.Update;
29 | import lombok.AllArgsConstructor;
30 | import lombok.Builder;
31 | import lombok.Getter;
32 | import lombok.NoArgsConstructor;
33 | import lombok.Setter;
34 | import lombok.ToString;
35 |
36 | /**
37 | * @author 박경서 (Kyungseo.Park@gmail.com)
38 | * @version 1.0
39 | */
40 | @Getter
41 | @Setter
42 | @Builder
43 | @NoArgsConstructor
44 | @AllArgsConstructor
45 | @ToString
46 | public class Customer {
47 |
48 | @NotEmpty
49 | private Integer customerId;
50 |
51 | @NotEmpty(groups = {Create.class, Update.class}, message = "${valid.msg.not-empty}")
52 | private String customerName;
53 |
54 | private String company;
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/web/error/InvalidOldPasswordException.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.web.error;
27 |
28 | /**
29 | * @author 박경서 (Kyungseo.Park@gmail.com)
30 | * @version 1.0
31 | */
32 | public final class InvalidOldPasswordException extends RuntimeException {
33 |
34 | private static final long serialVersionUID = 5861310537366287163L;
35 |
36 | public InvalidOldPasswordException() {
37 | super();
38 | }
39 |
40 | public InvalidOldPasswordException(final String message, final Throwable cause) {
41 | super(message, cause);
42 | }
43 |
44 | public InvalidOldPasswordException(final String message) {
45 | super(message);
46 | }
47 |
48 | public InvalidOldPasswordException(final Throwable cause) {
49 | super(cause);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/site/sample/persistence/entity/ds1/Customer.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.site.sample.persistence.entity.ds1;
24 |
25 | import javax.persistence.Column;
26 | import javax.persistence.Entity;
27 | import javax.persistence.GeneratedValue;
28 | import javax.persistence.GenerationType;
29 | import javax.persistence.Id;
30 |
31 | import lombok.AllArgsConstructor;
32 | import lombok.Builder;
33 | import lombok.Getter;
34 | import lombok.NoArgsConstructor;
35 | import lombok.ToString;
36 |
37 | /**
38 | * @author 박경서 (Kyungseo.Park@gmail.com)
39 | * @version 1.0
40 | */
41 | @Entity
42 | @Getter
43 | @Builder
44 | @NoArgsConstructor
45 | @AllArgsConstructor
46 | @ToString
47 | public class Customer {
48 |
49 | @Id
50 | @Column(unique = true, nullable = false)
51 | @GeneratedValue(strategy = GenerationType.AUTO)
52 | private Integer customerId;
53 |
54 | private String customerName;
55 |
56 | private String company;
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Java ========================================================================
3 |
4 | # Compiled class file
5 | *.class
6 |
7 | # Log file
8 | *.log
9 | *.log.gz
10 |
11 | # BlueJ files
12 | *.ctxt
13 |
14 | # Mobile Tools for Java (J2ME)
15 | .mtj.tmp/
16 |
17 | # Package Files #
18 | *.jar
19 | *.war
20 | *.nar
21 | *.ear
22 | *.zip
23 | *.tar.gz
24 | *.rar
25 |
26 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
27 | hs_err_pid*
28 | replay_pid*
29 |
30 | # SVN
31 | .svn/
32 |
33 | # Eclipse =====================================================================
34 |
35 | .metadata
36 | bin/
37 | tmp/
38 | logs/
39 | target/
40 | *.tmp
41 | *.bak
42 | *.swp
43 | *~.nib
44 | local.properties
45 | .settings/
46 | .loadpath
47 | .recommenders
48 |
49 | # sbteclipse plugin
50 | .target
51 |
52 | # STS (Spring Tool Suite)
53 | .springBeans
54 |
55 | # Annotation Processing
56 | .apt_generated/
57 | .apt_generated_test/
58 |
59 | # Scala IDE specific (Scala & Java development for Eclipse)
60 | .cache-main
61 | .scala_dependencies
62 | .worksheet
63 |
64 | #
65 | .project
66 | .classpath
67 | .factorypath
68 |
69 | # Windows =====================================================================
70 |
71 | # Windows thumbnail cache files
72 | Thumbs.db
73 |
74 | # Folder config file
75 | [Dd]esktop.ini
76 |
77 | # Windows Installer files
78 | *.cab
79 | *.msi
80 | *.msix
81 | *.msm
82 | *.msp
83 |
84 | # Windows shortcuts
85 | *.lnk
86 |
87 | # macOS =====================================================================
88 |
89 | # General
90 | .DS_Store
91 | .AppleDouble
92 | .LSOverride
93 |
94 | # Icon must end with two \r
95 | Icon
96 |
97 | # Thumbnails
98 | ._*
99 |
100 | # Files that might appear in the root of a volume
101 | .DocumentRevisions-V100
102 | .fseventsd
103 | .Spotlight-V100
104 | .TemporaryItems
105 | .Trashes
106 | .VolumeIcon.icns
107 | .com.apple.timemachine.donotpresent
108 |
109 | # Directories potentially created on remote AFP share
110 | .AppleDB
111 | .AppleDesktop
112 | Network Trash Folder
113 | Temporary Items
114 | .apdisk
115 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/dto/Mail.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.dto;
24 |
25 | import javax.validation.constraints.NotBlank;
26 | import javax.validation.constraints.Pattern;
27 |
28 | import lombok.AllArgsConstructor;
29 | import lombok.Builder;
30 | import lombok.Getter;
31 | import lombok.NoArgsConstructor;
32 | import lombok.Setter;
33 | import lombok.ToString;
34 |
35 | /**
36 | * @author 박경서 (Kyungseo.Park@gmail.com)
37 | * @version 1.0
38 | */
39 | @Getter
40 | @Setter
41 | @NoArgsConstructor
42 | @AllArgsConstructor
43 | @ToString
44 | @Builder
45 | public class Mail {
46 |
47 | @Pattern(regexp = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$", message = "이메일 형식이 잘못되었습니다.")
48 | private String to;
49 |
50 | @NotBlank(message = "제목은 필수입니다.")
51 | private String title;
52 |
53 | @NotBlank(message = "본문은 필수입니다.")
54 | private String content;
55 |
56 | private String msgId;
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/security/web/error/ReCaptchaUnavailableException.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Original Code: https://github.com/Baeldung/spring-security-registration
7 | * @author Baeldung, modified by Kyungseo Park
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * ============================================================================
21 | * Author Date Description
22 | * -------- ---------- -------------------------------------------------
23 | * Kyungseo 2023-03-02 initial version
24 | * ========================================================================= */
25 |
26 | package kyungseo.poc.simple.web.security.web.error;
27 |
28 | /**
29 | * @author 박경서 (Kyungseo.Park@gmail.com)
30 | * @version 1.0
31 | */
32 | public final class ReCaptchaUnavailableException extends RuntimeException {
33 |
34 | private static final long serialVersionUID = 5861310537366287163L;
35 |
36 | public ReCaptchaUnavailableException() {
37 | super();
38 | }
39 |
40 | public ReCaptchaUnavailableException(final String message, final Throwable cause) {
41 | super(message, cause);
42 | }
43 |
44 | public ReCaptchaUnavailableException(final String message) {
45 | super(message);
46 | }
47 |
48 | public ReCaptchaUnavailableException(final Throwable cause) {
49 | super(cause);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/site/common/persistence/mapper/ds1/CommonMapper.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.site.common.persistence.mapper.ds1;
24 |
25 | import org.apache.ibatis.annotations.Mapper;
26 | import org.apache.ibatis.annotations.Param;
27 | import org.apache.ibatis.annotations.Select;
28 |
29 | import kyungseo.poc.simple.web.site.common.model.Member;
30 |
31 | /**
32 | * @author 박경서 (Kyungseo.Park@gmail.com)
33 | * @version 1.0
34 | */
35 | @Mapper
36 | public interface CommonMapper {
37 |
38 | //Spring Security는 내부적으로 사용자의 아이디만 데이터베이스에서 조회를 한 뒤에
39 | // 가져온 값에서 비밀번호(password) 값을 추출하여 데이터베이스 결과와 매핑하도록 구현되어 있다.
40 | // 따라서 사용자 비밀번호를 데이터베이스에서 조회하는 코드는 작성해서는 안된다.
41 | @Select("SELECT username, password, role FROM USERS WHERE username = #{username}")
42 | Member getUser(@Param("username") String username);
43 |
44 | @Select("SELECT username, password, role FROM USERS WHERE email = #{email}")
45 | Member getUserByEmail(@Param("email") String email);
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/resources/messages/messages-site_ko_KR.properties:
--------------------------------------------------------------------------------
1 | # Page view \ubcc4\ub85c \uc139\uc158 \uad6c\ubd84\ud558\uc5ec \uc791\uc131\ud560 \uac83!
2 |
3 | # --------------------------------------------------
4 | # '/view/admin/usermgmt'\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 properties
5 | # --------------------------------------------------
6 |
7 | # Page Title
8 | admin.usermgmt.page.users.title=\uc0ac\uc6a9\uc790 \uad00\ub9ac
9 | admin.usermgmt.page.swagger.title=KYUNGSEO.PoC - API
10 |
11 | # lables
12 | admin.usermgmt.lbl.info=\uc0ac\uc6a9\uc790 \uc815\ubcf4
13 | admin.usermgmt.lbl.id=ID
14 | admin.usermgmt.lbl.membername=\uc131\uba85
15 | admin.usermgmt.lbl.email=\uc774\uba54\uc77c
16 | admin.usermgmt.lbl.password=\ube44\ubc00\ubc88\ud638
17 | admin.usermgmt.lbl.age=\ub098\uc774
18 | admin.usermgmt.lbl.birthdate=\uc0dd\ub144\uc6d4\uc77c
19 | admin.usermgmt.lbl.phoneNumber=\ud734\ub300\ud3f0
20 | admin.usermgmt.lbl.country=\uad6d\uac00
21 | admin.usermgmt.lbl.enabled=\uc0ac\uc6a9\uc5ec\ubd80
22 | admin.usermgmt.lbl.isUsing2FA=2FA
23 | admin.usermgmt.lbl.secret=\ube44\ubc00\ud0a4
24 | admin.usermgmt.lbl.regDate=\ub4f1\ub85d\uc77c
25 | admin.usermgmt.lbl.modDate=\uc218\uc815\uc77c
26 | admin.usermgmt.lbl.roles=\ubcf4\uc720\uc5ed\ud560
27 | admin.usermgmt.lbl.action=\uc218\uc815/\uc0ad\uc81c
28 |
29 | admin.usermgmt.lbl.btn.read=\uc815\ubcf4 \ubcf4\uae30
30 | admin.usermgmt.lbl.btn.edit=\uc815\ubcf4 \uc218\uc815
31 | admin.usermgmt.lbl.btn.editRole=\uc5ed\ud560 \uc218\uc815
32 | admin.usermgmt.lbl.btn.delete=\uc0ac\uc6a9\uc790 \uc0ad\uc81c
33 |
34 | # messages
35 | admin.usermgmt.msg.reg.succ=\ub4f1\ub85d\uc774 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4.
36 | admin.usermgmt.msg.reg.fail=\ub4f1\ub85d\uc774 \uc2e4\ud328\ud558\uc600\uc2b5\ub2c8\ub2e4.
37 |
38 | # validation
39 | admin.usermgmt.vld.password.notnull=\ube44\ubc00\ubc88\ud638\ub294 \ud544\uc218 \uac12
40 | admin.usermgmt.vld.password.notempty=\ube44\ubc00\ubc88\ud638\ub294 \ud544\uc218 \uac12
41 | admin.usermgmt.vld.password.matches=\ube44\ubc00\ubc88\ud638 \ubd88\uc77c\uce58!
42 |
43 | # --------------------------------------------------
44 | # '/view/admin/xxxx'\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 properties
45 | # --------------------------------------------------
46 |
--------------------------------------------------------------------------------
/src/main/java/kyungseo/poc/simple/web/appcore/util/MessageSourceUtil.java:
--------------------------------------------------------------------------------
1 | /* ============================================================================
2 | * [ Development Templates based on Spring Boot ]
3 | * ----------------------------------------------------------------------------
4 | * Copyright 2023 Kyungseo Park
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | * ============================================================================
18 | * Author Date Description
19 | * -------- ---------- -------------------------------------------------
20 | * Kyungseo 2023-03-02 initial version
21 | * ========================================================================= */
22 |
23 | package kyungseo.poc.simple.web.appcore.util;
24 |
25 | import java.util.Locale;
26 |
27 | import org.springframework.context.MessageSource;
28 | import org.springframework.context.i18n.LocaleContextHolder;
29 | import org.springframework.lang.Nullable;
30 | import org.springframework.stereotype.Component;
31 |
32 | import lombok.RequiredArgsConstructor;
33 |
34 | /**
35 | * @author 박경서 (Kyungseo.Park@gmail.com)
36 | * @version 1.0
37 | */
38 | @Component
39 | @RequiredArgsConstructor
40 | public class MessageSourceUtil {
41 |
42 | private final MessageSource messageSource;
43 |
44 | public String getMessage(final String code, @Nullable final Object... args) {
45 | return this.getMessage(code, LocaleContextHolder.getLocale(), args);
46 | }
47 |
48 | public String getMessage(final String code, final Locale locale, @Nullable final Object... args) {
49 | return this.messageSource.getMessage(code, args, locale);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------