Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.corba.security.config.css » [javadoc | source]
    1   /**
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   package org.apache.geronimo.corba.security.config.css;
   18   
   19   import java.io.Serializable;
   20   
   21   import org.omg.CSI.AuthorizationElement;
   22   import org.omg.CSI.IdentityToken;
   23   
   24   import org.apache.geronimo.corba.security.config.tss.TSSSASMechConfig;
   25   import org.apache.geronimo.corba.security.config.ConfigUtil;
   26   
   27   
   28   /**
   29    * @version $Rev: 503274 $ $Date: 2007-02-03 10:19:18 -0800 (Sat, 03 Feb 2007) $
   30    */
   31   public class CSSSASMechConfig implements Serializable {
   32   
   33       private short supports;
   34       private short requires;
   35       private boolean required;
   36       private CSSSASIdentityToken identityToken;
   37   
   38   
   39       public short getSupports() {
   40           return supports;
   41       }
   42   
   43       public short getRequires() {
   44           return requires;
   45       }
   46   
   47       public boolean isRequired() {
   48           return required;
   49       }
   50   
   51       public void setRequired(boolean required) {
   52           this.required = required;
   53       }
   54   
   55       public CSSSASIdentityToken getIdentityToken() {
   56           return identityToken;
   57       }
   58   
   59       public void setIdentityToken(CSSSASIdentityToken identityToken) {
   60           this.identityToken = identityToken;
   61       }
   62   
   63       public boolean canHandle(TSSSASMechConfig sasMech) {
   64           if ((supports & sasMech.getRequires()) != sasMech.getRequires()) return false;
   65           if ((requires & sasMech.getSupports()) != requires) return false;
   66   
   67           // TODO: FILL THIS IN
   68   
   69           return true;
   70       }
   71   
   72       public AuthorizationElement[] encodeAuthorizationElement() {
   73           return new AuthorizationElement[0];
   74       }
   75   
   76       public IdentityToken encodeIdentityToken() {
   77           return identityToken.encodeIdentityToken();
   78       }
   79   
   80       public String toString() {
   81           StringBuffer buf = new StringBuffer();
   82           toString("", buf);
   83           return buf.toString();
   84       }
   85   
   86       void toString(String spaces, StringBuffer buf) {
   87           String moreSpaces = spaces + "  ";
   88           buf.append(spaces).append("CSSSASMechConfig: [\n");
   89           buf.append(moreSpaces).append("SUPPORTS: ").append(ConfigUtil.flags(supports)).append("\n");
   90           buf.append(moreSpaces).append("REQUIRES: ").append(ConfigUtil.flags(requires)).append("\n");
   91           if (identityToken != null) {
   92               identityToken.toString(moreSpaces, buf);
   93           }
   94           buf.append(spaces).append("]\n");
   95       }
   96   
   97   }

Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.corba.security.config.css » [javadoc | source]