KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > security > AccountLockedException


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
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
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.security;
21
22
23
24 /**
25  * This exception is thrown by the {@link LogonController} when an
26  * authentication attempt fails becuase the account has been locked. The lock
27  * may either be temporary (for a number of seconds defined by the
28  * administrator) or disabled in which case the lock is stored in the user
29  * database. If a temporary lock, the amount of time left in milliseconds before
30  * the lock expires is also supplied.
31  *
32  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
33  */

34 public class AccountLockedException extends Exception JavaDoc {
35
36     private boolean disabled;
37     private long timeLeft;
38     private String JavaDoc username;
39
40     /**
41      * Constructor.
42      *
43      * @param username
44      * @param msg
45      * @param disabled
46      * @param timeLeft
47      */

48     public AccountLockedException(String JavaDoc username, String JavaDoc msg, boolean disabled, long timeLeft) {
49         super(msg);
50         this.username = username;
51         this.disabled = disabled;
52         this.timeLeft = timeLeft;
53     }
54
55     /**
56      * Get if this exception should disable the account.
57      *
58      * @return disable account
59      */

60     public boolean isDisabled() {
61         return disabled;
62     }
63
64     /**
65      * Get the number of milliseconds before this lock
66      * expires.
67      *
68      * @return lock expiry time in milliseconds
69      */

70     public long getTimeLeft() {
71         return timeLeft;
72     }
73     
74     /**
75      * Get the username that is locked.
76      *
77      * @return username
78      */

79     public String JavaDoc getUsername() {
80         return username;
81     }
82
83 }
Popular Tags