X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineUtils%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Futils%2FAAFPolicyClientImpl.java;h=732183d4797165f0423d5079d268d9132cfd015d;hb=aff7dbd3713e42412bcc7b5f6416896e16e82898;hp=9d5222af29cb29d64df391cd41a0081d48159f5a;hpb=fb3cc27605623672fb8971bd9030872f117c7af8;p=policy%2Fengine.git diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java index 9d5222af2..732183d47 100644 --- a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java +++ b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * PolicyEngineUtils * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,23 +17,24 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - - package org.onap.policy.utils; +import java.security.Principal; import java.util.Properties; import org.apache.log4j.Logger; +import org.onap.aaf.cadi.Access.Level; +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.PropAccess; +import org.onap.aaf.cadi.aaf.AAFPermission; +import org.onap.aaf.cadi.aaf.v2_0.AAFAuthn; +import org.onap.aaf.cadi.aaf.v2_0.AAFCon; +import org.onap.aaf.cadi.aaf.v2_0.AAFConHttp; +import org.onap.aaf.cadi.aaf.v2_0.AAFLurPerm; +import org.onap.aaf.cadi.config.Config; +import org.onap.aaf.cadi.locator.PropertyLocator; +import org.onap.aaf.cadi.principal.UnAuthPrincipal; -import com.att.cadi.Access; -import com.att.cadi.Access.Level; -import com.att.cadi.CadiException; -import com.att.cadi.aaf.AAFPermission; -import com.att.cadi.aaf.v2_0.AAFAuthn; -import com.att.cadi.aaf.v2_0.AAFCon; -import com.att.cadi.aaf.v2_0.AAFConDME2; -import com.att.cadi.aaf.v2_0.AAFLurPerm; -import com.att.cadi.config.Config; /** @@ -62,7 +63,7 @@ public class AAFPolicyClientImpl implements AAFPolicyClient{ private static AAFCon aafCon = null; private static AAFLurPerm aafLurPerm = null; private static AAFAuthn aafAuthn = null; - private static Access access = null; + private static PropAccess access = null; private AAFPolicyClientImpl(Properties properties) throws AAFPolicyException{ setup(properties); @@ -165,7 +166,6 @@ public class AAFPolicyClientImpl implements AAFPolicyClient{ logger.error(e.getMessage() + e); } } - logger.info("Authentication failed for : " + userName + " in " + props.getProperty(Config.AAF_URL)); return false; } @@ -188,13 +188,13 @@ public class AAFPolicyClientImpl implements AAFPolicyClient{ try { aafCon.basicAuth(userName, pass); AAFPermission perm = new AAFPermission(type, instance, action); - result = aafLurPerm.fish(userName, perm); + final Principal p = new UnAuthPrincipal(userName); + result = aafLurPerm.fish(p, perm); } catch (CadiException e) { logger.error(e.getMessage() + e); aafLurPerm.destroy(); } } - logger.info("Permissions for : " + userName + " in " + props.getProperty(Config.AAF_URL) + " for " + type + "," + instance + "," + action + "\n Result is: " + result); i++; }while(i<2 && !result); // Try once more to check if this can be passed. AAF has some issues. return result; @@ -202,7 +202,7 @@ public class AAFPolicyClientImpl implements AAFPolicyClient{ private static boolean setUpAAF(){ try { - aafCon = new AAFConDME2(access); + aafCon = new AAFConHttp(access,new PropertyLocator("https://aaf-onap-beijing-test.osaaf.org:8100")); aafLurPerm = aafCon.newLur(); aafAuthn = aafCon.newAuthn(aafLurPerm); return true;