legacy compatibility
This commit is contained in:
parent
2efb5d0d36
commit
43ad32af03
|
@ -1,9 +1,15 @@
|
|||
package org.gcube.data.transfer.library.utils;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
|
||||
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class ScopeUtils {
|
||||
|
||||
public static String getCurrentScope(){
|
||||
|
@ -12,6 +18,19 @@ public class ScopeUtils {
|
|||
|
||||
|
||||
public static String getCurrentCaller(){
|
||||
return AuthorizationProvider.instance.get().getClient().getId();
|
||||
try{
|
||||
return AuthorizationProvider.instance.get().getClient().getId();
|
||||
}catch(Throwable e ){
|
||||
try {
|
||||
log.warn("Unable to get Client ID from UMA , checking gcube-token.. ",e);
|
||||
String token=SecurityTokenProvider.instance.get();
|
||||
return authorizationService().get(token).getClientInfo().getId();
|
||||
}catch(Throwable e1 ){
|
||||
log.warn("Unable to resolve gcube-token ",e1);
|
||||
return "Unidentified data-transfer user";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue