diff --git a/pom.xml b/pom.xml
index b6079d923..a0101488b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,6 @@
5.6.15.Final
10.0.22
5.3.18
- 5.6.2
3.1.2
@@ -335,23 +334,6 @@
${spring.version}
-
-
- org.springframework.security
- spring-security-web
- ${spring.security.version}
-
-
- org.springframework.security
- spring-security-config
- ${spring.security.version}
-
-
- org.springframework.security
- spring-security-taglibs
- ${spring.security.version}
-
-
org.apache.logging.log4j
diff --git a/src/main/java/ai/elimu/web/CustomAuthenticationManager.java b/src/main/java/ai/elimu/web/CustomAuthenticationManager.java
deleted file mode 100644
index 98df76421..000000000
--- a/src/main/java/ai/elimu/web/CustomAuthenticationManager.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package ai.elimu.web;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.logging.log4j.Logger;
-import ai.elimu.model.contributor.Contributor;
-import ai.elimu.model.enums.Role;
-import org.apache.logging.log4j.LogManager;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.context.SecurityContextHolder;
-
-public class CustomAuthenticationManager implements AuthenticationManager {
-
- private Logger logger = LogManager.getLogger();
-
- private final List AUTHORITIES = new ArrayList();
-
- @Override
- public Authentication authenticate(Authentication authentication) throws AuthenticationException {
- logger.info("authenticate");
-
- logger.info("authentication.getName(): " + authentication.getName());
-
- Contributor contributor = (Contributor) authentication.getPrincipal();
- logger.info("contributor: " + contributor);
- logger.info("contributor.getRoles(): " + contributor.getRoles());
- for (Role role : contributor.getRoles()) {
- AUTHORITIES.add(new SimpleGrantedAuthority("ROLE_" + role.toString()));
- }
-
- return new UsernamePasswordAuthenticationToken(authentication.getName(), authentication.getCredentials(), AUTHORITIES);
- }
-
- public void authenticateUser(Contributor contributor) {
- logger.info("authenticateUser");
-
- Authentication authenticationRequest = new UsernamePasswordAuthenticationToken(contributor, "PASSWORD");
- AuthenticationManager authenticationManager = new CustomAuthenticationManager();
- Authentication authenticationResult = authenticationManager.authenticate(authenticationRequest);
- SecurityContextHolder.getContext().setAuthentication(authenticationResult);
- }
-}
diff --git a/src/main/java/ai/elimu/web/SignOnController.java b/src/main/java/ai/elimu/web/SignOnController.java
index 37d43a0d9..b2c04b3e1 100644
--- a/src/main/java/ai/elimu/web/SignOnController.java
+++ b/src/main/java/ai/elimu/web/SignOnController.java
@@ -46,9 +46,6 @@ public String handleOfflineSignOnRequest(HttpServletRequest request) {
// Fetch the test user that was created in DbContentImportHelper during application launch
Contributor contributor = contributorDao.read("dev@elimu.ai");
- // Authenticate
- new CustomAuthenticationManager().authenticateUser(contributor);
-
// Add Contributor object to session
request.getSession().setAttribute("contributor", contributor);
diff --git a/src/main/java/ai/elimu/web/SignOnControllerDiscord.java b/src/main/java/ai/elimu/web/SignOnControllerDiscord.java
index a5a3ca0dd..d704e8f1f 100644
--- a/src/main/java/ai/elimu/web/SignOnControllerDiscord.java
+++ b/src/main/java/ai/elimu/web/SignOnControllerDiscord.java
@@ -159,7 +159,6 @@ public String handleCallback(HttpServletRequest request) throws IOException, Int
if (contributor.getEmail() == null) {
// Ask the Contributor to add their e-mail manually
request.getSession().setAttribute("contributor", contributor);
- new CustomAuthenticationManager().authenticateUser(contributor);
return "redirect:/content/contributor/add-email";
}
contributorDao.create(contributor);
@@ -180,7 +179,6 @@ public String handleCallback(HttpServletRequest request) throws IOException, Int
contributor = existingContributor;
}
- new CustomAuthenticationManager().authenticateUser(contributor);
// Add Contributor object to session
request.getSession().setAttribute("contributor", contributor);
diff --git a/src/main/java/ai/elimu/web/SignOnControllerGitHub.java b/src/main/java/ai/elimu/web/SignOnControllerGitHub.java
index 00997bc88..95a70d516 100644
--- a/src/main/java/ai/elimu/web/SignOnControllerGitHub.java
+++ b/src/main/java/ai/elimu/web/SignOnControllerGitHub.java
@@ -165,7 +165,6 @@ public String handleCallback(HttpServletRequest request, Model model) {
if (contributor.getEmail() == null) {
// Ask the Contributor to add her e-mail manually
request.getSession().setAttribute("contributor", contributor);
- new CustomAuthenticationManager().authenticateUser(contributor);
return "redirect:/content/contributor/add-email";
}
contributorDao.create(contributor);
@@ -193,9 +192,6 @@ public String handleCallback(HttpServletRequest request, Model model) {
contributor = existingContributor;
}
- // Authenticate
- new CustomAuthenticationManager().authenticateUser(contributor);
-
// Add Contributor object to session
request.getSession().setAttribute("contributor", contributor);
diff --git a/src/main/java/ai/elimu/web/SignOnControllerSelenium.java b/src/main/java/ai/elimu/web/SignOnControllerSelenium.java
index 645790abc..d75b2a933 100644
--- a/src/main/java/ai/elimu/web/SignOnControllerSelenium.java
+++ b/src/main/java/ai/elimu/web/SignOnControllerSelenium.java
@@ -59,9 +59,6 @@ public String handleRequest(
logger.info("Contributor " + contributor.getEmail() + " was created at " + request.getServerName());
}
- // Authenticate
- new CustomAuthenticationManager().authenticateUser(contributor);
-
// Add Contributor object to session
request.getSession().setAttribute("contributor", contributor);
diff --git a/src/main/java/ai/elimu/web/SignOnControllerWeb3.java b/src/main/java/ai/elimu/web/SignOnControllerWeb3.java
index ffd50cbb0..e419bd4d2 100644
--- a/src/main/java/ai/elimu/web/SignOnControllerWeb3.java
+++ b/src/main/java/ai/elimu/web/SignOnControllerWeb3.java
@@ -101,9 +101,6 @@ public String handleAuthorization(
} else {
contributor = existingContributor;
}
-
- // Authenticate
- new CustomAuthenticationManager().authenticateUser(contributor);
// Add Contributor object to session
request.getSession().setAttribute("contributor", contributor);
diff --git a/src/main/java/ai/elimu/web/SignOutController.java b/src/main/java/ai/elimu/web/SignOutController.java
new file mode 100644
index 000000000..c8a824c46
--- /dev/null
+++ b/src/main/java/ai/elimu/web/SignOutController.java
@@ -0,0 +1,26 @@
+package ai.elimu.web;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+@Controller
+@RequestMapping("/sign-out")
+public class SignOutController {
+
+ private Logger logger = LogManager.getLogger();
+
+ @RequestMapping(method = RequestMethod.GET)
+ public String handleRequest(HttpServletRequest request) {
+ logger.debug("handleRequest");
+
+ // Remove Contributor object from session
+ request.getSession().removeAttribute("contributor");
+
+ return "redirect:/sign-on?signed_out";
+ }
+}
diff --git a/src/main/java/ai/elimu/web/content/MainContentController.java b/src/main/java/ai/elimu/web/content/MainContentController.java
index b11377e63..5646a421a 100644
--- a/src/main/java/ai/elimu/web/content/MainContentController.java
+++ b/src/main/java/ai/elimu/web/content/MainContentController.java
@@ -5,8 +5,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-import org.apache.commons.lang.StringUtils;
-
import org.apache.logging.log4j.Logger;
import ai.elimu.dao.AudioDao;
import ai.elimu.dao.ContributorDao;
@@ -23,14 +21,11 @@
import ai.elimu.dao.WordContributionEventDao;
import ai.elimu.dao.WordDao;
import ai.elimu.model.contributor.Contributor;
-import ai.elimu.model.v2.enums.Environment;
-import ai.elimu.web.context.EnvironmentContextLoaderListener;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.web.savedrequest.DefaultSavedRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -99,24 +94,6 @@ public String handleRequest(
Model model) {
logger.info("handleRequest");
- // Check if the Contributor has not yet provided all required details
- Contributor contributor = (Contributor) session.getAttribute("contributor");
- if (StringUtils.isBlank(contributor.getEmail())) {
- return "redirect:/content/contributor/add-email";
- } else if (StringUtils.isBlank(contributor.getFirstName()) || StringUtils.isBlank(contributor.getLastName())) {
- return "redirect:/content/contributor/edit-name";
- } else if (StringUtils.isBlank(contributor.getMotivation()) && (EnvironmentContextLoaderListener.env != Environment.DEV)) {
- return "redirect:/content/contributor/edit-motivation";
- } else {
- // Redirect to originally requested URL
- DefaultSavedRequest defaultSavedRequest = (DefaultSavedRequest) session.getAttribute("SPRING_SECURITY_SAVED_REQUEST");
- logger.info("defaultSavedRequest: " + defaultSavedRequest);
- if (defaultSavedRequest != null) {
- logger.info("Redirecting to " + defaultSavedRequest.getServletPath());
- return "redirect:" + defaultSavedRequest.getServletPath();
- }
- }
-
model.addAttribute("letterCount", letterDao.readCount());
model.addAttribute("soundCount", soundDao.readCount());
model.addAttribute("letterSoundCount", letterSoundDao.readCount());
diff --git a/src/main/webapp/WEB-INF/jsp/admin/layout.jsp b/src/main/webapp/WEB-INF/jsp/admin/layout.jsp
index 3e7dd6453..f81698894 100644
--- a/src/main/webapp/WEB-INF/jsp/admin/layout.jsp
+++ b/src/main/webapp/WEB-INF/jsp/admin/layout.jsp
@@ -98,16 +98,16 @@
mode_edit
<%--
mail--%>
-
+
build
-
-
+
+
timeline
-
+
- power_settings_new
+ power_settings_new
diff --git a/src/main/webapp/WEB-INF/jsp/content/layout.jsp b/src/main/webapp/WEB-INF/jsp/content/layout.jsp
index 7b821d873..175c6c752 100644
--- a/src/main/webapp/WEB-INF/jsp/content/layout.jsp
+++ b/src/main/webapp/WEB-INF/jsp/content/layout.jsp
@@ -204,16 +204,16 @@
mode_edit
<%--
mail--%>
-
+
build
-
-
+
+
timeline
-
+
- power_settings_new
+ power_settings_new
diff --git a/src/main/webapp/WEB-INF/jsp/content/multimedia/image/edit.jsp b/src/main/webapp/WEB-INF/jsp/content/multimedia/image/edit.jsp
index 0c3d79c50..fc3b61083 100644
--- a/src/main/webapp/WEB-INF/jsp/content/multimedia/image/edit.jsp
+++ b/src/main/webapp/WEB-INF/jsp/content/multimedia/image/edit.jsp
@@ -95,9 +95,9 @@
-
+
-
+
diff --git a/src/main/webapp/WEB-INF/jsp/content/storybook/edit.jsp b/src/main/webapp/WEB-INF/jsp/content/storybook/edit.jsp
index e31232e17..3a585a125 100644
--- a/src/main/webapp/WEB-INF/jsp/content/storybook/edit.jsp
+++ b/src/main/webapp/WEB-INF/jsp/content/storybook/edit.jsp
@@ -96,9 +96,9 @@
-
+
delete
-
+
${storyBookChapter.sortOrder + 1}/${fn:length(storyBookChapters)}
diff --git a/src/main/webapp/WEB-INF/jsp/content/storybook/paragraph/edit.jsp b/src/main/webapp/WEB-INF/jsp/content/storybook/paragraph/edit.jsp
index 95871b22e..f5d69749c 100644
--- a/src/main/webapp/WEB-INF/jsp/content/storybook/paragraph/edit.jsp
+++ b/src/main/webapp/WEB-INF/jsp/content/storybook/paragraph/edit.jsp
@@ -31,9 +31,9 @@
-
+
-
+
diff --git a/src/main/webapp/WEB-INF/jsp/content/word/edit.jsp b/src/main/webapp/WEB-INF/jsp/content/word/edit.jsp
index dd9012643..1474f0b68 100644
--- a/src/main/webapp/WEB-INF/jsp/content/word/edit.jsp
+++ b/src/main/webapp/WEB-INF/jsp/content/word/edit.jsp
@@ -166,9 +166,9 @@
-
+
-
+
diff --git a/src/main/webapp/WEB-INF/jsp/layout.jsp b/src/main/webapp/WEB-INF/jsp/layout.jsp
index bd380894e..8a6814d09 100644
--- a/src/main/webapp/WEB-INF/jsp/layout.jsp
+++ b/src/main/webapp/WEB-INF/jsp/layout.jsp
@@ -59,7 +59,7 @@
-
+
@@ -111,8 +111,8 @@
-
-
+
+
-
+