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 java.io.Serializable;
020 import javax.security.auth.Subject;
021
022 import org.omg.CSI.IdentityToken;
023 import org.apache.geronimo.corba.security.SASException;
024
025
026 /**
027 * @version $Rev: 706640 $ $Date: 2008-10-21 14:44:05 +0000 (Tue, 21 Oct 2008) $
028 */
029 public abstract class TSSSASIdentityToken implements Serializable {
030
031 public abstract short getType();
032
033 public abstract String getOID();
034
035 public abstract Subject check(IdentityToken identityToken) throws SASException;
036
037 public boolean equals(Object o) {
038 if (this == o) return true;
039 if (!(o instanceof TSSSASIdentityToken)) return false;
040
041 final TSSSASIdentityToken token = (TSSSASIdentityToken) o;
042
043 if (getType() != token.getType()) return false;
044 if (!getOID().equals(token.getOID())) return false;
045
046 return true;
047 }
048
049 public int hashCode() {
050 int result = getOID().hashCode();
051 result = 29 * result + (int) getType();
052 return result;
053 }
054
055 public String toString() {
056 StringBuffer buf = new StringBuffer();
057 toString("", buf);
058 return buf.toString();
059 }
060
061 abstract void toString(String spaces, StringBuffer buf);
062
063 }