From 81da9d96d8790c9977eef106c6b227ca16015b8a Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Sat, 3 Oct 2020 18:42:41 +0300 Subject: [PATCH] Add missing descriptions Signed-off-by: Pekka Helenius --- .../bookstore/config/WebSecurityConfig.java | 18 +++++++++++++----- .../model/book/BookRepositoryCustom.java | 4 ++++ .../model/book/BookRepositoryImpl.java | 4 ++++ .../session/BookStoreAccessDeniedHandler.java | 12 ++++++++++++ .../service/session/UserDetailServiceImpl.java | 10 ++++++---- 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/config/WebSecurityConfig.java b/bookstore/src/main/java/com/fjordtek/bookstore/config/WebSecurityConfig.java index 0990611..fc51f01 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/config/WebSecurityConfig.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/config/WebSecurityConfig.java @@ -16,11 +16,19 @@ import com.fjordtek.bookstore.service.session.BookStoreAccessDeniedHandler; import com.fjordtek.bookstore.service.session.UserDetailServiceImpl; /** -* -* @see https://docs.spring.io/spring-security/site/docs/current/reference/html5/#multiple-httpsecurity -* -* @author Pekka Helenius -*/ + * + * This class and its subclasses extend Spring Framework security + * WebSecurityConfigurerAdapter configuration for HTTP end points and sessions. + *

+ * The class uses a custom UserDetailService interface class implementation + * to determine proper user authorities. + *

+ * This class has multiple sub-configurations for different end points. + * + * @see https://docs.spring.io/spring-security/site/docs/current/reference/html5/#multiple-httpsecurity + * + * @author Pekka Helenius + */ @Configuration @EnableWebSecurity diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/model/book/BookRepositoryCustom.java b/bookstore/src/main/java/com/fjordtek/bookstore/model/book/BookRepositoryCustom.java index d88cae7..fa5f736 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/model/book/BookRepositoryCustom.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/model/book/BookRepositoryCustom.java @@ -1,9 +1,13 @@ +//Pekka Helenius , Fjordtek 2020 + package com.fjordtek.bookstore.model.book; import java.util.List; /** * +* This interface defines additional methods for BookRepository. +* * @author Pekka Helenius */ diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/model/book/BookRepositoryImpl.java b/bookstore/src/main/java/com/fjordtek/bookstore/model/book/BookRepositoryImpl.java index c45db30..a0139bc 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/model/book/BookRepositoryImpl.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/model/book/BookRepositoryImpl.java @@ -1,3 +1,5 @@ +//Pekka Helenius , Fjordtek 2020 + package com.fjordtek.bookstore.model.book; import java.util.List; @@ -10,6 +12,8 @@ import javax.persistence.TypedQuery; import org.springframework.transaction.annotation.Transactional; /** + * + * This class implements methods defined in BookRepositoryCustom interface. * * @author Pekka Helenius */ diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/service/session/BookStoreAccessDeniedHandler.java b/bookstore/src/main/java/com/fjordtek/bookstore/service/session/BookStoreAccessDeniedHandler.java index c4d5e64..adf6c77 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/service/session/BookStoreAccessDeniedHandler.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/service/session/BookStoreAccessDeniedHandler.java @@ -1,3 +1,5 @@ +//Pekka Helenius , Fjordtek 2020 + package com.fjordtek.bookstore.service.session; import java.io.IOException; @@ -14,6 +16,16 @@ import org.springframework.stereotype.Component; import com.fjordtek.bookstore.service.HttpServerLogger; +/** + * + * This class implements Spring Framework security AccessDeniedHandler + * interface with specific method overrides. + *

+ * Main purpose is to properly handle erroneous client requests. + * + * @author Pekka Helenius + */ + @Component public class BookStoreAccessDeniedHandler implements AccessDeniedHandler { diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/service/session/UserDetailServiceImpl.java b/bookstore/src/main/java/com/fjordtek/bookstore/service/session/UserDetailServiceImpl.java index 8513c3b..7213455 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/service/session/UserDetailServiceImpl.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/service/session/UserDetailServiceImpl.java @@ -19,10 +19,12 @@ import com.fjordtek.bookstore.model.auth.UserRole; import com.fjordtek.bookstore.model.auth.UserRoleRepository; /** -* -* -* @author Pekka Helenius -*/ + * + * This class implements Spring Framework security UserDetailsService interface, + * adding custom methods to define proper user authorities. + * + * @author Pekka Helenius + */ @Service public class UserDetailServiceImpl implements UserDetailsService {