Commit 41f5e216 authored by root's avatar root
Browse files

Changes obtaining dataseeker information

parent 84bc2cfe
......@@ -69,6 +69,9 @@ public class GetAccessApiController implements GetAccessApi {
// organizationAttributesAsString="{\"name\":\"Test Organization\",\"sector\":\"Test Sector\",\"continent\":\"EU\",\"country\":\"GRE\",\"type\":\"Private Entity\",\"size\":\"medium\",\"reputation\":7}";
System.out.println("organizationAttributesAsString:"+organizationAttributesAsString);
/*"
......
......@@ -49,8 +49,8 @@ public class PolicyService {
private String authGrantType = "";
/* @Value("${datavaults.auth.username}")
private String authUsername = "";*/
@Value("${datavaults.auth.password}")
private String authPassword = "";
/* @Value("${datavaults.auth.password}")
private String authPassword = "";*/
private static final Logger log = LoggerFactory.getLogger(PolicyService.class);
......@@ -76,7 +76,7 @@ public class PolicyService {
// organizationAttributesAsString =httpUtils.sendHttpPostRequestWithOAuth(datavaultsUrl,authServerUrl,authClientId,authClientSecret,authGrantType,authUsername,authPassword);
organizationAttributesAsString =httpUtils.sendHttpPostRequestWithOAuth(datavaultsUrl,authServerUrl,authClientId,authClientSecret,authGrantType,dataSeekerId,authPassword);
organizationAttributesAsString =httpUtils.sendHttpPostRequestWithOAuth(datavaultsUrl,authServerUrl,authClientId,authClientSecret,authGrantType,dataSeekerId);
} catch (Exception e) {
......
......@@ -264,7 +264,7 @@ public class HttpUtils {
public String sendHttpPostRequestWithOAuth(String address,String authServerUrl, String authClientId, String authClientSecret, String authGrantType,String username,String password) throws
public String sendHttpPostRequestWithOAuth(String address,String authServerUrl, String authClientId, String authClientSecret, String authGrantType, String sDataseekerID) throws
RuntimeException, URISyntaxException {
//Get access token from Auth. Server
......@@ -272,8 +272,8 @@ public class HttpUtils {
authParams.put("client_id", authClientId);
authParams.put("client_secret", authClientSecret);
authParams.put("grant_type", authGrantType);
authParams.put("username", username);
authParams.put("password", password);
/*authParams.put("username", username);
authParams.put("password", password);*/
......@@ -288,16 +288,14 @@ public class HttpUtils {
OkHttpClient client = new OkHttpClient();
try {
HttpUrl.Builder httpBuilder = HttpUrl.parse(address).newBuilder();
/* if (params != null) {
for(Map.Entry<String, String> param : params.entrySet()) {
httpBuilder.addQueryParameter(param.getKey(),param.getValue());
}
}
RequestBody body = RequestBody.create(jsonData, MediaType.parse("application/json"));*/
String jsonData="{\"dataseekerID\":" +sDataseekerID+"}";
RequestBody body = RequestBody.create(jsonData, MediaType.parse("application/json"));
Request request = new Request.Builder()
.url(httpBuilder.build())
.addHeader("Authorization", "Bearer " + accessToken)
// .post(body)
.post(body)
.build();
Response response = client.newCall(request).execute();
......
......@@ -12,8 +12,12 @@ springdoc.swagger-ui.path=/swagger-ui.html
datavaults.api.url=https://platform.datavaults.eu/api/v1/group
datavaults.auth.server.url=https://datavaults-auth.euprojects.net/auth/realms/platform/protocol/openid-connect/token
datavaults.auth.client.id=backend-service
datavaults.auth.client.secret=04892d79-f600-4410-a9ac-6860aa5bdf3e
datavaults.auth.grant.type=password
#datavaults.auth.client.id=backend-service
#datavaults.auth.client.secret=04892d79-f600-4410-a9ac-6860aa5bdf3e
#datavaults.auth.grant.type=password
#datavaults.auth.username=trainer
datavaults.auth.password=3
\ No newline at end of file
#datavaults.auth.password=3
datavaults.auth.grant.type=client_credentials
datavaults.auth.client.id=organizations_client
datavaults.auth.client.secret=45282a40-a18b-4981-8680-78950b6940d3
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment