git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/authorization-common-client@164543 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b8a9f6c610
commit
63f585888e
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-client</artifactId>
|
||||
<version>2.0.1-SNAPSHOT</version>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<name>authorization service client library</name>
|
||||
|
||||
<parent>
|
||||
|
|
|
@ -50,6 +50,6 @@ public interface AuthorizationProxy {
|
|||
|
||||
Map<String, String> retrieveExternalServiceGenerated() throws Exception;
|
||||
|
||||
void removeAllReleatedToken(UserInfo client, String context) throws Exception;
|
||||
void removeAllReleatedToken(String clientId, String context) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.common.authorization.client.proxy;
|
||||
|
||||
import static org.gcube.common.authorization.client.Constants.CONTEXT_PARAM;
|
||||
import static org.gcube.common.authorization.client.Constants.CLIENT_ID_PARAM;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
|
@ -186,25 +187,20 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void removeAllReleatedToken(UserInfo client, String context) throws Exception{
|
||||
public void removeAllReleatedToken(String clientId, String context) throws Exception{
|
||||
String methodPath = "/token/user";
|
||||
int infrastructureHash = Utils.getInfrastructureHashfromContext(context);
|
||||
StringBuilder callUrl = new StringBuilder(getInternalEnpoint(infrastructureHash)).append(methodPath).append("?")
|
||||
.append(CONTEXT_PARAM).append("=").append(context);
|
||||
.append(CONTEXT_PARAM).append("=").append(context).append("&").append(CLIENT_ID_PARAM).append("=").append(clientId);
|
||||
|
||||
URL url = new URL(callUrl.toString());
|
||||
HttpURLConnection connection = makeRequest(url, "DELETE", false);
|
||||
connection.setDoOutput(true);
|
||||
//connection.setDoOutput(false);
|
||||
connection.setDoInput(true);
|
||||
connection.setRequestProperty("Content-type", "application/xml");
|
||||
|
||||
try(OutputStream os = new BufferedOutputStream(connection.getOutputStream())){
|
||||
Binder.getContext().createMarshaller().marshal(client, os);
|
||||
}
|
||||
|
||||
log.debug("response code for "+callUrl.toString()+" is "+connection.getResponseCode()+" "+connection.getResponseMessage());
|
||||
|
||||
if (connection.getResponseCode()!=200) throw new Exception("error contacting authorization service");
|
||||
if (connection.getResponseCode()!=200 && connection.getResponseCode()!=204) throw new Exception("error contacting authorization service");
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue