Logout Application

Former-commit-id: a6b157306e
pull/8/head
Jens Pelzetter 2021-01-06 17:13:40 +01:00
parent 707562de6e
commit 510a54921e
5 changed files with 134 additions and 1 deletions

View File

@ -118,7 +118,7 @@ public class LoginController {
models.put("loginFailed", true); models.put("loginFailed", true);
return getLoginForm(uriInfo, returnUrl); return getLoginForm(uriInfo, returnUrl);
} }
try { try {
return Response.seeOther( return Response.seeOther(
new URI( new URI(

View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.libreccm.ui.login;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@ApplicationPath("/@logout")
public class LogoutApplication extends Application {
@Override
public Set<Class<?>> getClasses() {
final Set<Class<?>> classes = new HashSet<>();
classes.add(LogoutController.class);
return classes;
}
}

View File

@ -0,0 +1,55 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.libreccm.ui.login;
import org.apache.shiro.subject.Subject;
import org.libreccm.theming.mvc.ThemesMvc;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.mvc.Controller;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Controller
@Path("/")
@RequestScoped
public class LogoutController {
@Inject
private Subject subject;
@Inject
private ThemesMvc themesMvc;
@GET
@Path("/")
public String logout(@Context final UriInfo uriInfo) {
subject.logout();
return themesMvc.getMvcTemplate(uriInfo, "logout");
}
}

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>Category page</title>
<link rel="stylesheet" href="${themeUrl}/style.css" />
</head>
<body>
<main>
<h1>Logout successful</h1>
<p>Logout successful</p>
</main>
</body>
</html>

View File

@ -77,6 +77,30 @@
] ]
} }
} }
},
"logout": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Logout successful"
}
]
}
},
"name": "loggedout",
"path": "logout/loggedout.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Logout succesful"
}
]
}
}
} }
} }
} }