X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Faaf%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Faaf%2Fv2_0%2FAAFAuthn.java;h=e16782fa853347a0f149edb0c8bbfd81edd2ab70;hb=d47bcb076eda98afc13cdb29e8c56e8be25e78d3;hp=f74306fb46c087bb71632194fca9340928ec9f0f;hpb=71ba4dc9540db18cc51e318df94c81e7b49613af;p=aaf%2Fauthz.git diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java index f74306fb..e16782fa 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java @@ -34,6 +34,7 @@ import org.onap.aaf.cadi.User; import org.onap.aaf.cadi.aaf.AAFPermission; import org.onap.aaf.cadi.client.Future; import org.onap.aaf.cadi.client.Rcli; +import org.onap.aaf.cadi.locator.SingleEndpointLocator; import org.onap.aaf.cadi.lur.ConfigPrincipal; import aaf.v2_0.CredRequest; @@ -143,10 +144,14 @@ public class AAFAuthn extends AbsUserCache { public Resp revalidate(Object state) { int maxRetries = 15; - try { // these SHOULD be AAFConHttp and AAFLocator objects, but put in a try anyway to be safe + try { // these SHOULD be an AAFConHttp and a AAFLocator or SingleEndpointLocator objects, but put in a try to be safe AAFConHttp forceCastCon = (AAFConHttp) con; - AAFLocator forceCastLoc = (AAFLocator) forceCastCon.hman().loc; - maxRetries = forceCastLoc.maxIters(); + if (forceCastCon.hman().loc instanceof SingleEndpointLocator) { + maxRetries = 1; // we cannot retry the single LGW gateway! + } else { + AAFLocator forceCastLoc = (AAFLocator) forceCastCon.hman().loc; + maxRetries = forceCastLoc.maxIters(); + } } catch (Exception e) { access.log(Access.Level.DEBUG, e); } @@ -156,17 +161,12 @@ public class AAFAuthn extends AbsUserCache { try { Miss missed = missed(getName(), getCred()); if (missed == null || missed.mayContinue()) { - CredRequest cr = new CredRequest(); - cr.setId(getName()); - cr.setPassword(new String(getCred())); - Rcli client = con.clientIgnoreAlreadyAttempted(attemptedUris); + Rcli client = con.clientIgnoreAlreadyAttempted(attemptedUris).forUser(con.basicAuth(getName(), new String(getCred()))); thisUri = client.getURI(); - Future fp = client.readPost("/authn/validate", con.credReqDF, cr); - //Rcli client = con.client().forUser(con.basicAuth(getName(), new String(getCred()))); - //Future fp = client.read( - // "/authn/basicAuth", - // "text/plain" - // ); + Future fp = client.read( + "/authn/basicAuth", + "text/plain" + ); if (fp.get(con.timeout)) { expires = System.currentTimeMillis() + timeToLive; addUser(new User(this, timeToLive));