+++ /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 java.security.Principal;\r
-\r
-import org.onap.aaf.cadi.Access;\r
-\r
-/**\r
- * AbsTafResp\r
- * \r
- * Base class for TafResp (TAF Response Objects)\r
- *\r
- */\r
-public abstract class AbsTafResp implements TafResp {\r
-\r
- protected final String desc;\r
- protected final Principal principal;\r
- protected final Access access;\r
-\r
- /**\r
- * AbsTafResp\r
- * \r
- * Set and hold\r
- * Description (for logging)\r
- * Principal (as created by derived class)\r
- * Access (for access to underlying container, i.e. for Logging, auditing, ClassLoaders, etc)\r
- * \r
- * @param access\r
- * @param principal\r
- * @param description\r
- */\r
- public AbsTafResp(Access access, Principal principal, String description) {\r
- this.access = access;\r
- this.principal = principal;\r
- this.desc = description;\r
- }\r
-\r
- /**\r
- * isValid()\r
- * \r
- * Respond in the affirmative if the TAF was able to Authenticate\r
- */\r
- public boolean isValid() {\r
- return principal!=null;\r
- }\r
-\r
- /**\r
- * desc()\r
- * \r
- * Respond with description of response as given by the TAF \r
- */\r
- public String desc() {\r
- return desc;\r
- }\r
-\r
- /**\r
- * isAuthenticated()\r
- * \r
- * Respond with the TAF's code of whether Authenticated, or suggested next steps\r
- * default is either IS_AUTHENTICATED, or TRY_ANOTHER_TAF. The TAF can overload\r
- * and suggest others, such as "NO_FURTHER_PROCESSING", if it can detect that this\r
- * is some sort of security breach (i.e. Denial of Service) \r
- */\r
- public RESP isAuthenticated() {\r
- return principal==null?RESP.TRY_ANOTHER_TAF:RESP.IS_AUTHENTICATED;\r
- }\r
-\r
- /**\r
- * getPrincipal()\r
- * \r
- * Return the principal created by the TAF based on Authentication. \r
- * \r
- * Returns "null" if Authentication failed (no principal)\r
- */\r
- public Principal getPrincipal() {\r
- return principal;\r
- }\r
-\r
- /**\r
- * getAccess()\r
- * \r
- * Get the Access object from the TAF, so that appropriate Logging, etc can be coordinated.\r
- */\r
- public Access getAccess() {\r
- return access;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see com.att.cadi.taf.TafResp#isFailedAttempt()\r
- */\r
- public boolean isFailedAttempt() {\r
- return false;\r
- }\r
-\r
-}\r