Setting ExternalServiceInfo when application
This commit is contained in:
parent
0286521cfe
commit
4617573a26
|
@ -14,6 +14,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
||||
import org.gcube.common.authorization.library.provider.ClientInfo;
|
||||
import org.gcube.common.authorization.library.provider.ExternalServiceInfo;
|
||||
import org.gcube.common.authorization.library.provider.UserInfo;
|
||||
import org.gcube.common.authorization.library.utils.Caller;
|
||||
import org.gcube.common.authorization.utils.clientid.RenewalProvider;
|
||||
|
@ -131,7 +132,11 @@ public class JWTSecret extends Secret {
|
|||
public ClientInfo getClientInfo() throws Exception {
|
||||
if(clientInfo==null) {
|
||||
User user = getUser();
|
||||
clientInfo = new UserInfo(user.getUsername(), new ArrayList<>(user.getRoles()), user.getEmail(), user.getGivenName(), user.getFamilyName());
|
||||
if(user.isApplication()) {
|
||||
clientInfo = new ExternalServiceInfo(user.getUsername(), "UNKNOWN");
|
||||
}else {
|
||||
clientInfo = new UserInfo(user.getUsername(), new ArrayList<>(user.getRoles()), user.getEmail(), user.getGivenName(), user.getFamilyName());
|
||||
}
|
||||
}
|
||||
return clientInfo;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue