1 23 24 package com.sun.enterprise.security.auth.login; 25 26 import java.util.*; 27 import java.util.logging.Level ; 28 import javax.security.auth.*; 29 import javax.security.auth.callback.*; 30 import javax.security.auth.login.*; 31 import javax.security.auth.spi.*; 32 import com.sun.enterprise.security.auth.realm.file.FileRealm; 33 import javax.security.auth.login.LoginException ; 34 35 45 public class FileLoginModule extends PasswordLoginModule 46 { 47 48 54 protected void authenticate() 55 throws LoginException 56 { 57 if (!(_currentRealm instanceof FileRealm)) { 58 String msg = sm.getString("filelm.badrealm"); 59 throw new LoginException (msg); 60 } 61 FileRealm fileRealm = (FileRealm)_currentRealm; 62 63 String [] grpList = fileRealm.authenticate(_username, _password); 64 65 if (grpList == null) { String msg = sm.getString("filelm.faillogin", _username); 67 throw new LoginException (msg); 68 } 69 70 if (_logger.isLoggable(Level.FINE)) { 71 _logger.log(Level.FINE, "File login succeeded for: " + _username); 72 } 73 String [] groupListToForward = new String [grpList.length]; 77 for (int i = 0; i< grpList.length; i++){ 78 groupListToForward[i] = grpList[i]; 79 } 80 commitAuthentication(_username, _password, 81 _currentRealm, groupListToForward); 82 } 83 } 84 | Popular Tags |