franta-hg@2: package cz.frantovo.jaas.sql; franta-hg@2: franta-hg@2: import com.sun.appserv.security.AppservPasswordLoginModule; franta-hg@4: import java.util.Arrays; franta-hg@4: import java.util.logging.Level; franta-hg@4: import java.util.logging.Logger; franta-hg@4: import javax.security.auth.login.LoginException; franta-hg@2: franta-hg@2: /** franta-hg@4: * Přihlašovací modul pro SQL doménu. franta-hg@2: * TODO: později bude potomkem com.sun.appserv.security.AbstractLoginModule franta-hg@2: * @author fiki franta-hg@2: */ franta-hg@2: public class SQLLoginModul extends AppservPasswordLoginModule { franta-hg@4: franta-hg@4: /** viz konfigurace v login.conf */ franta-hg@4: public static final String VÝCHOZÍ_JAAS_KONTEXT = "sqlRealm"; franta-hg@4: private static final Logger log = Logger.getLogger(SQLLoginModul.class.getName()); franta-hg@4: franta-hg@4: @Override franta-hg@4: protected void authenticateUser() throws LoginException { franta-hg@4: franta-hg@4: if (_currentRealm instanceof SQLRealm) { franta-hg@4: franta-hg@4: SQLRealm sqlRealm = (SQLRealm)_currentRealm; franta-hg@4: String skupiny[] = sqlRealm.ověřUživatele(_username, _passwd); franta-hg@4: commitUserAuthentication(skupiny); franta-hg@4: franta-hg@4: } else { franta-hg@4: throw new LoginException("Špatný realm: " + _currentRealm + " Očekávám: SQLRealm."); franta-hg@4: } franta-hg@4: } franta-hg@2: }