FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
SecurityShepherd/src/main/java/utils/UserKicker.java at dev · OWASP/SecurityShepherd · GitHub
OWASP
/
SecurityShepherd
Public
Notifications
You must be signed in to change notification settings
Fork
515
Star
1.5k
Code
Issues
137
Pull requests
21
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
SecurityShepherd
/
src
/
main
/
java
/
utils
/
UserKicker.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (54 loc) · 1.61 KB
Breadcrumbs
SecurityShepherd
/
src
/
main
/
java
/
utils
/
UserKicker.java
Copy path
File metadata and controls
60 lines (54 loc) · 1.61 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package
utils
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.
List
;
import
org
.
apache
.
logging
.
log4j
.
LogManager
;
import
org
.
apache
.
logging
.
log4j
.
Logger
;
/**
* Used to help application kick users that have been suspended
*
* @author Mark Denihan
*/
public
class
UserKicker
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
UserKicker
.
class
);
private
static
List
<
String
>
kickTheseUsers
=
new
ArrayList
<
String
>();
/**
* Add's a specific user to the kick list
*
* @param userName The user name to kick
*/
public
static
void
addUserToKickList
(
String
userName
) {
log
.
debug
(
"Adding "
+
userName
+
" to kick list"
);
kickTheseUsers
.
add
(
userName
);
}
/**
* Tells you if a user is on the kick list
*
* @param userName User to search the list for
* @return True if the user should be kicked
*/
public
static
boolean
shouldKickUser
(
String
userName
) {
if
(!
kickTheseUsers
.
isEmpty
()) {
log
.
debug
(
"Kick list Is Not Empty! Checking..."
);
boolean
kickUser
=
kickTheseUsers
.
contains
(
userName
);
if
(
kickUser
) {
log
.
debug
(
userName
+
" is in kick list"
);
}
return
kickUser
;
}
else
{
// log.debug("Empty Kick List! Skiping...");
return
false
;
}
}
/**
* Removes a user from the kick list. Should be used after user has been kicked
*
* @param userName Username of the user to remove from kick list
*/
public
static
void
removeFromKicklist
(
String
userName
) {
if
(
shouldKickUser
(
userName
))
// If User is in list
{
log
.
debug
(
"Removing "
+
userName
+
" from kick list"
);
kickTheseUsers
.
remove
(
userName
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL