
org.structr.web.resource.LogoutResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of structr-ui Show documentation
Show all versions of structr-ui Show documentation
Structr is an open source framework based on the popular Neo4j graph database.
The newest version!
/**
* Copyright (C) 2010-2016 Structr GmbH
*
* This file is part of Structr .
*
* Structr is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Structr 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Structr. If not, see .
*/
package org.structr.web.resource;
import org.structr.common.SecurityContext;
import org.structr.common.error.FrameworkException;
import org.structr.core.Result;
import org.structr.rest.RestMethodResult;
import org.structr.rest.exception.NotAllowedException;
import org.structr.rest.resource.Resource;
//~--- JDK imports ------------------------------------------------------------
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.structr.core.property.PropertyKey;
//~--- classes ----------------------------------------------------------------
/**
* Resource that handles logs a user out
*
*
*/
public class LogoutResource extends Resource {
//~--- methods --------------------------------------------------------
@Override
public boolean checkAndConfigure(String part, SecurityContext securityContext, HttpServletRequest request) {
this.securityContext = securityContext;
if (getUriPart().equals(part)) {
return true;
}
return false;
}
@Override
public RestMethodResult doPost(Map propertySet) throws FrameworkException {
securityContext.getAuthenticator().doLogout(securityContext.getRequest());
return new RestMethodResult(200);
}
@Override
public Result doGet(PropertyKey sortKey, boolean sortDescending, int pageSize, int page, String offsetId) throws FrameworkException {
throw new NotAllowedException("GET not allowed on " + getResourceSignature());
}
@Override
public RestMethodResult doPut(Map propertySet) throws FrameworkException {
throw new NotAllowedException("PUT not allowed on " + getResourceSignature());
}
@Override
public RestMethodResult doDelete() throws FrameworkException {
throw new NotAllowedException("DELETE not allowed on " + getResourceSignature());
}
@Override
public RestMethodResult doOptions() throws FrameworkException {
throw new NotAllowedException("OPTIONS not allowed on " + getResourceSignature());
}
@Override
public Resource tryCombineWith(Resource next) throws FrameworkException {
return null;
}
// ----- private methods -----
//~--- get methods ----------------------------------------------------
@Override
public Class getEntityClass() {
return null;
}
@Override
public String getUriPart() {
return "logout";
}
@Override
public String getResourceSignature() {
return "_logout";
}
@Override
public boolean isCollectionResource() {
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy