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 org.omg.CSIIOP.SCS_GSSExportedName;
020 import org.omg.CSIIOP.ServiceConfiguration;
021
022 import org.apache.geronimo.corba.security.config.ConfigException;
023 import org.apache.geronimo.corba.util.Util;
024
025
026 /**
027 * TODO: This is just wrong
028 *
029 * @version $Revision: 503274 $ $Date: 2007-02-03 10:19:18 -0800 (Sat, 03 Feb 2007) $
030 */
031 public class TSSGSSExportedNameConfig extends TSSServiceConfigurationConfig {
032
033 private String name;
034 private String oid;
035
036 public TSSGSSExportedNameConfig(byte[] name) throws Exception {
037 this.name = Util.decodeGSSExportName(name);
038 }
039
040 public TSSGSSExportedNameConfig(String name, String oid) {
041 this.name = name;
042 this.oid = oid;
043 }
044
045 public String getName() {
046 return name;
047 }
048
049 public void setName(String name) {
050 this.name = name;
051 }
052
053 public String getOid() {
054 return oid;
055 }
056
057 public void setOid(String oid) {
058 this.oid = oid;
059 }
060
061 public ServiceConfiguration generateServiceConfiguration() throws ConfigException {
062 ServiceConfiguration config = new ServiceConfiguration();
063
064 config.syntax = SCS_GSSExportedName.value;
065 config.name = Util.encodeGSSExportName(oid, name);
066
067 if (config.name == null) throw new ConfigException("Unable to encode GSSExportedName");
068
069 return config;
070 }
071
072 void toString(String spaces, StringBuffer buf) {
073 String moreSpaces = spaces + " ";
074 buf.append(spaces).append("TSSGSSExportedNameConfig: [\n");
075 buf.append(moreSpaces).append("oid : ").append(oid).append("\n");
076 buf.append(moreSpaces).append("name: ").append(name).append("\n");
077 buf.append(spaces).append("]\n");
078 }
079 }