+++ /dev/null
-/*******************************************************************************\r
- * ============LICENSE_START====================================================\r
- * * org.onap.aaf\r
- * * ===========================================================================\r
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * * ===========================================================================\r
- * * Licensed under the Apache License, Version 2.0 (the "License");\r
- * * you may not use this file except in compliance with the License.\r
- * * You may obtain a copy of the License at\r
- * * \r
- * * http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
- * * Unless required by applicable law or agreed to in writing, software\r
- * * distributed under the License is distributed on an "AS IS" BASIS,\r
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * * See the License for the specific language governing permissions and\r
- * * limitations under the License.\r
- * * ============LICENSE_END====================================================\r
- * *\r
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * *\r
- ******************************************************************************/\r
-package org.onap.aaf.cadi.taf;\r
-\r
-import org.onap.aaf.cadi.CadiException;\r
-import org.onap.aaf.cadi.Taf;\r
-\r
-/**\r
- * EpiTAF\r
- * \r
- * Short for "Epic TAF". Be able to run through a series of TAFs to obtain the validation needed.\r
- * \r
- * OK, the name could probably be better as "Tafs", like it was originally, but the pun was too\r
- * irresistible for this author to pass up.\r
- * \r
- *\r
- */\r
-public class EpiTaf implements Taf {\r
- private Taf[] tafs;\r
- \r
- /**\r
- * EpiTaf constructor\r
- * \r
- * Construct the EpiTaf from variable TAF parameters\r
- * @param tafs\r
- * @throws CadiException\r
- */\r
- public EpiTaf(Taf ... tafs) throws CadiException{\r
- this.tafs = tafs;\r
- if(tafs.length==0) throw new CadiException("Need at least one Taf implementation in constructor");\r
- }\r
-\r
- /**\r
- * validate\r
- * \r
- * Respond with the first TAF to authenticate user based on variable info and "LifeForm" (is it \r
- * a human behind an interface, or a server behind a protocol).\r
- * \r
- * If there is no TAF that can authenticate, respond with the first TAF that suggests it can\r
- * establish an Authentication conversation (TRY_AUTHENTICATING).\r
- * \r
- * If no TAF declares either, respond with NullTafResp (which denies all questions)\r
- */\r
- public TafResp validate(LifeForm reading, String... info) {\r
- TafResp tresp,firstTryAuth=null;\r
- for(Taf taf : tafs) {\r
- tresp = taf.validate(reading, info);\r
- switch(tresp.isAuthenticated()) {\r
- case TRY_ANOTHER_TAF:\r
- break;\r
- case TRY_AUTHENTICATING:\r
- if(firstTryAuth==null)firstTryAuth=tresp;\r
- break;\r
- default:\r
- return tresp;\r
- }\r
- }\r
-\r
- // No TAFs configured, at this point. It is safer at this point to be "not validated", \r
- // rather than "let it go"\r
- return firstTryAuth == null?NullTafResp.singleton():firstTryAuth;\r
- }\r
-\r
-}\r