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

SolarisLoginModule

public class SolarisLoginModule extends PasswordLoginModule
Solaris realm login module.

Processing is delegated to the SolarisRealm class which accesses the native methods.

see
com.sun.enterprise.security.auth.login.PasswordLoginModule
see
com.sun.enterprise.security.auth.realm.solaris.SolarisRealm

Fields Summary
Constructors Summary
Methods Summary
protected voidauthenticate()
Perform solaris authentication. Delegates to SolarisRealm.

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

        if (!(_currentRealm instanceof SolarisRealm)) {
            String msg = sm.getString("solarislm.badrealm");
            throw new LoginException(msg);
        }
        
        SolarisRealm solarisRealm = (SolarisRealm)_currentRealm;

        // A solaris user must have a name not null so check here.
        if ( (_username == null) || (_username.length() == 0) ) {
            String msg = sm.getString("solarislm.nulluser");
            throw new LoginException(msg);
        }
        
        String[] grpList = solarisRealm.authenticate(_username, _password);

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

        if (_logger.isLoggable(Level.FINEST)) {
            _logger.finest("Solaris 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);