+++ /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.authz.cadi;\r
-\r
-import static org.onap.aaf.authz.layer.Result.OK;\r
-\r
-import java.util.Date;\r
-\r
-import org.onap.aaf.authz.env.AuthzEnv;\r
-import org.onap.aaf.authz.env.AuthzTrans;\r
-import org.onap.aaf.authz.layer.Result;\r
-import org.onap.aaf.dao.DAOException;\r
-import org.onap.aaf.dao.aaf.hl.Question;\r
-\r
-import org.onap.aaf.cadi.CredVal;\r
-\r
-/**\r
- * DirectAAFUserPass is intended to provide password Validation directly from Cassandra Database, and is only\r
- * intended for use in AAF itself. The normal "AAF Taf" objects are, of course, clients.\r
- * \r
- *\r
- */\r
-public class DirectAAFUserPass implements CredVal {\r
- private final AuthzEnv env;\r
- private final Question question;\r
- \r
- public DirectAAFUserPass(AuthzEnv env, Question question, String appPass) {\r
- this.env = env;\r
- this.question = question;\r
- }\r
- \r
- @Override\r
- public boolean validate(String user, Type type, byte[] pass) {\r
- try {\r
- AuthzTrans trans = env.newTransNoAvg();\r
- Result<Date> result = question.doesUserCredMatch(trans, user, pass);\r
- trans.logAuditTrail(env.info());\r
- switch(result.status) {\r
- case OK:\r
- return true;\r
- default:\r
- \r
- env.warn().log(user, "failed Password Validation:",result.errorString());\r
- }\r
- } catch (DAOException e) {\r
- System.out.println(" exception in DirectAAFUserPass class ");\r
- e.printStackTrace();\r
- env.error().log(e,"Cannot validate User/Pass from Cassandra");\r
- }\r
- return false;\r
- }\r
-\r
-\r
-}\r