Commit 662f41c2 authored by Christos Tranoris's avatar Christos Tranoris Committed by Christos Tranoris
Browse files

fix for bearer

parent 73b99e09
Loading
Loading
Loading
Loading
Loading
+103 −81
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Base64;
import java.util.Iterator;
import java.util.Map.Entry;
import javax.net.ssl.TrustManagerFactory;
import com.fasterxml.jackson.databind.JsonNode;
@@ -249,8 +250,11 @@ public class CapifService {

    for (Entry<String, ApiResponse> entry : cif.getServiceApis().entrySet()) {      
      
      for (ServiceAPIDescription sapi : entry.getValue().getServiceAPIDescriptions()) {
        for (String reqAPI : cif.getReqApiNames()) {      
          if (  reqAPI.equals( sapi.getApiName() ) ) {       
            
      ServiceAPIDescription serviceApi = entry.getValue().getServiceAPIDescriptions().get(0) ;
            ServiceAPIDescription serviceApi = sapi ;
            AefProfile defaultProfile = serviceApi.getAefProfiles().get(0);
            
             
@@ -299,14 +303,21 @@ public class CapifService {
          return cif;
            
          }
        }
      }      

      return cif;
    }

    public CapifInvoker getServiceBearer(CapifInvoker cif) throws Exception {
          

      for (Entry<String, ApiResponse> entry : cif.getServiceApis().entrySet()) {      
        
        
        ServiceAPIDescription serviceApi = entry.getValue().getServiceAPIDescriptions().get(0) ;
        for (ServiceAPIDescription sapi : entry.getValue().getServiceAPIDescriptions()) {
          for (String reqAPI : cif.getReqApiNames()) {      
            if (  reqAPI.equals( sapi.getApiName() ) ) {       
              ServiceAPIDescription serviceApi = sapi ;
              AefProfile defaultProfile = serviceApi.getAefProfiles().get(0);
              
              logger.info("========= GetOAuTh Bearer apiid: {}, aefid: {} ==========", defaultProfile.getAefId(), serviceApi.getApiId() );
@@ -347,7 +358,18 @@ public class CapifService {
              logger.info("OAUTH token: " + accessToken);
              return cif;
              
              
              
            }
          }
        }
      }
        
        
        
        
        
      
      return cif;
      
    }