branch develop updated (6e4fc920 -> ccfcc5e7)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from 6e4fc920 Optimisation de la sécurité et des durées de certains traitements (ref #163) new ccfcc5e7 Maj des dépendances et supression du code inutile (ref #163) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit ccfcc5e7dd23f56edf4db4053d9d411783784db9 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Nov 9 16:13:51 2017 +0100 Maj des dépendances et supression du code inutile (ref #163) Summary of changes: pollen-rest-api/pom.xml | 15 ++++ .../rest/api/PollenRestApiApplicationContext.java | 21 ----- pollen-services/pom.xml | 4 +- .../pollen/services/service/PollenUserService.java | 2 +- .../security/DefaultPollenSecurityContext.java | 24 ------ .../service/security/PollenSecurityContext.java | 5 -- .../service/security/PollenSecurityRealm.java | 95 ---------------------- .../test/FakePollenApplicationContext.java | 10 --- .../services/service/VoteCountingServiceTest.java | 2 - pollen-votecounting-api/pom.xml | 4 - pollen-votecounting-borda/pom.xml | 5 ++ pom.xml | 6 +- 12 files changed, 26 insertions(+), 167 deletions(-) delete mode 100644 pollen-services/src/main/java/org/chorem/pollen/services/service/security/PollenSecurityRealm.java -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit ccfcc5e7dd23f56edf4db4053d9d411783784db9 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Nov 9 16:13:51 2017 +0100 Maj des dépendances et supression du code inutile (ref #163) --- pollen-rest-api/pom.xml | 15 ++++ .../rest/api/PollenRestApiApplicationContext.java | 21 ----- pollen-services/pom.xml | 4 +- .../pollen/services/service/PollenUserService.java | 2 +- .../security/DefaultPollenSecurityContext.java | 24 ------ .../service/security/PollenSecurityContext.java | 5 -- .../service/security/PollenSecurityRealm.java | 95 ---------------------- .../test/FakePollenApplicationContext.java | 10 --- .../services/service/VoteCountingServiceTest.java | 2 - pollen-votecounting-api/pom.xml | 4 - pollen-votecounting-borda/pom.xml | 5 ++ pom.xml | 6 +- 12 files changed, 26 insertions(+), 167 deletions(-) diff --git a/pollen-rest-api/pom.xml b/pollen-rest-api/pom.xml index 77654f45..2527e5c7 100644 --- a/pollen-rest-api/pom.xml +++ b/pollen-rest-api/pom.xml @@ -65,6 +65,21 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>pollen-votecounting-borda</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>pollen-votecounting-cumulative</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>pollen-votecounting-majority-judgment</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>pollen-votecounting-aggregator</artifactId> <version>${project.version}</version> <type>pom</type> diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationContext.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationContext.java index 905575ff..2e497078 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationContext.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplicationContext.java @@ -26,9 +26,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.log4j.LogManager; import org.apache.log4j.PropertyConfigurator; -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.mgt.DefaultSecurityManager; -import org.apache.shiro.subject.Subject; import org.chorem.pollen.persistence.PollenPersistenceContext; import org.chorem.pollen.persistence.PollenTopiaApplicationContext; import org.chorem.pollen.persistence.PollenTopiaPersistenceContext; @@ -43,7 +40,6 @@ import org.chorem.pollen.services.service.InvalidFormException; import org.chorem.pollen.services.service.PollenUserService; import org.chorem.pollen.services.service.security.DefaultPollenSecurityContext; import org.chorem.pollen.services.service.security.PollenSecurityContext; -import org.chorem.pollen.services.service.security.PollenSecurityRealm; import org.chorem.pollen.votecounting.VoteCountingFactory; import org.nuiton.i18n.I18n; import org.nuiton.i18n.init.DefaultI18nInitializer; @@ -264,13 +260,6 @@ public class PollenRestApiApplicationContext implements PollenApplicationContext //Can't happen } - // -- init security realm -- // - - PollenSecurityRealm realm = new PollenSecurityRealm(this); - - DefaultSecurityManager securityManager = new DefaultSecurityManager(realm); - SecurityUtils.setSecurityManager(securityManager); - started.set(true); } @@ -292,11 +281,6 @@ public class PollenRestApiApplicationContext implements PollenApplicationContext } @Override - public Subject getSubject() { - return null; - } - - @Override public PollenUser getPollenUser() { return null; } @@ -312,11 +296,6 @@ public class PollenRestApiApplicationContext implements PollenApplicationContext } @Override - public void setSubject(Subject subject) { - - } - - @Override public void setMainPrincipal(PollenPrincipal creator) { } diff --git a/pollen-services/pom.xml b/pollen-services/pom.xml index 53022cab..f4c817d4 100644 --- a/pollen-services/pom.xml +++ b/pollen-services/pom.xml @@ -116,8 +116,8 @@ </dependency> <dependency> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> + <groupId>com.sun.mail</groupId> + <artifactId>javax.mail</artifactId> </dependency> <dependency> diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java index f20bdc91..d10a1ec4 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java @@ -21,10 +21,10 @@ package org.chorem.pollen.services.service; * #L% */ +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.shiro.util.CollectionUtils; import org.chorem.pollen.persistence.entity.Comment; import org.chorem.pollen.persistence.entity.PollenPrincipal; import org.chorem.pollen.persistence.entity.PollenResource; diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/security/DefaultPollenSecurityContext.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/security/DefaultPollenSecurityContext.java index c0f76126..dd65ee72 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/security/DefaultPollenSecurityContext.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/security/DefaultPollenSecurityContext.java @@ -21,7 +21,6 @@ package org.chorem.pollen.services.service.security; * #L% */ -import org.apache.shiro.subject.Subject; import org.chorem.pollen.persistence.entity.PollenPrincipal; import org.chorem.pollen.persistence.entity.PollenUser; import org.chorem.pollen.persistence.entity.SessionToken; @@ -39,11 +38,6 @@ public class DefaultPollenSecurityContext implements Serializable, PollenSecurit private static final long serialVersionUID = 1L; /** - * Computed shiro subject. - */ - protected transient Subject subject; - - /** * Connected user account. * <p/> * Can be {@code null} if user is not connected. @@ -63,11 +57,6 @@ public class DefaultPollenSecurityContext implements Serializable, PollenSecurit } @Override - public Subject getSubject() { - return subject; - } - - @Override public SessionToken getSessionToken() { return sessionToken; } @@ -88,25 +77,12 @@ public class DefaultPollenSecurityContext implements Serializable, PollenSecurit } @Override - public void setSubject(Subject subject) { - this.subject = subject; - } - - @Override public void setSessionToken(SessionToken sessionToken) { - this.sessionToken = sessionToken; - // force to reload subject - this.subject = null; - } @Override public void setMainPrincipal(PollenPrincipal mainPrincipal) { - this.mainPrincipal = mainPrincipal; - // force to reload subject - this.subject = null; - } } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/security/PollenSecurityContext.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/security/PollenSecurityContext.java index e7739ac3..0f31a769 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/security/PollenSecurityContext.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/security/PollenSecurityContext.java @@ -21,7 +21,6 @@ package org.chorem.pollen.services.service.security; * #L% */ -import org.apache.shiro.subject.Subject; import org.chorem.pollen.persistence.entity.PollenPrincipal; import org.chorem.pollen.persistence.entity.PollenUser; import org.chorem.pollen.persistence.entity.SessionToken; @@ -45,15 +44,11 @@ public interface PollenSecurityContext { void setSessionToken(SessionToken sessionToken); - Subject getSubject(); - PollenUser getPollenUser(); boolean isConnected(); boolean isAdmin(); - void setSubject(Subject subject); - void setMainPrincipal(PollenPrincipal creator); } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/security/PollenSecurityRealm.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/security/PollenSecurityRealm.java deleted file mode 100644 index e6290db4..00000000 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/security/PollenSecurityRealm.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.chorem.pollen.services.service.security; - -/* - * #%L - * Pollen :: Service - * %% - * Copyright (C) 2009 - 2017 Code Lutin, Tony Chemit - * %% - * 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 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/>. - * #L% - */ - -import org.apache.shiro.authc.AuthenticationException; -import org.apache.shiro.authc.AuthenticationInfo; -import org.apache.shiro.authc.AuthenticationToken; -import org.apache.shiro.authc.SimpleAuthenticationInfo; -import org.apache.shiro.authc.UsernamePasswordToken; -import org.apache.shiro.authc.credential.HashedCredentialsMatcher; -import org.apache.shiro.authz.AuthorizationInfo; -import org.apache.shiro.authz.SimpleAuthorizationInfo; -import org.apache.shiro.realm.AuthorizingRealm; -import org.apache.shiro.subject.PrincipalCollection; -import org.apache.shiro.util.SimpleByteSource; -import org.chorem.pollen.persistence.PollenTopiaPersistenceContext; -import org.chorem.pollen.persistence.entity.PollenUser; -import org.chorem.pollen.services.PollenApplicationContext; - -/** - * TODO - * <p/> - * http://www.slideshare.net/chunsaker/securing-rest-apis ? - * - * @author Tony Chemit - dev@tchemit.fr - * @since 2.0 - */ -public class PollenSecurityRealm extends AuthorizingRealm { - - public static final String REALM_NAME = "pollenRealm"; - - protected final PollenApplicationContext applicationContext; - - public PollenSecurityRealm(PollenApplicationContext applicationContext) { - - this.applicationContext = applicationContext; - - String hashAlgorithmName = applicationContext.getApplicationConfig().getHashAlgorithmName(); - HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(hashAlgorithmName); - matcher.setStoredCredentialsHexEncoded(false); - setCredentialsMatcher(matcher); - - } - - @Override - protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { - - SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo(); - - simpleAuthorizationInfo.setStringPermissions(principals.asSet()); - - return simpleAuthorizationInfo; - } - - @Override - protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { - - UsernamePasswordToken upToken = (UsernamePasswordToken) token; - String username = upToken.getUsername(); - - try (PollenTopiaPersistenceContext persistenceContext = applicationContext.newPersistenceContext()) { - - PollenUser pollenUser = - persistenceContext.getPollenUserDao().findUserWithEmailAddressOrNull(username); - - if (pollenUser == null) { - throw new AuthenticationException(); - } - - String salt = pollenUser.getSalt(); - - return new SimpleAuthenticationInfo(username, pollenUser.getPassword(), new SimpleByteSource(salt), getName()); - - } - } -} diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/test/FakePollenApplicationContext.java b/pollen-services/src/main/java/org/chorem/pollen/services/test/FakePollenApplicationContext.java index 11f6ea32..82467705 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/test/FakePollenApplicationContext.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/test/FakePollenApplicationContext.java @@ -27,8 +27,6 @@ import com.google.common.base.StandardSystemProperty; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.mgt.DefaultSecurityManager; import org.chorem.pollen.persistence.PollenPersistenceContext; import org.chorem.pollen.persistence.PollenTopiaApplicationContext; import org.chorem.pollen.persistence.PollenTopiaPersistenceContext; @@ -40,7 +38,6 @@ import org.chorem.pollen.services.PollenServiceContext; import org.chorem.pollen.services.config.PollenServicesConfig; import org.chorem.pollen.services.config.PollenServicesConfigOption; import org.chorem.pollen.services.service.FixturesService; -import org.chorem.pollen.services.service.security.PollenSecurityRealm; import org.chorem.pollen.votecounting.VoteCountingFactory; import org.junit.rules.TestWatcher; import org.junit.runner.Description; @@ -151,13 +148,6 @@ public class FakePollenApplicationContext extends TestWatcher implements PollenA BeanTopiaConfiguration topiaConfiguration = new TopiaConfigurationBuilder().readMap(topiaProperties); applicationContext = new PollenTopiaApplicationContext(topiaConfiguration); - // --- create security context --- // - - PollenSecurityRealm realm = new PollenSecurityRealm(this); - - DefaultSecurityManager securityManager = new DefaultSecurityManager(realm); - SecurityUtils.setSecurityManager(securityManager); - } @Override diff --git a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java index 234b059d..edea8606 100644 --- a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java +++ b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoteCountingServiceTest.java @@ -99,8 +99,6 @@ public class VoteCountingServiceTest extends AbstractPollenServiceTest { String pollId = createdPollRef.getEntityId(); - pollService.getSecurityContext().setSubject(null); - List<ChoiceBean> createdChoices = choiceService.getChoices(pollId); ChoiceBean createdChoiceBean1 = createdChoices.get(0); ChoiceBean createdChoiceBean2 = createdChoices.get(1); diff --git a/pollen-votecounting-api/pom.xml b/pollen-votecounting-api/pom.xml index 61491300..c6b796ae 100644 --- a/pollen-votecounting-api/pom.xml +++ b/pollen-votecounting-api/pom.xml @@ -63,10 +63,6 @@ <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - </dependency> </dependencies> diff --git a/pollen-votecounting-borda/pom.xml b/pollen-votecounting-borda/pom.xml index 5863d619..f8e6138f 100644 --- a/pollen-votecounting-borda/pom.xml +++ b/pollen-votecounting-borda/pom.xml @@ -60,6 +60,11 @@ </dependency> <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-collections4</artifactId> + </dependency> + + <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <scope>test</scope> diff --git a/pom.xml b/pom.xml index fe675af0..b2d1a4e8 100644 --- a/pom.xml +++ b/pom.xml @@ -286,9 +286,9 @@ </dependency> <dependency> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - <version>1.4.7</version> + <groupId>com.sun.mail</groupId> + <artifactId>javax.mail</artifactId> + <version>1.5.2</version> </dependency> <!-- Guava --> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm