FileDocCategorySizeDatePackage
FileLoginModule.javaAPI DocGlassfish v2 API4012Fri May 04 22:35:26 BST 2007com.sun.enterprise.security.auth.login

FileLoginModule

public class FileLoginModule extends PasswordLoginModule
File realm login module.

Provides a file-based implementation of a password login module. Processing is delegated to the FileRealm class.

see
com.sun.enterprise.security.auth.login.PasswordLoginModule
see
com.sun.enterprise.security.auth.realm.file.FileRealm

Fields Summary
Constructors Summary
Methods Summary
protected voidauthenticate()
Perform file authentication. Delegates to FileRealm.

throws
LoginException If login fails (JAAS login() behavior).

        if (!(_currentRealm instanceof FileRealm)) {
            String msg = sm.getString("filelm.badrealm");
            throw new LoginException(msg);
        }
        FileRealm fileRealm = (FileRealm)_currentRealm;

        String[] grpList = fileRealm.authenticate(_username, _password);

        if (grpList == null) {  // JAAS behavior
            String msg = sm.getString("filelm.faillogin", _username);
            throw new LoginException(msg);
        }

        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "File login succeeded for: " + _username);
        }
        //make a copy of groupList to pass to LoginModule. This copy is the one
        // that will be made null there. DO NOT PASS the grpList as is - as 
        // it will get overwritten. Resulting in logins passing only once.
        String[] groupListToForward = new String[grpList.length];
        for (int i = 0; i< grpList.length; i++){
            groupListToForward[i] = grpList[i];
        }
        commitAuthentication(_username, _password,
                             _currentRealm, groupListToForward);