Examples of PolicyReader


Examples of org.codehaus.loom.xmlpolicy.reader.PolicyReader

    protected PolicyMetaData buildFromStream( final InputStream stream )
        throws Exception
    {
        try
        {
            final PolicyReader builder = new PolicyReader();
            final Document config = load( stream );
            return builder.readPolicy( config.getDocumentElement() );
        }
        catch( final Exception e )
        {
            fail( "Error building Policy: " + e );
            return null;
View Full Code Here

Examples of org.freshcookies.security.policy.PolicyReader

        // Next, verify the policy
        try
        {
            // Get the file
            PolicyReader policy = new PolicyReader( policyFile );
            m_session.addMessage( INFO_POLICY, "The security policy '" + policy.getFile() + "' exists." );

            // See if there is a keystore that's valid
            KeyStore ks = policy.getKeyStore();
            if ( ks == null )
            {
                m_session.addMessage( WARNING_POLICY,
                    "Policy file does not have a keystore... at least not one that we can locate. If your policy file " +
                    "does not contain any 'signedBy' blocks, this is probably ok." );
            }
            else
            {
                m_session.addMessage( INFO_POLICY,
                    "The security policy specifies a keystore, and we were able to locate it in the filesystem." );
            }

            // Verify the file
            policy.read();
            List<Exception> errors = policy.getMessages();
            if ( errors.size() > 0 )
            {
                for( Exception e : errors )
                {
                    m_session.addMessage( ERROR_POLICY, e.getMessage() );
                }
            }
            else
            {
                m_session.addMessage( INFO_POLICY, "The security policy looks fine." );
                m_isSecurityPolicyConfigured = true;
            }

            // Stash the unique principals mentioned in the file,
            // plus our standard roles.
            Set<Principal> principals = new LinkedHashSet<Principal>();
            principals.add( Role.ALL );
            principals.add( Role.ANONYMOUS );
            principals.add( Role.ASSERTED );
            principals.add( Role.AUTHENTICATED );
            ProtectionDomain[] domains = policy.getProtectionDomains();
            for ( ProtectionDomain domain : domains )
            {
                for( Principal principal : domain.getPrincipals() )
                {
                    principals.add( principal );
View Full Code Here

Examples of org.freshcookies.security.policy.PolicyReader

        // Next, verify the policy
        try
        {
            // Get the file
            PolicyReader policy = new PolicyReader( policyFile );
            m_session.addMessage( INFO_POLICY, "The security policy '" + policy.getFile() + "' exists." );

            // See if there is a keystore that's valid
            KeyStore ks = policy.getKeyStore();
            if ( ks == null )
            {
                m_session.addMessage( WARNING_POLICY,
                    "Policy file does not have a keystore... at least not one that we can locate. If your policy file " +
                    "does not contain any 'signedBy' blocks, this is probably ok." );
            }
            else
            {
                m_session.addMessage( INFO_POLICY,
                    "The security policy specifies a keystore, and we were able to locate it in the filesystem." );
            }

            // Verify the file
            policy.read();
            List<Exception> errors = policy.getMessages();
            if ( errors.size() > 0 )
            {
                for( Exception e : errors )
                {
                    m_session.addMessage( ERROR_POLICY, e.getMessage() );
                }
            }
            else
            {
                m_session.addMessage( INFO_POLICY, "The security policy looks fine." );
                m_isSecurityPolicyConfigured = true;
            }

            // Stash the unique principals mentioned in the file,
            // plus our standard roles.
            Set<Principal> principals = new LinkedHashSet<Principal>();
            principals.add( Role.ALL );
            principals.add( Role.ANONYMOUS );
            principals.add( Role.ASSERTED );
            principals.add( Role.AUTHENTICATED );
            ProtectionDomain[] domains = policy.getProtectionDomains();
            for ( ProtectionDomain domain : domains )
            {
                for( Principal principal : domain.getPrincipals() )
                {
                    principals.add( principal );
View Full Code Here

Examples of org.freshcookies.security.policy.PolicyReader

        // Next, verify the policy
        try
        {
            // Get the file
            PolicyReader policy = new PolicyReader( policyFile );
            m_session.addMessage( INFO_POLICY, "The security policy '" + policy.getFile() + "' exists." );

            // See if there is a keystore that's valid
            KeyStore ks = policy.getKeyStore();
            if ( ks == null )
            {
                m_session.addMessage( WARNING_POLICY,
                    "Policy file does not have a keystore... at least not one that we can locate. If your policy file " +
                    "does not contain any 'signedBy' blocks, this is probably ok." );
            }
            else
            {
                m_session.addMessage( INFO_POLICY,
                    "The security policy specifies a keystore, and we were able to locate it in the filesystem." );
            }

            // Verify the file
            policy.read();
            List<Exception> errors = policy.getMessages();
            if ( errors.size() > 0 )
            {
                for( Exception e : errors )
                {
                    m_session.addMessage( ERROR_POLICY, e.getMessage() );
                }
            }
            else
            {
                m_session.addMessage( INFO_POLICY, "The security policy looks fine." );
                m_isSecurityPolicyConfigured = true;
            }

            // Stash the unique principals mentioned in the file,
            // plus our standard roles.
            Set<Principal> principals = new LinkedHashSet<Principal>();
            principals.add( Role.ALL );
            principals.add( Role.ANONYMOUS );
            principals.add( Role.ASSERTED );
            principals.add( Role.AUTHENTICATED );
            ProtectionDomain[] domains = policy.getProtectionDomains();
            for ( ProtectionDomain domain : domains )
            {
                for( Principal principal : domain.getPrincipals() )
                {
                    principals.add( principal );
View Full Code Here

Examples of org.freshcookies.security.policy.PolicyReader

        // Next, verify the policy
        try
        {
            // Get the file
            PolicyReader policy = new PolicyReader( policyFile );
            m_session.addMessage( INFO_POLICY, "The security policy '" + policy.getFile() + "' exists." );

            // See if there is a keystore that's valid
            KeyStore ks = policy.getKeyStore();
            if ( ks == null )
            {
                m_session.addMessage( WARNING_POLICY,
                    "Policy file does not have a keystore... at least not one that we can locate. If your policy file " +
                    "does not contain any 'signedBy' blocks, this is probably ok." );
            }
            else
            {
                m_session.addMessage( INFO_POLICY,
                    "The security policy specifies a keystore, and we were able to locate it in the filesystem." );
            }

            // Verify the file
            policy.read();
            List<Exception> errors = policy.getMessages();
            if ( errors.size() > 0 )
            {
                for( Exception e : errors )
                {
                    m_session.addMessage( ERROR_POLICY, e.getMessage() );
                }
            }
            else
            {
                m_session.addMessage( INFO_POLICY, "The security policy looks fine." );
                m_isSecurityPolicyConfigured = true;
            }

            // Stash the unique principals mentioned in the file,
            // plus our standard roles.
            Set<Principal> principals = new LinkedHashSet<Principal>();
            principals.add( Role.ALL );
            principals.add( Role.ANONYMOUS );
            principals.add( Role.ASSERTED );
            principals.add( Role.AUTHENTICATED );
            ProtectionDomain[] domains = policy.getProtectionDomains();
            for ( ProtectionDomain domain : domains )
            {
                for( Principal principal : domain.getPrincipals() )
                {
                    principals.add( principal );
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.support.finder.PolicyReader

    */
   public void init(PolicyFinder finder)
   {
      String clazzName = JBossStaticPolicyFinderModule.class.getName();
      // now that we have the PolicyFinder, we can load the policies
      PolicyReader reader = new PolicyReader(finder, java.util.logging.Logger.getLogger(clazzName), schemaFile);

      Iterator it = policyList.iterator();
      while (it.hasNext())
      {
         String str = (String) (it.next());
         AbstractPolicy policy = null;
         try
         {
            try
            {
               // first try to load it as a URL
               URL url = new URL(str);
               policy = reader.readPolicy(url);
            }
            catch (MalformedURLException murle)
            {
               // assume that this is a filename, and try again
               policy = reader.readPolicy(new File(str));
            }
         }
         catch (ParsingException e)
         {
            this.encounteredParsingException = true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.