← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1554: Removed unused code

 

------------------------------------------------------------
revno: 1554
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-03-04 19:36:11 +0100
message:
  Removed unused code
modified:
  dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/PasswordManager.java
  dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/hibernate/HibernateUserDetailsService.java
  dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/spring/AbstractSpringSecurityCurrentUserService.java
  dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/spring/SpringSecurityPasswordManager.java
  dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/vote/AllRequiredRoleVoter.java
  dhis-2/dhis-useradminandsecurity/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/AbstractAutomaticAccessProvider.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/GetCurrentUserAction.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/PasswordManager.java'
--- dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/PasswordManager.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/PasswordManager.java	2010-03-04 18:36:11 +0000
@@ -36,6 +36,4 @@
     String ID = PasswordManager.class.getName();
 
     String encodePassword( String username, String password );
-
-    boolean isPasswordValid( String username, String password );
 }

=== modified file 'dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/hibernate/HibernateUserDetailsService.java'
--- dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/hibernate/HibernateUserDetailsService.java	2010-01-28 15:23:28 +0000
+++ dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/hibernate/HibernateUserDetailsService.java	2010-03-04 18:36:11 +0000
@@ -84,6 +84,10 @@
             true, true, true, authorities );
     }
 
+    // -------------------------------------------------------------------------
+    // Supportive methods
+    // -------------------------------------------------------------------------
+
     private GrantedAuthority[] getGrantedAuthorities( UserCredentials credentials )
     {
         Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();

=== modified file 'dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/spring/AbstractSpringSecurityCurrentUserService.java'
--- dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/spring/AbstractSpringSecurityCurrentUserService.java	2010-01-28 15:23:28 +0000
+++ dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/spring/AbstractSpringSecurityCurrentUserService.java	2010-03-04 18:36:11 +0000
@@ -27,11 +27,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import  org.springframework.security.Authentication;
-import  org.springframework.security.context.SecurityContext;
-import  org.springframework.security.context.SecurityContextHolder;
-import  org.springframework.security.userdetails.UserDetails;
 import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.security.Authentication;
+import org.springframework.security.context.SecurityContextHolder;
+import org.springframework.security.userdetails.UserDetails;
 
 /**
  * @author Torgeir Lorange Ostby
@@ -42,9 +41,7 @@
 {
     public String getCurrentUsername()
     {
-        SecurityContext securityContext = SecurityContextHolder.getContext();
-
-        Authentication authentication = securityContext.getAuthentication();
+        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
 
         if ( authentication == null || !authentication.isAuthenticated() || authentication.getPrincipal() == null )
         {

=== modified file 'dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/spring/SpringSecurityPasswordManager.java'
--- dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/spring/SpringSecurityPasswordManager.java	2010-01-28 15:23:28 +0000
+++ dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/spring/SpringSecurityPasswordManager.java	2010-03-04 18:36:11 +0000
@@ -27,14 +27,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import  org.springframework.security.Authentication;
-import  org.springframework.security.AuthenticationException;
-import  org.springframework.security.AuthenticationManager;
-import  org.springframework.security.providers.UsernamePasswordAuthenticationToken;
-import  org.springframework.security.providers.encoding.PasswordEncoder;
-import  org.springframework.security.userdetails.UserDetails;
 import org.hisp.dhis.security.PasswordManager;
 import org.hisp.dhis.security.UsernameSaltSource;
+import org.springframework.security.providers.encoding.PasswordEncoder;
 
 /**
  * @author Torgeir Lorange Ostby
@@ -54,13 +49,6 @@
         this.passwordEncoder = passwordEncoder;
     }
 
-    private AuthenticationManager authenticationManager;
-
-    public void setAuthenticationManager( AuthenticationManager authenticationManager )
-    {
-        this.authenticationManager = authenticationManager;
-    }
-
     private UsernameSaltSource usernameSaltSource;
 
     public void setUsernameSaltSource( UsernameSaltSource saltSource )
@@ -76,23 +64,4 @@
     {
         return passwordEncoder.encodePassword( password, usernameSaltSource.getSalt( username ) );
     }
-
-    public final boolean isPasswordValid( String username, String password )
-    {
-        UserDetails userDetails = new  org.springframework.security.userdetails.User( username, password, true, true, true, true,
-            null );
-
-        Authentication authentication = new UsernamePasswordAuthenticationToken( userDetails, userDetails.getPassword() );
-
-        try
-        {
-            authentication = authenticationManager.authenticate( authentication );
-        }
-        catch ( AuthenticationException e )
-        {
-            return false;
-        }
-
-        return true;
-    }
 }

=== modified file 'dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/vote/AllRequiredRoleVoter.java'
--- dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/vote/AllRequiredRoleVoter.java	2010-01-28 15:23:28 +0000
+++ dhis-2/dhis-useradminandsecurity/src/main/java/org/hisp/dhis/security/vote/AllRequiredRoleVoter.java	2010-03-04 18:36:11 +0000
@@ -57,7 +57,6 @@
 
         for ( ConfigAttribute attribute : attributes )
         {
-
             if ( this.supports( attribute ) )
             {
                 ++supported;

=== modified file 'dhis-2/dhis-useradminandsecurity/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-useradminandsecurity/src/main/resources/META-INF/dhis/beans.xml	2010-01-28 15:23:28 +0000
+++ dhis-2/dhis-useradminandsecurity/src/main/resources/META-INF/dhis/beans.xml	2010-03-04 18:36:11 +0000
@@ -3,22 +3,10 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
-  
-  <!-- 
-  <bean class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
-    <property name="advice" ref="readOnlyTransactionInterceptor"/>
-    <property name="patterns">
-      <list>
-        <value>.*\.AutomaticAccessManager\.isLoginEnabled.*</value>
-      </list>
-    </property>
-  </bean>
-  -->
-  
+    
   <bean id="org.hisp.dhis.security.PasswordManager"
     class="org.hisp.dhis.security.spring.SpringSecurityPasswordManager">
 	<property name="passwordEncoder" ref="passwordEncoder"/>
-    <property name="authenticationManager" ref="authenticationManager"/>
     <property name="usernameSaltSource" ref="usernameSaltSource"/>
   </bean>
   

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/AbstractAutomaticAccessProvider.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/AbstractAutomaticAccessProvider.java	2010-01-28 15:23:28 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/AbstractAutomaticAccessProvider.java	2010-03-04 18:36:11 +0000
@@ -53,8 +53,7 @@
         this.userStore = userStore;
     }
 
-    @SuppressWarnings( "unused" )
-    private SystemAuthoritiesProvider systemAuthoritiesProvider;
+    protected SystemAuthoritiesProvider systemAuthoritiesProvider;
 
     public void setSystemAuthoritiesProvider( SystemAuthoritiesProvider systemAuthoritiesProvider )
     {

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/GetCurrentUserAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/GetCurrentUserAction.java	2010-01-22 03:15:07 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/GetCurrentUserAction.java	2010-03-04 18:36:11 +0000
@@ -41,7 +41,6 @@
 public class GetCurrentUserAction
     implements Action
 {
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -82,7 +81,6 @@
     public String execute()
         throws Exception
     {
-
         User user = currentUserService.getCurrentUser();
 
         userCredentials = userStore.getUserCredentials( user );