From 8f1435cf7a6b8ea5e75c1aa1b95d89bd6b1c8a28 Mon Sep 17 00:00:00 2001 From: smallbun <2689170096@qq.com> Date: Tue, 3 Jan 2023 11:23:22 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E5=85=A8=E5=B1=80=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cas/AbstractCasApplicationService.java | 7 ++- .../CasStandardApplicationServiceImpl.java | 22 +++---- .../AppCasStandardConfigConverter.java | 17 ++++++ .../model/AppCasStandardConfigGetResult.java | 21 ++++++- .../model/AppCasStandardSaveConfigParam.java | 31 ++++++++-- .../AbstractApplicationService.java | 25 ++++---- .../application/CasApplicationService.java | 17 ++++++ .../Saml2StandardApplicationServiceImpl.java | 2 - .../common/constants/ProtocolConstants.java | 2 +- .../app/impl/mapper/AppCasConfigPoMapper.java | 9 +-- .../topiam/employee/common/util/CasUtils.java | 17 ++++++ .../employee/core/protocol/CasSsoModel.java | 21 ++++++- .../protocol/cas/idp/CasIdpConfigurer.java | 23 ++++---- .../cas/idp/auth/AuthenticationContext.java | 17 ++++++ .../auth/CentralAuthenticationService.java | 17 ++++++ .../auth/CentralAuthenticationServiceImp.java | 23 +++++++- .../cas/idp/auth/CentralCacheService.java | 26 +++++++-- .../idp/configuration/CasConfiguration.java | 26 +++++++-- .../cas/idp/constant/ProtocolConstants.java | 17 ++++++ .../CasIdpSingleSignOnEndpointFilter.java | 58 ++++++++++++------- .../CasIdpValidateEndpointFilter.java | 52 +++++++++++------ .../CasAuthorizationServerContextFilter.java | 46 ++++++++++----- .../tickets/DefaultServiceTicketFactory.java | 17 ++++++ .../cas/idp/tickets/DefaultTicketFactory.java | 17 ++++++ .../DefaultTicketGrantingTicketFactory.java | 17 ++++++ .../idp/tickets/DefaultTicketRegistry.java | 26 ++++++++- .../cas/idp/tickets/ServiceTicket.java | 17 ++++++ .../cas/idp/tickets/ServiceTicketFactory.java | 17 ++++++ .../cas/idp/tickets/ServiceTicketImpl.java | 17 ++++++ .../protocol/cas/idp/tickets/Ticket.java | 17 ++++++ .../cas/idp/tickets/TicketFactory.java | 17 ++++++ .../cas/idp/tickets/TicketGrantingTicket.java | 17 ++++++ .../tickets/TicketGrantingTicketFactory.java | 17 ++++++ .../idp/tickets/TicketGrantingTicketImpl.java | 22 ++++++- .../cas/idp/tickets/TicketRegistry.java | 17 ++++++ .../protocol/cas/idp/util/CasUtils.java | 9 +-- .../protocol/cas/idp/util/TicketUtils.java | 21 ++++++- .../cas/idp/xml/ResponseGenerator.java | 17 ++++++ .../cas/idp/xml/ResponseGeneratorImpl.java | 39 +++++++++---- 39 files changed, 681 insertions(+), 136 deletions(-) diff --git a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/AbstractCasApplicationService.java b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/AbstractCasApplicationService.java index 46e1d915..fe599ecb 100644 --- a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/AbstractCasApplicationService.java +++ b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/AbstractCasApplicationService.java @@ -17,14 +17,15 @@ */ package cn.topiam.employee.application.cas; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.transaction.annotation.Transactional; + import cn.topiam.employee.application.AbstractApplicationService; import cn.topiam.employee.application.CasApplicationService; import cn.topiam.employee.common.entity.app.po.AppCasConfigPO; import cn.topiam.employee.common.repository.app.*; import cn.topiam.employee.core.protocol.CasSsoModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.transaction.annotation.Transactional; /** * CAS 应用配置 diff --git a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/CasStandardApplicationServiceImpl.java b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/CasStandardApplicationServiceImpl.java index 883296e9..664eefee 100644 --- a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/CasStandardApplicationServiceImpl.java +++ b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/CasStandardApplicationServiceImpl.java @@ -17,6 +17,17 @@ */ package cn.topiam.employee.application.cas; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import javax.validation.ConstraintViolationException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + import cn.topiam.employee.application.cas.model.AppCasStandardConfigGetResult; import cn.topiam.employee.application.cas.model.AppCasStandardSaveConfigParam; import cn.topiam.employee.application.exception.AppNotExistException; @@ -33,18 +44,9 @@ import cn.topiam.employee.common.repository.app.*; import cn.topiam.employee.core.context.ServerContextHelp; import cn.topiam.employee.support.exception.TopIamException; import cn.topiam.employee.support.validation.ValidationHelp; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.validation.ConstraintViolationException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES; import static cn.topiam.employee.common.constants.ProtocolConstants.APP_CODE_VARIABLE; -import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES; /** * Cas 用户应用 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 9fec2453..7ec322a5 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 @@ -1,3 +1,20 @@ +/* + * eiam-application-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.application.cas.converter; import org.mapstruct.Mapper; diff --git a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/model/AppCasStandardConfigGetResult.java b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/model/AppCasStandardConfigGetResult.java index b0fc3dcf..a36731d5 100644 --- a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/model/AppCasStandardConfigGetResult.java +++ b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/model/AppCasStandardConfigGetResult.java @@ -1,10 +1,29 @@ +/* + * eiam-application-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.application.cas.model; import cn.topiam.employee.common.enums.app.AuthorizationType; import cn.topiam.employee.common.enums.app.InitLoginType; + +import lombok.Data; + import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; /** * @author TopIAM diff --git a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/model/AppCasStandardSaveConfigParam.java b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/model/AppCasStandardSaveConfigParam.java index 5550254e..0cebd1bf 100644 --- a/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/model/AppCasStandardSaveConfigParam.java +++ b/eiam-application/eiam-application-cas/src/main/java/cn/topiam/employee/application/cas/model/AppCasStandardSaveConfigParam.java @@ -1,14 +1,33 @@ +/* + * eiam-application-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.application.cas.model; -import cn.topiam.employee.common.enums.app.AuthorizationType; -import cn.topiam.employee.common.enums.app.InitLoginType; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import java.io.Serial; import java.io.Serializable; +import cn.topiam.employee.common.enums.app.AuthorizationType; +import cn.topiam.employee.common.enums.app.InitLoginType; + +import lombok.Data; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Schema; + /** * @author TopIAM * Created by support@topiam.cn on 2023/1/2 22:27 diff --git a/eiam-application/eiam-application-core/src/main/java/cn/topiam/employee/application/AbstractApplicationService.java b/eiam-application/eiam-application-core/src/main/java/cn/topiam/employee/application/AbstractApplicationService.java index 1115fd62..2ab05cd0 100644 --- a/eiam-application/eiam-application-core/src/main/java/cn/topiam/employee/application/AbstractApplicationService.java +++ b/eiam-application/eiam-application-core/src/main/java/cn/topiam/employee/application/AbstractApplicationService.java @@ -17,6 +17,19 @@ */ package cn.topiam.employee.application; +import java.math.BigInteger; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Date; + +import org.bouncycastle.asn1.x500.X500Name; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.AlternativeJdkIdGenerator; +import org.springframework.util.IdGenerator; + +import com.fasterxml.jackson.databind.ObjectMapper; + import cn.topiam.employee.common.entity.app.AppCertEntity; import cn.topiam.employee.common.enums.app.AppCertUsingType; import cn.topiam.employee.common.repository.app.AppAccessPolicyRepository; @@ -26,18 +39,6 @@ import cn.topiam.employee.common.repository.app.AppRepository; import cn.topiam.employee.support.exception.TopIamException; import cn.topiam.employee.support.util.CertUtils; import cn.topiam.employee.support.util.RsaUtils; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.bouncycastle.asn1.x500.X500Name; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.AlternativeJdkIdGenerator; -import org.springframework.util.IdGenerator; - -import java.math.BigInteger; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.Date; - import static cn.topiam.employee.support.util.CertUtils.encodePem; import static cn.topiam.employee.support.util.CertUtils.getX500Name; import static cn.topiam.employee.support.util.RsaUtils.getKeys; diff --git a/eiam-application/eiam-application-core/src/main/java/cn/topiam/employee/application/CasApplicationService.java b/eiam-application/eiam-application-core/src/main/java/cn/topiam/employee/application/CasApplicationService.java index 2e950e7d..c79e7c54 100644 --- a/eiam-application/eiam-application-core/src/main/java/cn/topiam/employee/application/CasApplicationService.java +++ b/eiam-application/eiam-application-core/src/main/java/cn/topiam/employee/application/CasApplicationService.java @@ -1,3 +1,20 @@ +/* + * eiam-application-core - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.application; import cn.topiam.employee.core.protocol.CasSsoModel; diff --git a/eiam-application/eiam-application-saml2/src/main/java/cn/topiam/employee/application/saml2/Saml2StandardApplicationServiceImpl.java b/eiam-application/eiam-application-saml2/src/main/java/cn/topiam/employee/application/saml2/Saml2StandardApplicationServiceImpl.java index 9674c251..f1e7acfa 100644 --- a/eiam-application/eiam-application-saml2/src/main/java/cn/topiam/employee/application/saml2/Saml2StandardApplicationServiceImpl.java +++ b/eiam-application/eiam-application-saml2/src/main/java/cn/topiam/employee/application/saml2/Saml2StandardApplicationServiceImpl.java @@ -28,8 +28,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.databind.ObjectMapper; - import cn.topiam.employee.application.exception.AppNotExistException; import cn.topiam.employee.application.saml2.converter.AppSaml2StandardConfigConverter; import cn.topiam.employee.application.saml2.model.AppSaml2StandardSaveConfigParam; diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/constants/ProtocolConstants.java b/eiam-common/src/main/java/cn/topiam/employee/common/constants/ProtocolConstants.java index 305e7e05..bae72d99 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/constants/ProtocolConstants.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/constants/ProtocolConstants.java @@ -18,10 +18,10 @@ package cn.topiam.employee.common.constants; import lombok.Data; +import static com.nimbusds.openid.connect.sdk.op.OIDCProviderConfigurationRequest.OPENID_PROVIDER_WELL_KNOWN_PATH; import static cn.topiam.employee.common.constants.AppConstants.APP_CACHE_NAME_PREFIX; import static cn.topiam.employee.common.constants.AuthorizeConstants.AUTHORIZE_PATH; -import static com.nimbusds.openid.connect.sdk.op.OIDCProviderConfigurationRequest.OPENID_PROVIDER_WELL_KNOWN_PATH; /** * Saml 常量 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 6a69de95..8a241dd0 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,14 +17,15 @@ */ 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.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.InitLoginType; + /** * AppCasConfigPOPOMapper * diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/util/CasUtils.java b/eiam-common/src/main/java/cn/topiam/employee/common/util/CasUtils.java index 320ce806..8055d392 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/util/CasUtils.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/util/CasUtils.java @@ -1,3 +1,20 @@ +/* + * eiam-common - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.common.util; import org.slf4j.Logger; diff --git a/eiam-core/src/main/java/cn/topiam/employee/core/protocol/CasSsoModel.java b/eiam-core/src/main/java/cn/topiam/employee/core/protocol/CasSsoModel.java index 86d41275..0f29414c 100644 --- a/eiam-core/src/main/java/cn/topiam/employee/core/protocol/CasSsoModel.java +++ b/eiam-core/src/main/java/cn/topiam/employee/core/protocol/CasSsoModel.java @@ -1,10 +1,27 @@ +/* + * eiam-core - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.core.protocol; +import java.io.Serializable; + import lombok.Builder; import lombok.Data; -import java.io.Serializable; - /** * @author TopIAM * Created by support@topiam.cn on 2023/1/2 11:50 diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/CasIdpConfigurer.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/CasIdpConfigurer.java index 3d4d8c94..fcc08d5d 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/CasIdpConfigurer.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/CasIdpConfigurer.java @@ -17,13 +17,11 @@ */ package cn.topiam.employee.protocol.cas.idp; -import cn.topiam.employee.application.ApplicationServiceLoader; -import cn.topiam.employee.common.repository.app.AppCasConfigRepository; -import cn.topiam.employee.protocol.cas.idp.auth.CentralAuthenticationService; -import cn.topiam.employee.protocol.cas.idp.endpoint.CasIdpSingleSignOnEndpointFilter; -import cn.topiam.employee.protocol.cas.idp.endpoint.CasIdpValidateEndpointFilter; -import cn.topiam.employee.protocol.cas.idp.filter.CasAuthorizationServerContextFilter; -import cn.topiam.employee.protocol.cas.idp.util.CasUtils; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; + import org.springframework.security.config.annotation.web.HttpSecurityBuilder; import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.core.session.SessionRegistry; @@ -31,10 +29,13 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic import org.springframework.security.web.util.matcher.OrRequestMatcher; import org.springframework.security.web.util.matcher.RequestMatcher; -import javax.xml.parsers.DocumentBuilder; -import java.util.ArrayList; -import java.util.List; - +import cn.topiam.employee.application.ApplicationServiceLoader; +import cn.topiam.employee.common.repository.app.AppCasConfigRepository; +import cn.topiam.employee.protocol.cas.idp.auth.CentralAuthenticationService; +import cn.topiam.employee.protocol.cas.idp.endpoint.CasIdpSingleSignOnEndpointFilter; +import cn.topiam.employee.protocol.cas.idp.endpoint.CasIdpValidateEndpointFilter; +import cn.topiam.employee.protocol.cas.idp.filter.CasAuthorizationServerContextFilter; +import cn.topiam.employee.protocol.cas.idp.util.CasUtils; import static cn.topiam.employee.protocol.cas.idp.util.CasUtils.*; /** diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/AuthenticationContext.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/AuthenticationContext.java index edf0fce6..f6badea2 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/AuthenticationContext.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/AuthenticationContext.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.auth; /** diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralAuthenticationService.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralAuthenticationService.java index 72cf0d37..8d11995c 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralAuthenticationService.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralAuthenticationService.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.auth; import cn.topiam.employee.core.security.userdetails.UserDetails; diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralAuthenticationServiceImp.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralAuthenticationServiceImp.java index d70d0f71..73a5c83d 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralAuthenticationServiceImp.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralAuthenticationServiceImp.java @@ -1,9 +1,28 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.auth; +import org.springframework.stereotype.Service; + +import com.google.common.base.Preconditions; + import cn.topiam.employee.core.security.userdetails.UserDetails; import cn.topiam.employee.protocol.cas.idp.tickets.*; -import com.google.common.base.Preconditions; -import org.springframework.stereotype.Service; /** * @author TopIAM diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralCacheService.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralCacheService.java index 6a6bf7e3..7f9ad523 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralCacheService.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/auth/CentralCacheService.java @@ -1,12 +1,30 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.auth; +import java.util.concurrent.TimeUnit; + +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + import cn.topiam.employee.protocol.cas.idp.tickets.ServiceTicket; import cn.topiam.employee.protocol.cas.idp.tickets.Ticket; import cn.topiam.employee.protocol.cas.idp.tickets.TicketGrantingTicket; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; - -import java.util.concurrent.TimeUnit; /** * @author TopIAM diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/configuration/CasConfiguration.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/configuration/CasConfiguration.java index 2ba45200..42a68e5d 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/configuration/CasConfiguration.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/configuration/CasConfiguration.java @@ -1,13 +1,31 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.configuration; -import cn.topiam.employee.protocol.cas.idp.tickets.DefaultTicketFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import cn.topiam.employee.protocol.cas.idp.tickets.DefaultTicketFactory; + /** * @author TopIAM * Created by support@topiam.cn on 2022/12/30 01:03 diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/constant/ProtocolConstants.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/constant/ProtocolConstants.java index 9d90039a..7aa82941 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/constant/ProtocolConstants.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/constant/ProtocolConstants.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.constant; /** diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/endpoint/CasIdpSingleSignOnEndpointFilter.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/endpoint/CasIdpSingleSignOnEndpointFilter.java index 34480424..06874fdc 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/endpoint/CasIdpSingleSignOnEndpointFilter.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/endpoint/CasIdpSingleSignOnEndpointFilter.java @@ -1,5 +1,43 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.endpoint; +import java.io.IOException; +import java.util.List; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.web.servlet.filter.OrderedFilter; +import org.springframework.core.Ordered; +import org.springframework.http.HttpMethod; +import org.springframework.security.core.session.SessionInformation; +import org.springframework.security.core.session.SessionRegistry; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; +import org.springframework.security.web.util.matcher.RequestMatcher; +import org.springframework.util.CollectionUtils; +import org.springframework.web.filter.OncePerRequestFilter; +import org.springframework.web.util.UriComponentsBuilder; + import cn.topiam.employee.application.ApplicationService; import cn.topiam.employee.application.ApplicationServiceLoader; import cn.topiam.employee.application.CasApplicationService; @@ -16,26 +54,6 @@ import cn.topiam.employee.protocol.cas.idp.auth.CentralAuthenticationService; import cn.topiam.employee.protocol.cas.idp.tickets.ServiceTicket; import cn.topiam.employee.protocol.cas.idp.tickets.TicketGrantingTicket; import cn.topiam.employee.support.exception.TopIamException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.boot.web.servlet.filter.OrderedFilter; -import org.springframework.core.Ordered; -import org.springframework.http.HttpMethod; -import org.springframework.security.core.session.SessionInformation; -import org.springframework.security.core.session.SessionRegistry; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; -import org.springframework.security.web.util.matcher.RequestMatcher; -import org.springframework.util.CollectionUtils; -import org.springframework.web.filter.OncePerRequestFilter; -import org.springframework.web.util.UriComponentsBuilder; - -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.List; - import static cn.topiam.employee.common.constants.AuthorizeConstants.FE_LOGIN; import static cn.topiam.employee.core.security.util.SecurityUtils.isAuthenticated; import static cn.topiam.employee.protocol.cas.idp.constant.ProtocolConstants.SERVICE; diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/endpoint/CasIdpValidateEndpointFilter.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/endpoint/CasIdpValidateEndpointFilter.java index 7e9dbc05..76e6c60d 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/endpoint/CasIdpValidateEndpointFilter.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/endpoint/CasIdpValidateEndpointFilter.java @@ -1,12 +1,33 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.endpoint; -import cn.topiam.employee.application.ApplicationServiceLoader; -import cn.topiam.employee.common.constants.ProtocolConstants; -import cn.topiam.employee.core.security.userdetails.UserDetails; -import cn.topiam.employee.protocol.cas.idp.auth.CentralAuthenticationService; -import cn.topiam.employee.protocol.cas.idp.tickets.ServiceTicket; -import cn.topiam.employee.protocol.cas.idp.xml.ResponseGenerator; -import cn.topiam.employee.protocol.cas.idp.xml.ResponseGeneratorImpl; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.xml.parsers.DocumentBuilder; + import org.springframework.boot.web.servlet.filter.OrderedFilter; import org.springframework.core.Ordered; import org.springframework.http.HttpMethod; @@ -16,16 +37,13 @@ import org.springframework.security.web.util.matcher.OrRequestMatcher; import org.springframework.security.web.util.matcher.RequestMatcher; import org.springframework.web.filter.OncePerRequestFilter; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.xml.parsers.DocumentBuilder; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - +import cn.topiam.employee.application.ApplicationServiceLoader; +import cn.topiam.employee.common.constants.ProtocolConstants; +import cn.topiam.employee.core.security.userdetails.UserDetails; +import cn.topiam.employee.protocol.cas.idp.auth.CentralAuthenticationService; +import cn.topiam.employee.protocol.cas.idp.tickets.ServiceTicket; +import cn.topiam.employee.protocol.cas.idp.xml.ResponseGenerator; +import cn.topiam.employee.protocol.cas.idp.xml.ResponseGeneratorImpl; import static cn.topiam.employee.protocol.cas.idp.constant.ProtocolConstants.SERVICE; import static cn.topiam.employee.protocol.cas.idp.constant.ProtocolConstants.TICKET; diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/filter/CasAuthorizationServerContextFilter.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/filter/CasAuthorizationServerContextFilter.java index 3050b1cd..87d2c60b 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/filter/CasAuthorizationServerContextFilter.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/filter/CasAuthorizationServerContextFilter.java @@ -1,25 +1,43 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.filter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; +import org.springframework.security.web.util.matcher.RequestMatcher; +import org.springframework.util.Assert; +import org.springframework.web.filter.OncePerRequestFilter; + import cn.topiam.employee.application.context.ApplicationContext; import cn.topiam.employee.application.context.ApplicationContextHolder; import cn.topiam.employee.application.exception.AppNotExistException; import cn.topiam.employee.common.constants.ProtocolConstants; import cn.topiam.employee.common.entity.app.po.AppCasConfigPO; import cn.topiam.employee.common.repository.app.AppCasConfigRepository; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; -import org.springframework.security.web.util.matcher.RequestMatcher; -import org.springframework.util.Assert; -import org.springframework.web.filter.OncePerRequestFilter; - -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - import static cn.topiam.employee.common.constants.ProtocolConstants.APP_CODE; /** diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultServiceTicketFactory.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultServiceTicketFactory.java index bee254b9..6256b460 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultServiceTicketFactory.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultServiceTicketFactory.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; /** diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketFactory.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketFactory.java index 9bb45613..51462694 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketFactory.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketFactory.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; import java.util.HashMap; diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketGrantingTicketFactory.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketGrantingTicketFactory.java index 371d0135..8e73ee56 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketGrantingTicketFactory.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketGrantingTicketFactory.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; import cn.topiam.employee.core.security.userdetails.UserDetails; diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketRegistry.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketRegistry.java index ffdaa29f..1a7ff377 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketRegistry.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/DefaultTicketRegistry.java @@ -1,10 +1,30 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; -import cn.topiam.employee.protocol.cas.idp.auth.CentralCacheService; -import com.google.common.base.Preconditions; -import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import com.google.common.base.Preconditions; + +import cn.topiam.employee.protocol.cas.idp.auth.CentralCacheService; + +import lombok.extern.slf4j.Slf4j; + /** * @author TopIAM * Created by support@topiam.cn on 2022/12/29 16:25 diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicket.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicket.java index 50f4cf79..a0420ef6 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicket.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicket.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; /** diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicketFactory.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicketFactory.java index be605183..9a542fea 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicketFactory.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicketFactory.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; /** diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicketImpl.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicketImpl.java index 404ccb93..6907508a 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicketImpl.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/ServiceTicketImpl.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; /** diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/Ticket.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/Ticket.java index 37e2c097..c8f6fff1 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/Ticket.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/Ticket.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; import java.io.Serializable; diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketFactory.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketFactory.java index 39acc9da..6804eb7c 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketFactory.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketFactory.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; /** diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicket.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicket.java index 87bc6755..a796e2f2 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicket.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicket.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; import cn.topiam.employee.core.security.userdetails.UserDetails; diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicketFactory.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicketFactory.java index 48efd46c..85829192 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicketFactory.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicketFactory.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; import cn.topiam.employee.core.security.userdetails.UserDetails; diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicketImpl.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicketImpl.java index 7028624b..c22ac50b 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicketImpl.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketGrantingTicketImpl.java @@ -1,10 +1,26 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; -import cn.topiam.employee.core.security.userdetails.UserDetails; -import cn.topiam.employee.protocol.cas.idp.util.TicketUtils; - import java.util.Objects; +import cn.topiam.employee.core.security.userdetails.UserDetails; +import cn.topiam.employee.protocol.cas.idp.util.TicketUtils; import static cn.topiam.employee.protocol.cas.idp.constant.ProtocolConstants.PREFIX_ST; /** diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketRegistry.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketRegistry.java index 116be82b..a5354f97 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketRegistry.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/tickets/TicketRegistry.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.tickets; /** diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/util/CasUtils.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/util/CasUtils.java index aa9d1fbf..c80dee92 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/util/CasUtils.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/util/CasUtils.java @@ -17,14 +17,15 @@ */ package cn.topiam.employee.protocol.cas.idp.util; -import cn.topiam.employee.application.ApplicationServiceLoader; -import cn.topiam.employee.common.repository.app.AppCasConfigRepository; -import cn.topiam.employee.protocol.cas.idp.auth.CentralAuthenticationService; +import javax.xml.parsers.DocumentBuilder; + import org.springframework.context.ApplicationContext; import org.springframework.security.config.annotation.web.HttpSecurityBuilder; import org.springframework.security.core.session.SessionRegistry; -import javax.xml.parsers.DocumentBuilder; +import cn.topiam.employee.application.ApplicationServiceLoader; +import cn.topiam.employee.common.repository.app.AppCasConfigRepository; +import cn.topiam.employee.protocol.cas.idp.auth.CentralAuthenticationService; /** * @author TopIAM diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/util/TicketUtils.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/util/TicketUtils.java index 6e7f9cf7..050573b9 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/util/TicketUtils.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/util/TicketUtils.java @@ -1,12 +1,29 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.util; -import org.apache.commons.lang3.StringUtils; - import java.net.InetAddress; import java.security.SecureRandom; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.IntStream; +import org.apache.commons.lang3.StringUtils; + /** * @author TopIAM * Created by support@topiam.cn on 2022/12/29 16:25 diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/xml/ResponseGenerator.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/xml/ResponseGenerator.java index 138ea146..8eec779a 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/xml/ResponseGenerator.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/xml/ResponseGenerator.java @@ -1,3 +1,20 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.xml; import java.io.IOException; diff --git a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/xml/ResponseGeneratorImpl.java b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/xml/ResponseGeneratorImpl.java index 2d5ef098..5ee574cf 100644 --- a/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/xml/ResponseGeneratorImpl.java +++ b/eiam-protocol/eiam-protocol-cas/src/main/java/cn/topiam/employee/protocol/cas/idp/xml/ResponseGeneratorImpl.java @@ -1,10 +1,28 @@ +/* + * eiam-protocol-cas - Employee Identity and Access Management Program + * Copyright © 2020-2022 TopIAM (support@topiam.cn) + * + * This program 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. + * + * This program 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 this program. If not, see . + */ package cn.topiam.employee.protocol.cas.idp.xml; -import org.dom4j.io.OutputFormat; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletResponse; import javax.xml.parsers.DocumentBuilder; @@ -14,13 +32,12 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.Map; +import org.dom4j.io.OutputFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; import static cn.topiam.employee.protocol.cas.idp.constant.ProtocolConstants.*; /**