From 0654158dfd6f62f0e108b31eb367008402680503 Mon Sep 17 00:00:00 2001 From: smallbun <2689170096@qq.com> Date: Wed, 8 Feb 2023 15:59:58 +0800 Subject: [PATCH] =?UTF-8?q?:recycle:=20CAS=E5=8D=8F=E8=AE=AE=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppCasStandardConfigConverter.java | 25 ++++++++----------- .../pojo/AppCasStandardConfigGetResult.java | 25 +++++++++++++------ .../app/impl/mapper/AppCasConfigPoMapper.java | 15 ++++++----- 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/converter/AppCasStandardConfigConverter.java b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/converter/AppCasStandardConfigConverter.java index 8cd8fb0a..391c7184 100644 --- a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/converter/AppCasStandardConfigConverter.java +++ b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/converter/AppCasStandardConfigConverter.java @@ -44,30 +44,25 @@ public interface AppCasStandardConfigConverter { default AppCasStandardConfigGetResult entityConverterToCasConfigResult(AppCasConfigPO po) { AppCasStandardConfigGetResult result = new AppCasStandardConfigGetResult(); result.setAuthorizationType(po.getAuthorizationType()); + result.setAppId(String.valueOf(po.getAppId())); result.setInitLoginType(po.getInitLoginType()); result.setInitLoginUrl(po.getInitLoginUrl()); result.setClientServiceUrl(po.getClientServiceUrl()); result.setUserIdentityType(po.getUserIdentityType()); + result.setServiceTicketExpireTime(po.getServiceTicketExpireTime()); //封装端点信息 + //@formatter:off AppCasProtocolEndpoint protocolEndpoint = new AppCasProtocolEndpoint(); String baseUrl = ServerContextHelp.getPortalPublicBaseUrl(); - protocolEndpoint - .setCasSsoEndpoint(baseUrl + ProtocolConstants.CasEndpointConstants.CAS_LOGIN_PATH - .replace(APP_CODE_VARIABLE, po.getAppCode())); - protocolEndpoint - .setCasSloEndpoint(baseUrl + ProtocolConstants.CasEndpointConstants.CAS_LOGOUT_PATH - .replace(APP_CODE_VARIABLE, po.getAppCode())); - protocolEndpoint.setCasValidateEndpoint( - baseUrl + ProtocolConstants.CasEndpointConstants.CAS_VALIDATE_V1_PATH - .replace(APP_CODE_VARIABLE, po.getAppCode())); - protocolEndpoint.setCasValidateV2Endpoint( - baseUrl + ProtocolConstants.CasEndpointConstants.CAS_VALIDATE_V2_PATH - .replace(APP_CODE_VARIABLE, po.getAppCode())); - protocolEndpoint.setCasValidateV3Endpoint( - baseUrl + ProtocolConstants.CasEndpointConstants.CAS_VALIDATE_V3_PATH - .replace(APP_CODE_VARIABLE, po.getAppCode())); + protocolEndpoint.setCasServerUrlPrefix(baseUrl+ProtocolConstants.CasEndpointConstants.CAS_AUTHORIZE_BASE_PATH.replace(APP_CODE_VARIABLE, po.getAppCode())); + protocolEndpoint.setCasSsoEndpoint(baseUrl + ProtocolConstants.CasEndpointConstants.CAS_LOGIN_PATH.replace(APP_CODE_VARIABLE, po.getAppCode())); + protocolEndpoint.setCasSloEndpoint(baseUrl + ProtocolConstants.CasEndpointConstants.CAS_LOGOUT_PATH.replace(APP_CODE_VARIABLE, po.getAppCode())); + protocolEndpoint.setCasValidateEndpoint(baseUrl + ProtocolConstants.CasEndpointConstants.CAS_VALIDATE_V1_PATH.replace(APP_CODE_VARIABLE, po.getAppCode())); + protocolEndpoint.setCasValidateV2Endpoint(baseUrl + ProtocolConstants.CasEndpointConstants.CAS_VALIDATE_V2_PATH.replace(APP_CODE_VARIABLE, po.getAppCode())); + protocolEndpoint.setCasValidateV3Endpoint(baseUrl + ProtocolConstants.CasEndpointConstants.CAS_VALIDATE_V3_PATH.replace(APP_CODE_VARIABLE, po.getAppCode())); result.setProtocolEndpoint(protocolEndpoint); + //@formatter:on return result; } } diff --git a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/pojo/AppCasStandardConfigGetResult.java b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/pojo/AppCasStandardConfigGetResult.java index b79c8434..b33aca7a 100644 --- a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/pojo/AppCasStandardConfigGetResult.java +++ b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/pojo/AppCasStandardConfigGetResult.java @@ -21,6 +21,7 @@ import cn.topiam.employee.common.enums.app.AuthorizationType; import cn.topiam.employee.common.enums.app.CasUserIdentityType; import cn.topiam.employee.common.enums.app.InitLoginType; +import io.swagger.v3.oas.annotations.Parameter; import lombok.Data; import io.swagger.v3.oas.annotations.media.Schema; @@ -34,23 +35,29 @@ import io.swagger.v3.oas.annotations.media.Schema; public class AppCasStandardConfigGetResult { /** - * 应用ID + * 应用id */ - @Schema(description = "授权类型") - private AuthorizationType authorizationType; + @Schema(description = "应用id") + private String appId; /** - * SSO 发起登录类型 + * SSO 发起方 */ - @Schema(description = "SSO 发起登录类型") + @Parameter(description = "SSO 发起方") private InitLoginType initLoginType; /** - * SSO 发起登录URL + * SSO 登录链接 */ - @Schema(description = "SSO 发起登录URL") + @Parameter(description = "SSO 登录链接") private String initLoginUrl; + /** + * 授权范围 + */ + @Parameter(description = "SSO 授权范围") + private AuthorizationType authorizationType; + /** * 客户端服务URL */ @@ -63,6 +70,10 @@ public class AppCasStandardConfigGetResult { @Schema(name = "用户身份类型标识") private CasUserIdentityType userIdentityType; + /** + * serviceTicket 过期时间(秒) + */ + private Integer serviceTicketExpireTime; /** * CAS 协议端点 */ diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/mapper/AppCasConfigPoMapper.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/mapper/AppCasConfigPoMapper.java index 64da5f65..e399bc60 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/mapper/AppCasConfigPoMapper.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/mapper/AppCasConfigPoMapper.java @@ -17,16 +17,16 @@ */ package cn.topiam.employee.common.repository.app.impl.mapper; +import cn.topiam.employee.common.entity.app.po.AppCasConfigPO; +import cn.topiam.employee.common.enums.app.AuthorizationType; +import cn.topiam.employee.common.enums.app.CasUserIdentityType; +import cn.topiam.employee.common.enums.app.InitLoginType; +import org.springframework.jdbc.core.RowMapper; + import java.sql.ResultSet; import java.sql.SQLException; import java.time.LocalDateTime; -import org.springframework.jdbc.core.RowMapper; - -import cn.topiam.employee.common.entity.app.po.AppCasConfigPO; -import cn.topiam.employee.common.enums.app.CasUserIdentityType; -import cn.topiam.employee.common.enums.app.InitLoginType; - /** * AppCasConfigPOPOMapper * @@ -45,6 +45,8 @@ public class AppCasConfigPoMapper implements RowMapper { configPo.setClientSecret(rs.getString("client_secret")); configPo.setInitLoginType(InitLoginType.getType(rs.getString("init_login_type"))); configPo.setInitLoginUrl(rs.getString("init_login_url")); + configPo + .setAuthorizationType(AuthorizationType.getType(rs.getString("authorization_type"))); configPo.setAppTemplate(rs.getString("template_")); configPo.setCreateBy(rs.getString("create_by")); configPo.setCreateTime(rs.getObject("create_time", LocalDateTime.class)); @@ -52,6 +54,7 @@ public class AppCasConfigPoMapper implements RowMapper { configPo.setCreateTime(rs.getObject("update_time", LocalDateTime.class)); configPo.setRemark(rs.getString("remark_")); configPo.setClientServiceUrl(rs.getString("client_service_url")); + configPo.setServiceTicketExpireTime(rs.getInt("service_ticket_expire_time")); configPo .setUserIdentityType(CasUserIdentityType.getType(rs.getString("user_identity_type"))); return configPo;