Package org.apache.geronimo.security

Examples of org.apache.geronimo.security.GeronimoSecurityException


     */
    public boolean inService() throws GeronimoSecurityException {
        try {
            return policyConfiguration.inService();
        } catch (PolicyContextException e) {
            throw new GeronimoSecurityException("Unable to obtain inService state", e.getCause());
        }
    }
View Full Code Here


    public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
        debug = "true".equalsIgnoreCase((String) options.get("debug"));
        String uri = (String) options.get("uri");
        String realm = (String) options.get("realm");

        if (uri == null) throw new GeronimoSecurityException("Initialize error: uri to security service is not set");
        if (realm == null) throw new GeronimoSecurityException("Initialize error: realm name not specified");

        try {
            connectURI = new URI(uri);
            remoteLoginService = RemoteLoginServiceFactory.create(connectURI.getHost(), connectURI.getPort());

            SerializableACE[] entries = remoteLoginService.getAppConfigurationEntries(realm);
            modules = new LoginModuleConfiguration[entries.length];
            for(int i = 0; i < entries.length; i++) {
                SerializableACE entry = entries[i];

                final String finalClass = entry.getLoginModuleName();
                LoginModule wrapper;
                wrapper = (LoginModule) AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
                        return Class.forName(finalClass, true, classLoader).newInstance();
                    }
                });

                HashMap map = new HashMap(entry.getOptions());
                map.put(LOGIN_SERVICE, remoteLoginService);

                wrapper.initialize(subject, callbackHandler, sharedState, map);
                modules[i] = new LoginModuleConfiguration(wrapper, entry.getControlFlag());
            }

            if (debug) {
                System.out.print("[GeronimoLoginModule] Debug is  " + debug + " uri " + uri + " realm " + realm + "\n");
            }
        } catch (PrivilegedActionException pae) {
            Exception e = pae.getException();
            if (e instanceof InstantiationException) {
                throw (GeronimoSecurityException) new GeronimoSecurityException("Initialize error:" + e.getCause().getMessage()).initCause(e.getCause());
            } else {
                throw (GeronimoSecurityException) new GeronimoSecurityException("Initialize error: " + e.toString()).initCause(e);
            }
        } catch (URISyntaxException e) {
            throw (GeronimoSecurityException) new GeronimoSecurityException("Initialize error: " + e.toString()).initCause(e);
        }
    }
View Full Code Here

            });
            module.initialize(internalSubject, callbackHandler, sharedState, options);
        } catch (PrivilegedActionException pae) {
            Exception e = pae.getException();
            if (e instanceof InstantiationException) {
                throw (GeronimoSecurityException) new GeronimoSecurityException("Initialize error:" + e.getCause().getMessage() + "\n").initCause(e.getCause());
            } else {
                throw (GeronimoSecurityException) new GeronimoSecurityException("Initialize error: " + e.toString() + "\n").initCause(e);
            }
        }
    }
View Full Code Here

            this.groups.putAll(groups);

            log.info("SQL Realm - " + getRealmName() + " - refresh");
        } catch (SQLException sqle) {
            log.info("SQL Realm - " + getRealmName() + " - refresh failed");
            throw new GeronimoSecurityException(sqle);
        }
    }
View Full Code Here

        realmName = (String) options.get("realm");
        kernelName = (String) options.get("kernel");
        try {
            Kernel kernel = Kernel.getKernel(kernelName);

            if (kernel == null) throw new GeronimoSecurityException("No kernel found by the name of " + kernelName);

            loginService = (LoginServiceMBean) MBeanProxyFactory.getProxy(LoginServiceMBean.class, kernel.getMBeanServer(), LoginService.LOGIN_SERVICE);

            this.loginModuleId = loginService.allocateLoginModules(realmName);
        } catch (Exception e) {
            throw (GeronimoSecurityException) new GeronimoSecurityException("Initialize error: " + e.toString() + "\n").initCause(e);
        }
    }
View Full Code Here

            }

            log.info("Properties File Realm - " + getRealmName() + " - refresh");
        } catch (IOException e) {
            log.info("Properties File Realm - " + getRealmName() + " - refresh failed");
            throw new GeronimoSecurityException(e);
        }
    }
View Full Code Here

                                Class clazz = Class.forName(principal.getClass1());
                                Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
                                p = (java.security.Principal) constructor.newInstance(new Object[]{principal.getName()});
                                set.add(new RealmPrincipal(realm.getRealmName(), p));
                            } catch (InstantiationException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (IllegalAccessException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (ClassNotFoundException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (NoSuchMethodException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (InvocationTargetException e) {
                                throw new GeronimoSecurityException(e);
                            }
                        }
                        super.addRoleMapping(role.getRoleName(), set);
                    }
                }
View Full Code Here

                                Class clazz = Class.forName(principal.getClass1());
                                Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
                                p = (java.security.Principal) constructor.newInstance(new Object[]{principal.getName()});
                                set.add(new RealmPrincipal(realm.getRealmName(), p));
                            } catch (InstantiationException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (IllegalAccessException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (ClassNotFoundException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (NoSuchMethodException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (InvocationTargetException e) {
                                throw new GeronimoSecurityException(e);
                            }
                        }
                        super.addRoleMapping(role.getRoleName(), set);
                    }
                }
View Full Code Here

            });
            module.initialize(internalSubject, callbackHandler, sharedState, options);
        } catch (PrivilegedActionException pae) {
            Exception e = pae.getException();
            if (e instanceof InstantiationException) {
                throw (GeronimoSecurityException) new GeronimoSecurityException("Initialize error:" + e.getCause().getMessage() + "\n").initCause(e.getCause());
            } else {
                throw (GeronimoSecurityException) new GeronimoSecurityException("Initialize error: " + e.toString() + "\n").initCause(e);
            }
        }
    }
View Full Code Here

        try {
            factory = PolicyConfigurationFactory.getPolicyConfigurationFactory();
            policyConfiguration = factory.getPolicyConfiguration(contextId, false);
        } catch (ClassNotFoundException e) {
            throw new GeronimoSecurityException("Unable to find PolicyConfigurationFactory", e);
        } catch (PolicyContextException e) {
            throw new GeronimoSecurityException("Unable to find policy configuration with that id", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.security.GeronimoSecurityException

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.