franta-hg@113: /* franta-hg@113: * SONEWS News Server franta-hg@113: * see AUTHORS for the list of contributors franta-hg@113: * franta-hg@113: * This program is free software: you can redistribute it and/or modify franta-hg@113: * it under the terms of the GNU General Public License as published by franta-hg@113: * the Free Software Foundation, either version 3 of the License, or franta-hg@113: * (at your option) any later version. franta-hg@113: * franta-hg@113: * This program is distributed in the hope that it will be useful, franta-hg@113: * but WITHOUT ANY WARRANTY; without even the implied warranty of franta-hg@113: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the franta-hg@113: * GNU General Public License for more details. franta-hg@113: * franta-hg@113: * You should have received a copy of the GNU General Public License franta-hg@113: * along with this program. If not, see . franta-hg@113: */ franta-hg@113: package org.sonews.acl; franta-hg@113: franta-hg@113: /** franta-hg@113: * Represents users (clients) accessing our service through NNTP protocol. franta-hg@113: * franta-hg@113: * This class can be extended by your plugin franta-hg@113: * to describe additional information, that was gained during login process. franta-hg@113: * franta-hg@113: * When User object is created, default authentication status is false. franta-hg@113: * franta-hg@113: * @author František Kučera (frantovo.cz) franta-hg@113: */ franta-hg@113: public class User { franta-hg@113: franta-hg@113: private String userName; franta-hg@113: private boolean authenticated = false; franta-hg@113: franta-hg@113: public String getUserName() { franta-hg@113: return userName; franta-hg@113: } franta-hg@113: franta-hg@113: public void setUserName(String userName) { franta-hg@113: this.userName = userName; franta-hg@113: } franta-hg@113: franta-hg@113: /** franta-hg@113: * In some configurations users don't have to use their password – franta-hg@113: * they can just tell us their name and we will trust them – franta-hg@113: * in this case User object will exist end user name will be filled, but this method will return false. franta-hg@113: * franta-hg@113: * @return true if user was succesfully authenticated (has provided correct password). franta-hg@113: */ franta-hg@113: public boolean isAuthenticated() { franta-hg@113: return authenticated; franta-hg@113: } franta-hg@113: franta-hg@113: /** franta-hg@113: * This method is to be called from AUTHINFO PASS Command implementation. franta-hg@113: * franta-hg@113: * @param authenticated true if user has provided right password in AUTHINFO PASS password. franta-hg@113: * @see #isAuthenticated() franta-hg@113: */ franta-hg@113: public void setAuthenticated(boolean authenticated) { franta-hg@113: this.authenticated = authenticated; franta-hg@113: } franta-hg@113: franta-hg@113: public User() { franta-hg@113: } franta-hg@113: franta-hg@113: public User(String userName) { franta-hg@113: this.userName = userName; franta-hg@113: } franta-hg@113: franta-hg@113: public User(String userName, boolean authenticated) { franta-hg@113: this.userName = userName; franta-hg@113: this.authenticated = authenticated; franta-hg@113: } franta-hg@113: }