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