User: luke_t Date: 01/12/16 16:07:44 Modified: src/main/org/jboss/security/auth/spi UsernamePasswordLoginModule.java Log: Added javadoc formatting and removed spurious references to getUsersRoles method. Revision Changes Path 1.7 +52 -36 jbosssx/src/main/org/jboss/security/auth/spi/UsernamePasswordLoginModule.java Index: UsernamePasswordLoginModule.java =================================================================== RCS file: /cvsroot/jboss/jbosssx/src/main/org/jboss/security/auth/spi/UsernamePasswordLoginModule.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- UsernamePasswordLoginModule.java 2001/11/24 21:52:33 1.6 +++ UsernamePasswordLoginModule.java 2001/12/17 00:07:44 1.7 @@ -4,6 +4,7 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ + package org.jboss.security.auth.spi; import java.io.IOException; @@ -22,33 +23,41 @@ import org.jboss.security.auth.spi.AbstractServerLoginModule; -/** An abstract subclass of AbstractServerLoginModule that imposes a - an identity == String username, credentials == String password view on - the login process. Subclasses override the getUsersPassword() - and getUsersRoles() methods to return the expected password and roles - for the user. - - @see #getUsername() - @see #getUsersPassword() - @see #getUsersRoles() - - @author [EMAIL PROTECTED] - @version $Revision: 1.6 $ +/** + * An abstract subclass of AbstractServerLoginModule that imposes + * an identity == String username, credentials == String password view on + * the login process. + * <p> + * Subclasses override the <code>getUsersPassword()</code> + * and <code>getRoleSets()</code> methods to return the expected password and roles + * for the user. + * + * @see #getUsername() + * @see #getUsersPassword() + * @see #getRoleSets() + * + * @author [EMAIL PROTECTED] + * @version $Revision: 1.7 $ */ public abstract class UsernamePasswordLoginModule extends AbstractServerLoginModule { /** The login identity */ private Principal identity; + /** The proof of login identity */ private char[] credential; + /** the principal to use when a null username and password are seen */ private Principal unauthenticatedIdentity; - /** Override the superclass method to look for a unauthenticatedIdentity - property. This method first invokes the super version. - @param options, - @option unauthenticatedIdentity: the name of the principal to asssign - and authenticate when a null username and password are seen. + /** + * Override the superclass method to look for an <em>unauthenticatedIdentity</em> + * property. This is the name of the principal to assign and authenticate + * when a null username and password are seen. + * <p> + * This method first invokes the super version. + * + * @param options the map of paramers passed to this login module. */ public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { @@ -59,8 +68,7 @@ unauthenticatedIdentity = new SimplePrincipal(name); } - /** - */ + /** */ public boolean login() throws LoginException { // See if shared credentials exist @@ -98,14 +106,14 @@ String expectedPassword = getUsersPassword(); if( validatePassword(password, expectedPassword) == false ) { - System.out.println("Bad password for username="+username); + System.out.println("Bad password for username=" + username); throw new FailedLoginException("Password Incorrect/Password Required"); } } System.out.print("User '" + identity + "' authenticated.\n"); if( getUseFirstPass() == true ) - { // Add the username and password to the shared state map + { // Add the username and password to the shared state map sharedState.put("javax.security.auth.login.name", username); sharedState.put("javax.security.auth.login.password", credential); } @@ -116,6 +124,7 @@ { return identity; } + protected Principal getUnauthenticatedIdentity() { return unauthenticatedIdentity; @@ -125,15 +134,18 @@ { return credential; } + protected String getUsername() { return getIdentity().getName(); } - /** Called by login() to acquire the username and password strings for - authentication. This method does no validation of either. - @return String[], [0] = username, [1] = password - @exception LoginException thrown if CallbackHandler is not set or fails. + /** + * Called by login() to acquire the username and password strings for + * authentication. This method does no validation of either. + * + * @return String[], [0] = username, [1] = password + * @exception LoginException thrown if CallbackHandler is not set or fails. */ protected String[] getUsernameAndPassword() throws LoginException { @@ -175,11 +187,13 @@ return info; } - /** A hook that allows subclasses to change the validation of the input - password against the expected password. This version checks that - neither inputPassword or expectedPassword are null that that - inputPassword.equals(expectedPassword) is true; - @return true if the inputPassword is valid, false otherwise. + /** + * A hook that allows subclasses to change the validation of the input + * password against the expected password. This version checks that + * neither inputPassword or expectedPassword are null that that + * inputPassword.equals(expectedPassword) is true; + * + * @return true if the inputPassword is valid, false otherwise. */ protected boolean validatePassword(String inputPassword, String expectedPassword) { @@ -188,12 +202,14 @@ return inputPassword.equals(expectedPassword); } - /** Get the expected password for the current username available via - the getUsername() method. This is called from within the login() - method after the CallbackHandler has returned the username and - candidate password. - @return the valid password String + /** + * Get the expected password for the current username available via + * the getUsername() method. This is called from within the login() + * method after the CallbackHandler has returned the username and + * candidate password. + * + * @return the valid password String */ abstract protected String getUsersPassword() throws LoginException; - + }
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development