Package org.knopflerfish.service.um.useradmin

Examples of org.knopflerfish.service.um.useradmin.ContextualAuthorization


                    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);
                        }
View Full Code Here


                        .getService(sr);
                if (pa != null) {
                    PasswdSession ps = pa.createSession();
                    ps.setUsername(userName);
                    ps.setPassword(password);
                    ContextualAuthorization ca = null;
                    try {
                        ca = ps.getAuthorization();
                    } catch (IllegalStateException ex) {
                        log(LogService.LOG_WARNING,
                                "UserAdmin service not available.");
                    }
                    if (ca != null) {
                        if (requiredGroup != null && !ca.hasRole(requiredGroup)) {
                            loginOK = false;
                            log(
                                    LogService.LOG_INFO,
                                    userName
                                            + " tried to login, but did not have required role "
                                            + requiredGroup);
                        } else if (forbiddenGroup != null
                                && ca.hasRole(forbiddenGroup)) {
                            loginOK = false;
                            log(
                                    LogService.LOG_INFO,
                                    userName
                                            + " tried to login, but had forbidden role "
View Full Code Here

TOP

Related Classes of org.knopflerfish.service.um.useradmin.ContextualAuthorization

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.