Package org.apache.geronimo.web.security

Examples of org.apache.geronimo.web.security.SpecSecurityBuilder$RecordingPolicyConfiguration


                }
                throw new LifecycleException(e);
            } catch (ServletException e) {
                throw new LifecycleException(e);
            }
            SpecSecurityBuilder specSecurityBuilder = new SpecSecurityBuilder(webSecurityConstraintStore.exportMergedWebAppInfo());
            Map<String, ComponentPermissions> contextIdPermissionsMap = new HashMap<String, ComponentPermissions>();
            contextIdPermissionsMap.put(getPolicyContextId(), specSecurityBuilder.buildSpecSecurityConfig());
            //Update ApplicationPolicyConfigurationManager
            if (applicationPolicyConfigurationManager != null) {
                try {
                    applicationPolicyConfigurationManager.updateApplicationPolicyConfiguration(contextIdPermissionsMap);
                } catch (LoginException e) {
                    getLogger().error("Fail to set application policy configurations", e);
                    throw new RuntimeException("Fail to set application policy configurations", e);
                } catch (PolicyContextException e) {
                    getLogger().error("Fail to set application policy configurations", e);
                    throw new RuntimeException("Fail to set application policy configurations", e);
                } catch (ClassNotFoundException e) {
                    getLogger().error("Fail to set application policy configurations", e);
                    throw new RuntimeException("Fail to set application policy configurations", e);
                } finally {
                    //Clear SpecSecurityBuilder
                    specSecurityBuilder.clear();
                }
            }

            // for OSGi Web Applications support register ServletContext in service registry
            if (WebApplicationUtils.isWebApplicationBundle(bundle)) {
View Full Code Here


                }
                throw new LifecycleException(e);
            } catch (ServletException e) {
                throw new LifecycleException(e);
            }
            SpecSecurityBuilder specSecurityBuilder = new SpecSecurityBuilder(webSecurityConstraintStore.exportMergedWebAppInfo());
            Map<String, ComponentPermissions> contextIdPermissionsMap = new HashMap<String, ComponentPermissions>();
            contextIdPermissionsMap.put(getPolicyContextId(), specSecurityBuilder.buildSpecSecurityConfig());
            //Update ApplicationPolicyConfigurationManager
            if (applicationPolicyConfigurationManager != null) {
                try {
                    applicationPolicyConfigurationManager.updateApplicationPolicyConfiguration(contextIdPermissionsMap);
                } catch (LoginException e) {
                    getLogger().error("Fail to set application policy configurations", e);
                    throw new RuntimeException("Fail to set application policy configurations", e);
                } catch (PolicyContextException e) {
                    getLogger().error("Fail to set application policy configurations", e);
                    throw new RuntimeException("Fail to set application policy configurations", e);
                } catch (ClassNotFoundException e) {
                    getLogger().error("Fail to set application policy configurations", e);
                    throw new RuntimeException("Fail to set application policy configurations", e);
                } finally {
                    //Clear SpecSecurityBuilder
                    specSecurityBuilder.clear();
                }
            }
            // for OSGi Web Applications support register ServletContext in service registry
            if (WebApplicationUtils.isWebApplicationBundle(bundle)) {
                serviceRegistration = WebApplicationUtils.registerServletContext(bundle, getServletContext());
View Full Code Here

                        throw new Exception("Could not start web app", e);
                    }
                    throw new Exception("Could not start web app for unknown reason");
                }
                if (applicationPolicyConfigurationManager != null) {
                    SpecSecurityBuilder specSecurityBuilder = new SpecSecurityBuilder(webSecurityConstraintStore.exportMergedWebAppInfo());
                    Map<String, ComponentPermissions> contextIdPermissionsMap = new HashMap<String, ComponentPermissions>();
                    contextIdPermissionsMap.put(policyContextId, specSecurityBuilder.buildSpecSecurityConfig());
                    //Update ApplicationPolicyConfigurationManager
                    try {
                        applicationPolicyConfigurationManager.updateApplicationPolicyConfiguration(contextIdPermissionsMap);
                    } catch (LoginException e) {
                        throw new RuntimeException("Fail to set application policy configurations", e);
                    } catch (PolicyContextException e) {
                        throw new RuntimeException("Fail to set application policy configurations", e);
                    } catch (ClassNotFoundException e) {
                        throw new RuntimeException("Fail to set application policy configurations", e);
                    } finally {
                        //Clear SpecSecurityBuilder
                        specSecurityBuilder.clear();
                    }
                }
                fullyStarted = true;
            } finally {
                setRestrictListeners(true);
View Full Code Here

    @Override
    public void lifecycleEvent(LifecycleEvent lifecycleEvent) {
        String lifecycleEventType = lifecycleEvent.getType();
        if (lifecycleEventType.equals(Lifecycle.BEFORE_START_EVENT)) {
            //Initialize SpecSecurityBuilder
            SpecSecurityBuilder specSecurityBuilder = new SpecSecurityBuilder(bundle, deploymentDescriptor, annotationScanRequired);
            GeronimoStandardContext standardContext = (GeronimoStandardContext) lifecycleEvent.getSource();
            GeronimoApplicationContext applicationContext = (GeronimoApplicationContext) standardContext.getInternalServletContext();
            applicationContext.setSpecSecurityBuilder(specSecurityBuilder);
        } else if (lifecycleEventType.equals(Lifecycle.START_EVENT)) {
            GeronimoStandardContext standardContext = (GeronimoStandardContext) lifecycleEvent.getSource();
            GeronimoApplicationContext applicationContext = (GeronimoApplicationContext) standardContext.getInternalServletContext();
            //Calculate the final Security Permissions
            SpecSecurityBuilder specSecurityBuilder = applicationContext.getSpecSecurityBuilder();
            Map<String, ComponentPermissions> contextIdPermissionsMap = new HashMap<String, ComponentPermissions>();
            contextIdPermissionsMap.put(contextId, specSecurityBuilder.buildSpecSecurityConfig());
            //Update ApplicationPolicyConfigurationManager
            try {
                applicationPolicyConfigurationManager.updateApplicationPolicyConfiguration(contextIdPermissionsMap);
            } catch (LoginException e) {
                logger.error("Fail to set application policy configurations", e);
                throw new RuntimeException("Fail to set application policy configurations", e);
            } catch (PolicyContextException e) {
                logger.error("Fail to set application policy configurations", e);
                throw new RuntimeException("Fail to set application policy configurations", e);
            } catch (ClassNotFoundException e) {
                logger.error("Fail to set application policy configurations", e);
                throw new RuntimeException("Fail to set application policy configurations", e);
            } finally {
                //Clear SpecSecurityBuilder
                specSecurityBuilder.clear();
                applicationContext.setSpecSecurityBuilder(null);
            }
        }
    }
View Full Code Here

        }
        return schemaVersion;
    }

    protected ComponentPermissions buildSpecSecurityConfig(EARContext earContext, WebAppType webApp, Bundle bundle) {
        SpecSecurityBuilder builder = new SpecSecurityBuilder(webApp, bundle, INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()) >= 2.5f && !webApp.getMetadataComplete());
        return builder.buildSpecSecurityConfig();
    }
View Full Code Here

    }

    @Override
    public void setRunAsRole(String roleName) {
        applicationServletRegistration.setRunAsRole(roleName);
        SpecSecurityBuilder specSecurityBuilder = applicationContext.getSpecSecurityBuilder();
        specSecurityBuilder.declareRoles(roleName);
    }
View Full Code Here

            throw new IllegalArgumentException("ServletSecurityElement configured by setServletSecurity should not be null");
        }
        if (standardContext.getState() != LifecycleState.STARTING_PREP) {
            throw new IllegalStateException("setServletSecurity action is not allowed after the context " + standardContext.getPath() + " is initialized");
        }
        SpecSecurityBuilder specSecurityBuilder = applicationContext.getSpecSecurityBuilder();
        if (specSecurityBuilder == null) {
            //Should Never Happen ?
            throw new IllegalStateException(
                    "Web security builder is null, setServletSecurity action is not supported, you must make sure enable the security configuration while deploying the web application");
        }
        return specSecurityBuilder.setServletSecurity(constraint, getMappings());
    }
View Full Code Here

                }
                throw new LifecycleException(e);
            } catch (ServletException e) {
                throw new LifecycleException(e);
            }
            SpecSecurityBuilder specSecurityBuilder = new SpecSecurityBuilder(webSecurityConstraintStore.exportMergedWebAppInfo());
            Map<String, ComponentPermissions> contextIdPermissionsMap = new HashMap<String, ComponentPermissions>();
            contextIdPermissionsMap.put(getPolicyContextId(), specSecurityBuilder.buildSpecSecurityConfig());
            //Update ApplicationPolicyConfigurationManager
            if (applicationPolicyConfigurationManager != null) {
                try {
                    applicationPolicyConfigurationManager.updateApplicationPolicyConfiguration(contextIdPermissionsMap);
                } catch (LoginException e) {
                    getLogger().error("Fail to set application policy configurations", e);
                    throw new RuntimeException("Fail to set application policy configurations", e);
                } catch (PolicyContextException e) {
                    getLogger().error("Fail to set application policy configurations", e);
                    throw new RuntimeException("Fail to set application policy configurations", e);
                } catch (ClassNotFoundException e) {
                    getLogger().error("Fail to set application policy configurations", e);
                    throw new RuntimeException("Fail to set application policy configurations", e);
                } finally {
                    //Clear SpecSecurityBuilder
                    specSecurityBuilder.clear();
                }
            }
            // for OSGi Web Applications support register ServletContext in service registry
            if (WebApplicationUtils.isWebApplicationBundle(bundle)) {
                serviceRegistration = WebApplicationUtils.registerServletContext(bundle, getServletContext());
View Full Code Here

TOP

Related Classes of org.apache.geronimo.web.security.SpecSecurityBuilder$RecordingPolicyConfiguration

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.