diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/DefaultPasswordEncoderFactories.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/DefaultPasswordEncoderFactories.java deleted file mode 100644 index f13b63973..000000000 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/DefaultPasswordEncoderFactories.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.infrastructure.core.domain; - -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.crypto.password.DelegatingPasswordEncoder; -import org.springframework.security.crypto.password.Md4PasswordEncoder; -import org.springframework.security.crypto.password.MessageDigestPasswordEncoder; -import org.springframework.security.crypto.password.NoOpPasswordEncoder; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.security.crypto.password.Pbkdf2PasswordEncoder; -import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder; - -import java.util.HashMap; -import java.util.Map; - - -public class DefaultPasswordEncoderFactories { - - @SuppressWarnings("deprecation") - public static PasswordEncoder createDelegatingPasswordEncoder() { - String encodingId = "bcrypt"; - Map encoders = new HashMap<>(); - encoders.put(encodingId, new BCryptPasswordEncoder()); - encoders.put("ldap", new org.springframework.security.crypto.password.LdapShaPasswordEncoder()); - encoders.put("MD4", new Md4PasswordEncoder()); - encoders.put("MD5", new MessageDigestPasswordEncoder("MD5")); - encoders.put("noop", NoOpPasswordEncoder.getInstance()); - encoders.put("pbkdf2", new Pbkdf2PasswordEncoder()); - encoders.put("scrypt", new SCryptPasswordEncoder()); - encoders.put("SHA-1", new MessageDigestPasswordEncoder("SHA-1")); - encoders.put("SHA-256", new MessageDigestPasswordEncoder("SHA-256")); - - DelegatingPasswordEncoder delegatingPasswordEncoder = new DelegatingPasswordEncoder(encodingId, encoders); - delegatingPasswordEncoder.setDefaultPasswordEncoderForMatches(new MessageDigestPasswordEncoder("SHA-256")); - return delegatingPasswordEncoder; - } -} diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/security/ApplicationSecurityConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/security/ApplicationSecurityConfiguration.java deleted file mode 100644 index 0129af93e..000000000 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/security/ApplicationSecurityConfiguration.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.infrastructure.core.security; - -import org.apache.fineract.infrastructure.core.domain.DefaultPasswordEncoderFactories; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.crypto.password.PasswordEncoder; - -@Configuration -public class ApplicationSecurityConfiguration extends WebSecurityConfigurerAdapter { - @Bean - public PasswordEncoder passwordEncoder() { - return DefaultPasswordEncoderFactories.createDelegatingPasswordEncoder(); - } -} diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/Office.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/Office.java index 23b6fa11f..9b547d666 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/Office.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/Office.java @@ -18,6 +18,7 @@ */ package org.apache.fineract.organisation.office.domain; +import java.io.Serializable; import java.util.Date; import java.util.LinkedHashMap; import java.util.LinkedList; @@ -45,7 +46,7 @@ import org.joda.time.LocalDate; @Entity @Table(name = "m_office", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }, name = "name_org"), @UniqueConstraint(columnNames = { "external_id" }, name = "externalid_org") }) -public class Office extends AbstractPersistableCustom { +public class Office extends AbstractPersistableCustom implements Serializable { @OneToMany(fetch = FetchType.LAZY) @JoinColumn(name = "parent_id") @@ -246,4 +247,4 @@ public class Office extends AbstractPersistableCustom { public void loadLazyCollections() { this.children.size() ; } -} \ No newline at end of file +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Permission.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Permission.java index 8d636e4b0..8d84f9203 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Permission.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Permission.java @@ -24,9 +24,11 @@ import javax.persistence.Table; import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; +import java.io.Serializable; + @Entity @Table(name = "m_permission") -public class Permission extends AbstractPersistableCustom { +public class Permission extends AbstractPersistableCustom implements Serializable { @Column(name = "grouping", nullable = false, length = 45) private String grouping; @@ -81,4 +83,4 @@ public class Permission extends AbstractPersistableCustom { return !isUpdatedValueSame; } -} \ No newline at end of file +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Role.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Role.java index bc0970e54..0a0ad78c3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Role.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Role.java @@ -18,6 +18,7 @@ */ package org.apache.fineract.useradministration.domain; +import java.io.Serializable; import java.util.Collection; import java.util.HashSet; import java.util.LinkedHashMap; @@ -39,7 +40,7 @@ import org.apache.fineract.useradministration.data.RoleData; @Entity @Table(name = "m_role", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }, name = "unq_name") }) -public class Role extends AbstractPersistableCustom { +public class Role extends AbstractPersistableCustom implements Serializable { @Column(name = "name", unique = true, nullable = false, length = 100) private String name; @@ -148,4 +149,4 @@ public class Role extends AbstractPersistableCustom { public Boolean isEnabled() { return this.disabled; } -} \ No newline at end of file +} diff --git a/fineract-provider/src/main/resources/META-INF/spring/securityContext.xml b/fineract-provider/src/main/resources/META-INF/spring/securityContext.xml index ff6b5b23b..048070059 100644 --- a/fineract-provider/src/main/resources/META-INF/spring/securityContext.xml +++ b/fineract-provider/src/main/resources/META-INF/spring/securityContext.xml @@ -63,22 +63,22 @@ - + - - + + - + @@ -114,7 +114,7 @@ - + @@ -124,7 +124,7 @@ - + - @@ -140,18 +140,16 @@ class="org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint"> - + - - + - - + @@ -168,22 +166,17 @@ - - - + + + - - - - - + - + @@ -195,12 +188,11 @@ - - + @@ -211,19 +203,19 @@ - + - + - + - - - diff --git a/fineract-provider/src/main/resources/sql/migrations/core_db/V353__migrate_passwords_to_ss_5.sql b/fineract-provider/src/main/resources/sql/migrations/core_db/V353__migrate_passwords_to_ss_5.sql index 97271036f..bfd23a567 100644 --- a/fineract-provider/src/main/resources/sql/migrations/core_db/V353__migrate_passwords_to_ss_5.sql +++ b/fineract-provider/src/main/resources/sql/migrations/core_db/V353__migrate_passwords_to_ss_5.sql @@ -17,4 +17,5 @@ -- under the License. -- -UPDATE m_appuser SET password = CONCAT('{', id, '}', password) WHERE password NOT LIKE '{%'; +UPDATE m_appuser SET password = CONCAT('{SHA-256}{', id, '}', password) WHERE password NOT LIKE '{%'; +UPDATE oauth_client_details SET client_secret = CONCAT('{SHA-256}', SHA2(client_secret, 256)) WHERE client_secret NOT LIKE '{%';