001    /* 
002     * JBoss, Home of Professional Open Source 
003     * Copyright 2012 Red Hat Inc. and/or its affiliates and other contributors
004     * as indicated by the @author tags. All rights reserved. 
005     * See the copyright.txt in the distribution for a 
006     * full listing of individual contributors.
007     *
008     * This copyrighted material is made available to anyone wishing to use, 
009     * modify, copy, or redistribute it subject to the terms and conditions 
010     * of the GNU Lesser General Public License, v. 2.1. 
011     * This program is distributed in the hope that it will be useful, but WITHOUT A 
012     * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
013     * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details. 
014     * You should have received a copy of the GNU Lesser General Public License, 
015     * v.2.1 along with this distribution; if not, write to the Free Software 
016     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
017     * MA  02110-1301, USA.
018     */
019    package org.switchyard.policy;
020    
021    /**
022     * Supported types for <a href="http://docs.oasis-open.org/opencsa/sca-policy/sca-policy-1.1-spec-csprd03.html#_Toc311121482">Security Policy</a>.
023     * 
024     * @author David Ward &lt;<a href="mailto:dward@jboss.org">dward@jboss.org</a>&gt; &copy; 2012 Red Hat Inc.
025     */
026    public enum SecurityPolicy implements Policy {
027    
028        /**
029         * Ensure that the client is authenticated by the server.
030         */
031        CLIENT_AUTHENTICATION("clientAuthentication") {
032            @Override
033            public PolicyType getType() {
034                return PolicyType.INTERACTION;
035            }
036        },
037        
038        /**
039         * Ensure that only authorized entities can view the contents of a message.
040         */
041        CONFIDENTIALITY("confidentiality") {
042            @Override
043            public PolicyType getType() {
044                return PolicyType.INTERACTION;
045            }
046        };
047    
048        private String _name;
049    
050        private SecurityPolicy(String name) {
051            _name = name;
052        }
053    
054        /**
055         * {@inheritDoc}
056         */
057        @Override
058        public String getName() {
059            return _name;
060        }
061    
062        /**
063         * {@inheritDoc}
064         */
065        @Override
066        public String toString() {
067            return getName();
068        }
069    
070        /**
071         * {@inheritDoc}
072         */
073        @Override
074        public boolean isCompatibleWith(Policy target) {
075            return true;
076        }
077        
078        /**
079         * {@inheritDoc}
080         */
081        @Override
082        public Policy getPolicyDependency() {
083            return null;
084        }
085    }