mirror of https://gitee.com/topiam/eiam
身份源同步
parent
08f8e7a932
commit
ad92f6cc78
|
@ -208,7 +208,6 @@ public class IdentitySourceServiceImpl implements IdentitySourceService {
|
||||||
@Override
|
@Override
|
||||||
public Boolean saveIdentitySourceConfig(IdentitySourceConfigSaveParam param) {
|
public Boolean saveIdentitySourceConfig(IdentitySourceConfigSaveParam param) {
|
||||||
IdentitySourceEntity entity = getIdentitySource(param.getId());
|
IdentitySourceEntity entity = getIdentitySource(param.getId());
|
||||||
param.getBasicConfig().putAll(JSONObject.parseObject(entity.getBasicConfig()));
|
|
||||||
//转换
|
//转换
|
||||||
IdentitySourceEntity source = identitySourceConverter
|
IdentitySourceEntity source = identitySourceConverter
|
||||||
.saveConfigParamConverterToEntity(param, entity.getProvider());
|
.saveConfigParamConverterToEntity(param, entity.getProvider());
|
||||||
|
|
|
@ -70,6 +70,7 @@ public class IdentitySourceEventReceiveEndpoint {
|
||||||
Object event = identitySource.event(request, body);
|
Object event = identitySource.event(request, body);
|
||||||
return ResponseEntity.ok(event);
|
return ResponseEntity.ok(event);
|
||||||
}
|
}
|
||||||
|
log.error("身份源信息不存在:[{}]", code);
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,79 +0,0 @@
|
||||||
/*
|
|
||||||
* eiam-protocol-jwt - Employee Identity and Access Management
|
|
||||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package cn.topiam.employee.protocol.jwt.token;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.security.PublicKey;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import cn.topiam.employee.common.util.X509Utils;
|
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import io.jsonwebtoken.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* JWT 工具类
|
|
||||||
*
|
|
||||||
* @author TopIAM
|
|
||||||
* Created by support@topiam.cn on 2023/02/12 21:58
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
|
||||||
public class JwtUtils {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(JwtUtils.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* parserToken
|
|
||||||
*
|
|
||||||
* @param token {@link String}
|
|
||||||
* @param publicKey {@link String}
|
|
||||||
* @return {@link Claims}
|
|
||||||
*/
|
|
||||||
public static Claims parserToken(String token, String publicKey) {
|
|
||||||
try {
|
|
||||||
PublicKey readPublicKey = X509Utils.readPublicKey(publicKey, "");
|
|
||||||
JwtParser jwtParser = Jwts.parserBuilder().setSigningKey(readPublicKey).build();
|
|
||||||
// 解析 JWT
|
|
||||||
return jwtParser.parseClaimsJws(token).getBody();
|
|
||||||
} catch (io.jsonwebtoken.security.SecurityException | MalformedJwtException e) {
|
|
||||||
logger.info("Invalid JWT signature.");
|
|
||||||
logger.trace("Invalid JWT signature trace: {}", e.getMessage());
|
|
||||||
throw e;
|
|
||||||
} catch (ExpiredJwtException e) {
|
|
||||||
logger.info("Expired JWT token.");
|
|
||||||
logger.trace("Expired JWT token trace: {}", e.getMessage());
|
|
||||||
throw e;
|
|
||||||
} catch (UnsupportedJwtException e) {
|
|
||||||
logger.info("Unsupported JWT token.");
|
|
||||||
logger.trace("Unsupported JWT token trace: {}", e.getMessage());
|
|
||||||
throw e;
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
logger.info("JWT token compact of handler are invalid.");
|
|
||||||
logger.trace("JWT token compact of handler are invalid trace: {}", e.getMessage());
|
|
||||||
throw e;
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue