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
|
package YalpServer;
import java.util.ArrayList;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import YalpInterfaces.*;
public class AuthPluginHandler {
private ArrayList<AuthPlugin> plugins;
private static int auth_ids = 0;
private String log4jFile = "log4j_server.conf";
private static Logger logger =
Logger.getLogger("Yalp.Server.AuthPluginHandler");
public AuthPluginHandler() {
PropertyConfigurator.configureAndWatch(log4jFile);
logger.debug("AuthPluginHandler()");
plugins = new ArrayList<AuthPlugin>();
}
public PluginInfo addPlugin(AuthPlugin plugin)
{
logger.debug("addPlugin("+plugin.info.name+")");
plugin.info.id = auth_ids++;
plugins.add(plugin);
return plugin.info;
}
Session logon( String userName,
String password,
String ipAddress,
SessionHolder session,
YalpErrorHolder err )
{
YalpUserHolder user = new YalpUserHolder();
PluginInfo[] p = {};
for (AuthPlugin plugin : plugins)
{
plugin.itf.userVerify(userName, password, err, user);
if (err.value.code == YalpErrorCode.OK)
{
session.value = new Session (auth_ids++, user.value, ipAddress, p);
return session.value;
}
}
/* user not accepted return dummy objects (null causes segfault in corba) */
YalpUser no_user = new YalpUser(-1, "", "", AccessRights.DENY);
Session s = new Session (-1, no_user, "0.0.0.0", p);
return s;
}
}
|