mirror of https://gitee.com/topiam/eiam
♻️ CAS协议完善
parent
7e1b737473
commit
0654158dfd
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 协议端点
|
||||
*/
|
||||
|
|
|
@ -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<AppCasConfigPO> {
|
|||
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<AppCasConfigPO> {
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue