telnetLogin = new TelnetLogin(false, null, userName);
} else {
PasswdSession ps = pa.createSession();
ps.setUsername(userName);
ps.setPassword(password);
ContextualAuthorization ca = null;
try {
ca = ps.getAuthorization();
} catch (IllegalStateException ex) {
log.warn("Failed to get UserAdmin service.",ex);
}
if (ca != null) {
log.info("ContextualAuthorization used.");
if (!"".equals(requiredGroup)
&& !ca.hasRole(requiredGroup)) {
telnetLogin = new TelnetLogin(false, null, userName);
log.info("User " + ca.getName()
+ " has not required group "
+ requiredGroup);
} else if (!"".equals(forbiddenGroup)
&& ca.hasRole(forbiddenGroup)) {
telnetLogin = new TelnetLogin(false, null, userName);
log.info("User " + ca.getName()
+ " is in forbidden group "
+ forbiddenGroup);
} else {
telnetLogin = new TelnetLogin(true, ca, userName);
}