Package org.jvnet.glassfish.comms.security.authorize

Examples of org.jvnet.glassfish.comms.security.authorize.SipResourcePermission


                        new ProtectionDomain(codeSource, null, null, principals);
                protectionDomainCache.put(principalSet, pd);

            }

            SipResourcePermission srp = new SipResourcePermission(servletName,
                    sipMethod);

            return policy.implies(pd, srp);
        } catch (Throwable ex) {
            Logger.getLogger(AuthModule.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here



                key = (Key) keyItr.next();

                ServletActions sa = (DescriptorProcessor.ServletActions) reslist.get(key);
                SipResourcePermission srp = new SipResourcePermission(key.servletName,
                        sa.actions);
                Permissions p = null;

                if (permCollection.containsKey(key.roleName)) {
                    p = permCollection.get(key.roleName);
                } else {
                    p = new Permissions();
                    permCollection.put(key.roleName, p);
                }

                p.add(srp);
                pc.addToRole(key.roleName,
                        new SipRoleRefPermission(key.servletName, key.roleName));
            }

            Iterator<String> permItr = permCollection.keySet().iterator();

            while (permItr.hasNext()) {
                String role = permItr.next();
                Permissions perms = (Permissions) permCollection.get(role);
                pc.addToRole(role, perms);
            }

            Map<String, Servlet> servlets = sipConfig.getServlets();
            Iterator<Servlet> servletItr = servlets.values().iterator();

            while (servletItr.hasNext()) {
                Servlet servlet = servletItr.next();
                String servletName = servlet.getServletName();
                Enumeration<RoleReference> srRef = servlet.getSecurityRoleReferences();

                if (srRef != null) {
                    // Iterator<SecurityRoleReference> srItr = srRef.iterator();

                    while (srRef.hasMoreElements()) {
                        RoleReference srr = srRef.nextElement();
                        String roleLink = srr.getSecurityRoleLink().getName();
                        String roleName = srr.getRolename();
                        SipRoleRefPermission srp = new SipRoleRefPermission(servletName,
                                roleName);
                        pc.addToRole(roleLink, srp);
                    }
                }
            }

            Permissions udcPermList = new Permissions();
            Iterator<TransportConstraints> tcItr = userDataConsTable.values().iterator();

            while (tcItr.hasNext()) {
                TransportConstraints tcValue = tcItr.next();

                //String[] actions = tcValue.actions.toArray(new String[0]);
                SipUserDataPermission wdp = new SipUserDataPermission(tcValue.servletName,
                        tcValue.actions, tcValue.getType());
                noUDPerm = false;
                //SipUserDataPermission(tcValue.servletName, actions, tcValue.getType());
                udcPermList.add(wdp);
            }
            if (noUDPerm) {
                addDefaultUserDataPermissions(sipConfig, udcPermList);
            }


            Map<String, Servlet> servletList = sipConfig.getServlets();
            Iterator<String> sitr = servletList.keySet().iterator();

            while (sitr.hasNext()) {
                String sn = sitr.next();
//                if (restrictedActionList.containsKey(sn)) {
//                    continue;
//                }
                Set<String> ral = restrictedActionList.get(sn);
                Set<String> allowedActions = new HashSet<String>();

                if (ral == null) {
                    SipResourcePermission srp = new SipResourcePermission(sn, allowedActions);
                    udcPermList.add(srp);

                    continue;
                }
                Iterator<String> ralItr = ral.iterator();
                while (ralItr.hasNext()) {
                    allowedActions.add(ralItr.next());
                }
                SipResourcePermission srp = new SipResourcePermission(true, sn, allowedActions);
                udcPermList.add(srp);
            }

            pc.addToUncheckedPolicy(udcPermList);
            pc.commit();
View Full Code Here

            Permissions udcPermList = new Permissions();
            Set<String> emptySet = new HashSet<String>();
            String transport = null;
            while (sitr.hasNext()) {
                String sn = sitr.next();
                udcPermList.add(new SipResourcePermission(sn, emptySet));
                udcPermList.add(new SipUserDataPermission(sn, emptySet, transport));
            }
            pc.addToUncheckedPolicy(udcPermList);
            pc.commit();
        } catch (PolicyContextException pce) {
View Full Code Here


                key = (Key) keyItr.next();

                ServletActions sa = (DescriptorProcessor.ServletActions) reslist.get(key);
                SipResourcePermission srp = new SipResourcePermission(key.servletName,
                        sa.actions);
                Permissions p = null;

                if (permCollection.containsKey(key.roleName)) {
                    p = permCollection.get(key.roleName);
                } else {
                    p = new Permissions();
                    permCollection.put(key.roleName, p);
                }

                p.add(srp);
                pc.addToRole(key.roleName,
                        new SipRoleRefPermission(key.servletName, key.roleName));
            }

            Iterator<String> permItr = permCollection.keySet().iterator();

            while (permItr.hasNext()) {
                String role = permItr.next();
                Permissions perms = (Permissions) permCollection.get(role);
                pc.addToRole(role, perms);
            }

            Map<String, Servlet> servlets = sipConfig.getServlets();
            Iterator<Servlet> servletItr = servlets.values().iterator();

            while (servletItr.hasNext()) {
                Servlet servlet = servletItr.next();
                String servletName = servlet.getServletName();
                Enumeration<RoleReference> srRef = servlet.getSecurityRoleReferences();

                if (srRef != null) {
                    // Iterator<SecurityRoleReference> srItr = srRef.iterator();

                    while (srRef.hasMoreElements()) {
                        RoleReference srr = srRef.nextElement();
                        String roleLink = srr.getSecurityRoleLink().getName();
                        String roleName = srr.getRolename();
                        SipRoleRefPermission srp = new SipRoleRefPermission(servletName,
                                roleName);
                        pc.addToRole(roleLink, srp);
                    }
                }
            }

            Permissions udcPermList = new Permissions();
            Iterator<TransportConstraints> tcItr = userDataConsTable.values().iterator();

            while (tcItr.hasNext()) {
                TransportConstraints tcValue = tcItr.next();

                //String[] actions = tcValue.actions.toArray(new String[0]);
                SipUserDataPermission wdp = new SipUserDataPermission(tcValue.servletName,
                        tcValue.actions, tcValue.getType());
                noUDPerm = false;
                //SipUserDataPermission(tcValue.servletName, actions, tcValue.getType());
                udcPermList.add(wdp);
            }
            if (noUDPerm) {
                addDefaultUserDataPermissions(sipConfig, udcPermList);
            }


            Map<String, Servlet> servletList = sipConfig.getServlets();
            Iterator<String> sitr = servletList.keySet().iterator();

            while (sitr.hasNext()) {
                String sn = sitr.next();
//                if (restrictedActionList.containsKey(sn)) {
//                    continue;
//                }
                Set<String> ral = restrictedActionList.get(sn);
                Set<String> allowedActions = new HashSet<String>();

                if (ral == null) {
                    SipResourcePermission srp = new SipResourcePermission(sn, allowedActions);
                    udcPermList.add(srp);

                    continue;
                }
                Iterator<String> ralItr = ral.iterator();
                while (ralItr.hasNext()) {
                    allowedActions.add(ralItr.next());
                }
                SipResourcePermission srp = new SipResourcePermission(true, sn, allowedActions);
                udcPermList.add(srp);
            }

            pc.addToUncheckedPolicy(udcPermList);
            pc.commit();
View Full Code Here

            Permissions udcPermList = new Permissions();
            Set<String> emptySet = new HashSet<String>();
            String transport = null;
            while (sitr.hasNext()) {
                String sn = sitr.next();
                udcPermList.add(new SipResourcePermission(sn, emptySet));
                udcPermList.add(new SipUserDataPermission(sn, emptySet, transport));
            }
            pc.addToUncheckedPolicy(udcPermList);
            pc.commit();
        } catch (PolicyContextException pce) {
View Full Code Here

TOP

Related Classes of org.jvnet.glassfish.comms.security.authorize.SipResourcePermission

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.