X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aaf%2Fauthz.git;a=blobdiff_plain;f=auth%2Fauth-service%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fservice%2Fapi%2FAPI_Creds.java;h=a8830c936cd885914da587fd40cbc1efa95e8d2d;hp=68e0f14569152d78a0a25ea0a6bf9995039b2856;hb=7e966914050e66219689001ff4ab601a49eef0ac;hpb=ead32f193586e39b59bb366bddf70e665173a52d diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java index 68e0f145..a8830c93 100644 --- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java +++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java @@ -91,13 +91,13 @@ public class API_Creds { } else if (p instanceof X509Principal) { // have to check Basic Auth here, because it might be CSP. String authz = req.getHeader("Authorization"); - if(authz.startsWith("Basic ")) { + if (authz.startsWith("Basic ")) { BasicHttpTaf bht = ((X509Principal)p).getBasicHttpTaf(); - if(bht!=null) { + if (bht!=null) { BasicPrincipal bp = new BasicPrincipal(authz,""); CredVal cv = bht.getCredVal(bp.getDomain()); - if(cv!=null) { - if(cv.validate(bp.getName(), Type.PASSWORD, bp.getCred(), null) ) { + if (cv!=null) { + if (cv.validate(bp.getName(), Type.PASSWORD, bp.getCred(), null) ) { resp.setStatus(HttpStatus.OK_200); } else { resp.setStatus(HttpStatus.FORBIDDEN_403); @@ -108,7 +108,7 @@ public class API_Creds { int colon = decoded.indexOf(':'); TimeTaken tt = trans.start("Direct Validation", Env.REMOTE); try { - if(directAAFUserPass.validate( + if (directAAFUserPass.validate( decoded.substring(0,colon), CredVal.Type.PASSWORD , decoded.substring(colon+1).getBytes(),trans)) { @@ -124,7 +124,7 @@ public class API_Creds { } } } - } else if(p == null) { + } else if (p == null) { trans.error().log("Transaction not Authenticated... no Principal"); resp.setStatus(HttpStatus.FORBIDDEN_403); } else { @@ -146,7 +146,7 @@ public class API_Creds { HttpServletResponse resp) throws Exception { Result r = context.doesCredentialMatch(trans, req, resp); - if(r.isOK()) { + if (r.isOK()) { resp.setStatus(HttpStatus.OK_200); } else { // For Security, we don't give any info out on why failed, other than forbidden @@ -167,7 +167,7 @@ public class API_Creds { HttpServletResponse resp) throws Exception { Result r = context.getCertInfoByID(trans, req, resp, pathParam(req,":id") ); - if(r.isOK()) { + if (r.isOK()) { resp.setStatus(HttpStatus.OK_200); } else { // For Security, we don't give any info out on why failed, other than forbidden @@ -195,7 +195,7 @@ public class API_Creds { authzAPI.route(POST,"/authn/cred",API.CRED_REQ,new Code(facade,"Add a New ID/Credential", true) { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result r = context.createUserCred(trans, req); - if(r.isOK()) { + if (r.isOK()) { resp.setStatus(HttpStatus.CREATED_201); } else { context.error(trans,resp,r); @@ -214,7 +214,7 @@ public class API_Creds { HttpServletResponse resp) throws Exception { Result r = context.getCredsByNS(trans, resp, pathParam(req, "ns")); - if(r.isOK()) { + if (r.isOK()) { resp.setStatus(HttpStatus.OK_200); } else { context.error(trans,resp,r); @@ -234,7 +234,7 @@ public class API_Creds { HttpServletResponse resp) throws Exception { Result r = context.getCredsByID(trans, resp, pathParam(req, "id")); - if(r.isOK()) { + if (r.isOK()) { resp.setStatus(HttpStatus.OK_200); } else { context.error(trans,resp,r); @@ -252,7 +252,7 @@ public class API_Creds { public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result r = context.changeUserCred(trans, req); - if(r.isOK()) { + if (r.isOK()) { resp.setStatus(HttpStatus.OK_200); } else { context.error(trans,resp,r); @@ -273,7 +273,7 @@ public class API_Creds { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result r = context.extendUserCred(trans, req, pathParam(req, "days")); - if(r.isOK()) { + if (r.isOK()) { resp.setStatus(HttpStatus.OK_200); } else { context.error(trans,resp,r); @@ -288,7 +288,7 @@ public class API_Creds { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result r = context.deleteUserCred(trans, req); - if(r.isOK()) { + if (r.isOK()) { resp.setStatus(HttpStatus.OK_200); } else { context.error(trans,resp,r);