🏗️ 结构调整

pull/80/head
awenes 2024-02-04 21:26:40 +08:00
parent fa8963f200
commit b64c4e109b
9 changed files with 14 additions and 15 deletions

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package cn.topiam.employee.portal.security.handler; package cn.topiam.employee.portal.authentication;
import java.io.IOException; import java.io.IOException;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package cn.topiam.employee.portal.security.handler; package cn.topiam.employee.portal.authentication;
import java.io.IOException; import java.io.IOException;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package cn.topiam.employee.portal.security.listener; package cn.topiam.employee.portal.authentication;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Objects; import java.util.Objects;

View File

@ -15,11 +15,10 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package cn.topiam.employee.portal.security.handler; package cn.topiam.employee.portal.authentication;
import java.io.IOException; import java.io.IOException;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.autoconfigure.web.ServerProperties;
@ -73,7 +72,7 @@ public class PortalAuthenticationFailureHandler implements
//@formatter:off //@formatter:off
ApiRestResult.RestResultBuilder<String> builder = ApiRestResult.<String> builder() ApiRestResult.RestResultBuilder<String> builder = ApiRestResult.<String> builder()
.status(EX000101.getCode()) .status(EX000101.getCode())
.message(StringUtils.defaultString(exception.getMessage(),EX000101.getMessage())); .message(Objects.toString(exception.getMessage(),EX000101.getMessage()));
//@formatter:on //@formatter:on
ApiRestResult<String> result = builder.build(); ApiRestResult<String> result = builder.build();
request.getSession().removeAttribute(SecretType.LOGIN.getKey()); request.getSession().removeAttribute(SecretType.LOGIN.getKey());

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package cn.topiam.employee.portal.security.listener; package cn.topiam.employee.portal.authentication;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull; import org.springframework.lang.NonNull;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package cn.topiam.employee.portal.security.handler; package cn.topiam.employee.portal.authentication;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -47,7 +47,7 @@ import cn.topiam.employee.support.security.authentication.AuthenticationProvider
import cn.topiam.employee.support.security.authentication.WebAuthenticationDetails; import cn.topiam.employee.support.security.authentication.WebAuthenticationDetails;
import cn.topiam.employee.support.security.userdetails.UserDetails; import cn.topiam.employee.support.security.userdetails.UserDetails;
import cn.topiam.employee.support.util.HttpResponseUtils; import cn.topiam.employee.support.util.HttpResponseUtils;
import cn.topiam.employee.support.util.HttpUrlUtils; import cn.topiam.employee.support.util.UrlUtils;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
@ -116,7 +116,7 @@ public class PortalAuthenticationSuccessHandler extends
auditEventPublish.publish(LOGIN_PORTAL, authentication, EventStatus.SUCCESS,targets); auditEventPublish.publish(LOGIN_PORTAL, authentication, EventStatus.SUCCESS,targets);
//响应 //响应
if (isHtmlRequest){ if (isHtmlRequest){
response.sendRedirect(HttpUrlUtils.format(getPortalPublicBaseUrl() + JUMP_PATH)); response.sendRedirect(UrlUtils.format(getPortalPublicBaseUrl() + JUMP_PATH));
return; return;
} }
HttpResponseUtils.flushResponseJson(response, HttpStatus.OK.value(), ApiRestResult.ok()); HttpResponseUtils.flushResponseJson(response, HttpStatus.OK.value(), ApiRestResult.ok());

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package cn.topiam.employee.portal.security.listener; package cn.topiam.employee.portal.authentication;
import java.util.List; import java.util.List;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package cn.topiam.employee.portal.security.handler; package cn.topiam.employee.portal.authentication;
import java.io.IOException; import java.io.IOException;
@ -27,7 +27,7 @@ import org.springframework.security.core.Authentication;
import cn.topiam.employee.core.help.ServerHelp; import cn.topiam.employee.core.help.ServerHelp;
import cn.topiam.employee.support.result.ApiRestResult; import cn.topiam.employee.support.result.ApiRestResult;
import cn.topiam.employee.support.util.HttpResponseUtils; import cn.topiam.employee.support.util.HttpResponseUtils;
import cn.topiam.employee.support.util.HttpUrlUtils; import cn.topiam.employee.support.util.UrlUtils;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
@ -61,7 +61,7 @@ public class PortalLogoutSuccessHandler implements
ApiRestResult.builder().status(SUCCESS).build()); ApiRestResult.builder().status(SUCCESS).build());
return; return;
} }
response.sendRedirect(HttpUrlUtils.format(ServerHelp.getPortalPublicBaseUrl() + FE_LOGIN)); response.sendRedirect(UrlUtils.format(ServerHelp.getPortalPublicBaseUrl() + FE_LOGIN));
//@formatter:on //@formatter:on
} }
} }

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package cn.topiam.employee.portal.security.listener; package cn.topiam.employee.portal.authentication;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.security.web.session.SessionInformationExpiredEvent; import org.springframework.security.web.session.SessionInformationExpiredEvent;