Repository: syncope Updated Branches: refs/heads/2_1_X cd6a56bb5 -> e0d440dc2 refs/heads/master 6fc42652b -> 535e958a2
Use only java.util.Base64 Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/e0d440dc Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/e0d440dc Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/e0d440dc Branch: refs/heads/2_1_X Commit: e0d440dc2779b867b1c6be22bb01d6089d09c1fb Parents: cd6a56b Author: Francesco Chicchiriccò <[email protected]> Authored: Mon Jul 16 11:57:04 2018 +0200 Committer: Francesco Chicchiriccò <[email protected]> Committed: Mon Jul 16 11:57:04 2018 +0200 ---------------------------------------------------------------------- .../core/provisioning/java/MappingManagerImpl.java | 4 ++-- .../core/provisioning/java/utils/ConnObjectUtils.java | 4 ++-- .../security/jws/AccessTokenJwsSignatureProvider.java | 4 ++-- .../security/jws/AccessTokenJwsSignatureVerifier.java | 4 ++-- .../apache/syncope/core/logic/scim/SCIMConfManager.java | 10 ++++++---- 5 files changed, 14 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/e0d440dc/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java ---------------------------------------------------------------------- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java index bc3706b..5f3fcc1 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java @@ -20,6 +20,7 @@ package org.apache.syncope.core.provisioning.java; import java.text.ParseException; import java.util.ArrayList; +import java.util.Base64; import java.util.Collections; import java.util.Date; import java.util.HashSet; @@ -98,7 +99,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.apache.syncope.core.provisioning.api.data.ItemTransformer; -import org.identityconnectors.common.Base64; import org.identityconnectors.framework.common.objects.Name; @Component @@ -784,7 +784,7 @@ public class MappingManagerImpl implements MappingManager { AttrSchemaType schemaType = schema == null ? AttrSchemaType.String : schema.getType(); if (value != null) { if (schemaType == AttrSchemaType.Binary) { - attrTO.getValues().add(Base64.encode((byte[]) value)); + attrTO.getValues().add(Base64.getEncoder().encodeToString((byte[]) value)); } else { attrTO.getValues().add(value.toString()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/e0d440dc/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java ---------------------------------------------------------------------- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java index 5abc34f..26b1156 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java @@ -19,6 +19,7 @@ package org.apache.syncope.core.provisioning.java.utils; import java.util.ArrayList; +import java.util.Base64; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -47,7 +48,6 @@ import org.apache.syncope.core.persistence.api.entity.resource.Provision; import org.apache.syncope.core.persistence.api.entity.task.PullTask; import org.apache.syncope.core.provisioning.api.MappingManager; import org.apache.syncope.core.provisioning.api.utils.policy.InvalidPasswordRuleConf; -import org.identityconnectors.common.Base64; import org.identityconnectors.common.security.GuardedByteArray; import org.identityconnectors.common.security.GuardedString; import org.identityconnectors.common.security.SecurityUtil; @@ -134,7 +134,7 @@ public class ConnObjectUtils { if (value instanceof GuardedString || value instanceof GuardedByteArray) { attrTO.getValues().add(getPassword(value)); } else if (value instanceof byte[]) { - attrTO.getValues().add(Base64.encode((byte[]) value)); + attrTO.getValues().add(Base64.getEncoder().encodeToString((byte[]) value)); } else if (value != null) { attrTO.getValues().add(value.toString()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/e0d440dc/core/spring/src/main/java/org/apache/syncope/core/spring/security/jws/AccessTokenJwsSignatureProvider.java ---------------------------------------------------------------------- diff --git a/core/spring/src/main/java/org/apache/syncope/core/spring/security/jws/AccessTokenJwsSignatureProvider.java b/core/spring/src/main/java/org/apache/syncope/core/spring/security/jws/AccessTokenJwsSignatureProvider.java index 383cf89..8bdedf9 100644 --- a/core/spring/src/main/java/org/apache/syncope/core/spring/security/jws/AccessTokenJwsSignatureProvider.java +++ b/core/spring/src/main/java/org/apache/syncope/core/spring/security/jws/AccessTokenJwsSignatureProvider.java @@ -20,6 +20,7 @@ package org.apache.syncope.core.spring.security.jws; import java.security.KeyFactory; import java.security.spec.PKCS8EncodedKeySpec; +import java.util.Base64; import org.apache.commons.lang3.StringUtils; import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm; import org.apache.cxf.rs.security.jose.jws.HmacJwsSignatureProvider; @@ -28,7 +29,6 @@ import org.apache.cxf.rs.security.jose.jws.JwsSignature; import org.apache.cxf.rs.security.jose.jws.JwsSignatureProvider; import org.apache.cxf.rs.security.jose.jws.PrivateKeyJwsSignatureProvider; import org.springframework.beans.factory.InitializingBean; -import org.springframework.security.crypto.codec.Base64; public class AccessTokenJwsSignatureProvider implements JwsSignatureProvider, InitializingBean { @@ -63,7 +63,7 @@ public class AccessTokenJwsSignatureProvider implements JwsSignatureProvider, In KeyFactory kf = KeyFactory.getInstance("RSA"); PKCS8EncodedKeySpec keySpecPKCS8 = new PKCS8EncodedKeySpec( - Base64.decode(StringUtils.substringBefore(jwsKey, ":").getBytes())); + Base64.getDecoder().decode(StringUtils.substringBefore(jwsKey, ":").getBytes())); delegate = new PrivateKeyJwsSignatureProvider(kf.generatePrivate(keySpecPKCS8), jwsAlgorithm); } else { if (jwsKey == null) { http://git-wip-us.apache.org/repos/asf/syncope/blob/e0d440dc/core/spring/src/main/java/org/apache/syncope/core/spring/security/jws/AccessTokenJwsSignatureVerifier.java ---------------------------------------------------------------------- diff --git a/core/spring/src/main/java/org/apache/syncope/core/spring/security/jws/AccessTokenJwsSignatureVerifier.java b/core/spring/src/main/java/org/apache/syncope/core/spring/security/jws/AccessTokenJwsSignatureVerifier.java index fe8db3e..0a6f6b9 100644 --- a/core/spring/src/main/java/org/apache/syncope/core/spring/security/jws/AccessTokenJwsSignatureVerifier.java +++ b/core/spring/src/main/java/org/apache/syncope/core/spring/security/jws/AccessTokenJwsSignatureVerifier.java @@ -20,6 +20,7 @@ package org.apache.syncope.core.spring.security.jws; import java.security.KeyFactory; import java.security.spec.X509EncodedKeySpec; +import java.util.Base64; import org.apache.commons.lang3.StringUtils; import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm; import org.apache.cxf.rs.security.jose.jws.HmacJwsSignatureVerifier; @@ -28,7 +29,6 @@ import org.apache.cxf.rs.security.jose.jws.JwsSignatureVerifier; import org.apache.cxf.rs.security.jose.jws.JwsVerificationSignature; import org.apache.cxf.rs.security.jose.jws.PublicKeyJwsSignatureVerifier; import org.springframework.beans.factory.InitializingBean; -import org.springframework.security.crypto.codec.Base64; public class AccessTokenJwsSignatureVerifier implements JwsSignatureVerifier, InitializingBean { @@ -63,7 +63,7 @@ public class AccessTokenJwsSignatureVerifier implements JwsSignatureVerifier, In KeyFactory kf = KeyFactory.getInstance("RSA"); X509EncodedKeySpec keySpecX509 = new X509EncodedKeySpec( - Base64.decode(StringUtils.substringAfter(jwsKey, ":").getBytes())); + Base64.getDecoder().decode(StringUtils.substringAfter(jwsKey, ":").getBytes())); delegate = new PublicKeyJwsSignatureVerifier(kf.generatePublic(keySpecX509), jwsAlgorithm); } else { if (jwsKey == null) { http://git-wip-us.apache.org/repos/asf/syncope/blob/e0d440dc/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/scim/SCIMConfManager.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/scim/SCIMConfManager.java b/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/scim/SCIMConfManager.java index 2804d78..02ba142 100644 --- a/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/scim/SCIMConfManager.java +++ b/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/scim/SCIMConfManager.java @@ -18,6 +18,7 @@ */ package org.apache.syncope.core.logic.scim; +import java.util.Base64; import java.util.Date; import javax.ws.rs.core.MediaType; import org.apache.syncope.common.lib.scim.SCIMConf; @@ -31,7 +32,6 @@ import org.apache.syncope.core.logic.ConfigurationLogic; import org.apache.syncope.core.logic.SchemaLogic; import org.apache.syncope.core.persistence.api.dao.NotFoundException; import org.apache.syncope.core.provisioning.api.serialization.POJOHelper; -import org.identityconnectors.common.Base64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -61,7 +61,8 @@ public class SCIMConfManager { SCIMConf conf = null; if (confTO != null) { try { - conf = POJOHelper.deserialize(new String(Base64.decode(confTO.getValues().get(0))), SCIMConf.class); + conf = POJOHelper.deserialize( + new String(Base64.getDecoder().decode(confTO.getValues().get(0))), SCIMConf.class); } catch (Exception e) { LOG.error("Could not deserialize, reverting to default", e); } @@ -89,7 +90,8 @@ public class SCIMConfManager { conf.getGeneralConf().setLastChangeDate(new Date()); configurationLogic.set(new AttrTO.Builder(). - schema(SCIMConf.KEY).value(Base64.encode(POJOHelper.serialize(conf).getBytes())).build()); + schema(SCIMConf.KEY). + value(Base64.getEncoder().encodeToString(POJOHelper.serialize(conf).getBytes())). + build()); } - }
