git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/authorization-common-client@164505 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b4c40c4507
commit
b8a9f6c610
|
@ -22,11 +22,7 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
|
|
@ -50,4 +50,6 @@ public interface AuthorizationProxy {
|
||||||
|
|
||||||
Map<String, String> retrieveExternalServiceGenerated() throws Exception;
|
Map<String, String> retrieveExternalServiceGenerated() throws Exception;
|
||||||
|
|
||||||
|
void removeAllReleatedToken(UserInfo client, String context) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,6 +185,28 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
|
||||||
return Utils.addInfrastructureHashToToken(token, infrastructureHash);
|
return Utils.addInfrastructureHashToToken(token, infrastructureHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeAllReleatedToken(UserInfo client, 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);
|
||||||
|
|
||||||
|
URL url = new URL(callUrl.toString());
|
||||||
|
HttpURLConnection connection = makeRequest(url, "DELETE", false);
|
||||||
|
connection.setDoOutput(true);
|
||||||
|
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");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String generateApiKey(String apiQualifier) throws Exception {
|
public String generateApiKey(String apiQualifier) throws Exception {
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class Utils {
|
||||||
String realToken = matcher.group(1);
|
String realToken = matcher.group(1);
|
||||||
return realToken;
|
return realToken;
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
throw new RuntimeException("token required for this method", e);
|
throw new RuntimeException("valid token required for this method", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue