Author: tchemit Date: 2008-02-13 21:58:03 +0000 (Wed, 13 Feb 2008) New Revision: 936 Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java Log: ne pas utiliser les password en clair dans des String, il faut utiliser des tableaux de char. de plus on transmet dans l'appel loginUser, le password deja hash?\195?\169 + formatage Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java 2008-02-13 21:57:42 UTC (rev 935) +++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java 2008-02-13 21:58:03 UTC (rev 936) @@ -17,6 +17,10 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.web.pages; +import fr.cemagref.simexplorer.is.service.AuthenticationServiceHelper; +import fr.cemagref.simexplorer.is.service.SimExplorerServiceException; +import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; +import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService; import org.apache.tapestry.annotations.ApplicationState; import org.apache.tapestry.annotations.Component; import org.apache.tapestry.annotations.InjectPage; @@ -25,13 +29,9 @@ import org.apache.tapestry.ioc.Messages; import org.apache.tapestry.ioc.annotations.Inject; -import fr.cemagref.simexplorer.is.service.SimExplorerServiceException; -import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; -import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService; +import java.util.Arrays; -/** - * The Class Login. - */ +/** The Class Login. */ public class Login { /** The user. */ @@ -65,13 +65,19 @@ /** * On success. - * + * * @return the object */ public Object onSuccessFromFormLogin() { try { - token = RemoteSecurityService.getAuthentificationService() - .loginUser(user, password); + // on hache directement le password pour ne pas le transmettre en clair + char[] chars = password.toCharArray(); + String pass = AuthenticationServiceHelper.computeHash(chars); + // reset du tableau + Arrays.fill(chars, (char) 0); + //TODO verifier que cela est ok + password = null; + token = RemoteSecurityService.getAuthentificationService().loginUser(user, pass); if (token != null && !token.equals("")) { return elementList; } @@ -85,7 +91,7 @@ /** * On success from form request account. - * + * * @return the object */ public Object onSuccessFromFormRequestAccount() { @@ -100,7 +106,7 @@ /** * Gets the user. - * + * * @return the user */ public String getUser() { @@ -109,9 +115,8 @@ /** * Sets the user. - * - * @param user - * the new user + * + * @param user the new user */ public void setUser(String user) { this.user = user; @@ -119,7 +124,7 @@ /** * Gets the password. - * + * * @return the password */ public String getPassword() { @@ -128,9 +133,8 @@ /** * Sets the password. - * - * @param password - * the new password + * + * @param password the new password */ public void setPassword(String password) { this.password = password; @@ -138,7 +142,7 @@ /** * Gets the element list. - * + * * @return the element list */ public ElementList getElementList() { @@ -147,7 +151,7 @@ /** * Gets the window title. - * + * * @return the window title */ public String getWindowTitle() { @@ -156,7 +160,7 @@ /** * Gets the login. - * + * * @return the login */ public String getLogin() { @@ -165,9 +169,8 @@ /** * Sets the login. - * - * @param login - * the new login + * + * @param login the new login */ public void setLogin(String login) { this.login = login; @@ -175,7 +178,7 @@ /** * Gets the mail. - * + * * @return the mail */ public String getMail() { @@ -184,9 +187,8 @@ /** * Sets the mail. - * - * @param mail - * the new mail + * + * @param mail the new mail */ public void setMail(String mail) { this.mail = mail;
participants (1)
-
tchemit@users.labs.libre-entreprise.org