001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.geronimo.corba.security.config.tss;
018    
019    import javax.security.auth.Subject;
020    
021    import org.omg.CORBA.ORB;
022    import org.omg.CSI.EstablishContext;
023    import org.omg.CSIIOP.AS_ContextSec;
024    import org.omg.GSSUP.GSSUPMechOID;
025    import org.omg.IOP.Codec;
026    
027    import org.apache.geronimo.corba.security.SASException;
028    import org.apache.geronimo.corba.util.Util;
029    
030    
031    /**
032     * @version $Rev: 503274 $ $Date: 2007-02-03 10:19:18 -0800 (Sat, 03 Feb 2007) $
033     */
034    public class TSSNULLASMechConfig extends TSSASMechConfig {
035    
036        public short getSupports() {
037            return 0;
038        }
039    
040        public short getRequires() {
041            return 0;
042        }
043    
044        /**
045         * Encode a virtually null AS context.  Since supports is zero, everything
046         * else should be ignored.
047         *
048         * @param orb
049         * @param codec
050         * @return
051         * @throws Exception
052         */
053        public AS_ContextSec encodeIOR(ORB orb, Codec codec) throws Exception {
054            AS_ContextSec result = new AS_ContextSec();
055    
056            result.target_supports = 0;
057            result.target_requires = 0;
058            result.client_authentication_mech = Util.encodeOID(GSSUPMechOID.value);
059            result.target_name = Util.encodeGSSExportName(GSSUPMechOID.value, "");
060    
061            return result;
062        }
063    
064        public Subject check(EstablishContext msg) throws SASException {
065            return null;
066        }
067    
068        public void toString(String spaces, StringBuffer buf) {
069            buf.append(spaces).append("TSSNULLASMechConfig\n");
070        }
071    
072    }