src/org/sonews/acl/User.java
author František Kučera <franta-hg@frantovo.cz>
Wed Dec 31 12:07:40 2014 +0100 (2014-12-31)
changeset 120 bb1c8a7b774c
permissions -rw-r--r--
XSLT: licence – GNU GPLv3
     1 /*
     2  *   SONEWS News Server
     3  *   see AUTHORS for the list of contributors
     4  *
     5  *   This program is free software: you can redistribute it and/or modify
     6  *   it under the terms of the GNU General Public License as published by
     7  *   the Free Software Foundation, either version 3 of the License, or
     8  *   (at your option) any later version.
     9  *
    10  *   This program is distributed in the hope that it will be useful,
    11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  *   GNU General Public License for more details.
    14  *
    15  *   You should have received a copy of the GNU General Public License
    16  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17  */
    18 package org.sonews.acl;
    19 
    20 /**
    21  * Represents users (clients) accessing our service through NNTP protocol.
    22  * 
    23  * This class can be extended by your plugin 
    24  * to describe additional information, that was gained during login process.
    25  * 
    26  * When User object is created, default authentication status is false.
    27  * 
    28  * @author František Kučera (frantovo.cz)
    29  */
    30 public class User {
    31 
    32 	private String userName;
    33 	private boolean authenticated = false;
    34 
    35 	public String getUserName() {
    36 		return userName;
    37 	}
    38 
    39 	public void setUserName(String userName) {
    40 		this.userName = userName;
    41 	}
    42 
    43 	/**
    44 	 * In some configurations users don't have to use their password – 
    45 	 * they can just tell us their name and we will trust them – 
    46 	 * in this case User object will exist end user name will be filled, but this method will return false.
    47 	 * 
    48 	 * @return true if user was succesfully authenticated (has provided correct password).
    49 	 */
    50 	public boolean isAuthenticated() {
    51 		return authenticated;
    52 	}
    53 
    54 	/**
    55 	 * This method is to be called from AUTHINFO PASS Command implementation.
    56 	 * 
    57 	 * @param authenticated true if user has provided right password in AUTHINFO PASS password.
    58 	 * @see #isAuthenticated() 
    59 	 */
    60 	public void setAuthenticated(boolean authenticated) {
    61 		this.authenticated = authenticated;
    62 	}
    63 
    64 	public User() {
    65 	}
    66 
    67 	public User(String userName) {
    68 		this.userName = userName;
    69 	}
    70 
    71 	public User(String userName, boolean authenticated) {
    72 		this.userName = userName;
    73 		this.authenticated = authenticated;
    74 	}
    75 }