All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.simiacryptus.skyenet.webui.servlet.LogoutServlet.kt Maven / Gradle / Ivy

There is a newer version: 1.2.21
Show newest version
package com.simiacryptus.skyenet.webui.servlet

import com.simiacryptus.skyenet.core.platform.ApplicationServices
import com.simiacryptus.skyenet.webui.application.ApplicationServer.Companion.getCookie
import jakarta.servlet.http.HttpServlet
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse

class LogoutServlet : HttpServlet() {
    public override fun doGet(req: HttpServletRequest, resp: HttpServletResponse) {
        val cookie = req.getCookie()
        val user = ApplicationServices.authenticationManager.getUser(cookie)
        if (null == user) {
            resp.status = HttpServletResponse.SC_BAD_REQUEST
        } else {
            ApplicationServices.authenticationManager.logout(cookie ?: "", user)
            resp.sendRedirect("/")
        }
    }

    companion object
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy