Skip to content

Commit

Permalink
refactor: remove spring security - sign out
Browse files Browse the repository at this point in the history
Restore sign out functionality.

#1961
  • Loading branch information
jo-elimu committed Jan 15, 2025
1 parent 89bc0a1 commit e6e856e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
26 changes: 26 additions & 0 deletions src/main/java/ai/elimu/web/SignOutController.java
Original file line number Diff line number Diff line change
@@ -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";
}
}
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/jsp/admin/layout.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<li><a href="<spring:url value='/analytics' />"><i class="material-icons left">timeline</i><fmt:message key="analytics" /></a></li>
</c:if>
<li class="divider"></li>
<li><a id="logout" href="<spring:url value='/logout' />"><i class="material-icons left">power_settings_new</i><fmt:message key="sign.out" /></a></li>
<li><a id="logout" href="<spring:url value='/sign-out' />"><i class="material-icons left">power_settings_new</i><fmt:message key="sign.out" /></a></li>
</ul>
</ul>

Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/jsp/content/layout.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
<li><a href="<spring:url value='/analytics' />"><i class="material-icons left">timeline</i><fmt:message key="analytics" /></a></li>
</c:if>
<li class="divider"></li>
<li><a id="logout" href="<spring:url value='/logout' />"><i class="material-icons left">power_settings_new</i><fmt:message key="sign.out" /></a></li>
<li><a id="logout" href="<spring:url value='/sign-out' />"><i class="material-icons left">power_settings_new</i><fmt:message key="sign.out" /></a></li>
</ul>
</ul>

Expand Down

0 comments on commit e6e856e

Please sign in to comment.