fixes issue [#23075]
This commit is contained in:
parent
64d0c69ca2
commit
72a5e54edd
|
@ -2,6 +2,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
# Changelog for Common Smartgears
|
# Changelog for Common Smartgears
|
||||||
|
|
||||||
|
## [v3.1.4] - 2022-03-29
|
||||||
|
|
||||||
|
- fixes issue [#23075]
|
||||||
|
|
||||||
## [v3.1.3] - 2022-03-21
|
## [v3.1.3] - 2022-03-21
|
||||||
|
|
||||||
- fixed bug on policies
|
- fixed bug on policies
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>common-smartgears</artifactId>
|
<artifactId>common-smartgears</artifactId>
|
||||||
<version>3.1.3</version>
|
<version>3.1.4</version>
|
||||||
<name>SmartGears</name>
|
<name>SmartGears</name>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
|
|
@ -15,6 +15,8 @@ import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
||||||
import org.gcube.common.authorization.library.AuthorizationEntry;
|
import org.gcube.common.authorization.library.AuthorizationEntry;
|
||||||
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
||||||
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
||||||
|
import org.gcube.common.authorization.library.provider.ClientInfo;
|
||||||
|
import org.gcube.common.authorization.library.provider.ExternalServiceInfo;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.authorization.library.provider.UserInfo;
|
import org.gcube.common.authorization.library.provider.UserInfo;
|
||||||
import org.gcube.common.authorization.library.utils.Caller;
|
import org.gcube.common.authorization.library.utils.Caller;
|
||||||
|
@ -140,7 +142,14 @@ public class RequestContextRetriever extends RequestHandler {
|
||||||
internal_server_error.fire("invalid context in access token");
|
internal_server_error.fire("invalid context in access token");
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthorizationProvider.instance.set(new Caller(new UserInfo(jwt.getUsername(), jwt.getRoles(), jwt.getEmail(), jwt.getFirstName(), jwt.getLastName()), "token"));
|
ClientInfo clientInfo;
|
||||||
|
if (!jwt.isExternalService())
|
||||||
|
clientInfo = new UserInfo(jwt.getUsername(), jwt.getRoles(), jwt.getEmail(), jwt.getFirstName(), jwt.getLastName());
|
||||||
|
else
|
||||||
|
clientInfo = new ExternalServiceInfo(jwt.getUsername(), "unknown");
|
||||||
|
|
||||||
|
log.info("caller type is {}",clientInfo.getType());
|
||||||
|
AuthorizationProvider.instance.set(new Caller(clientInfo, "token"));
|
||||||
|
|
||||||
ScopeProvider.instance.set(scopeBean.toString());
|
ScopeProvider.instance.set(scopeBean.toString());
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,9 @@ public class GcubeJwt {
|
||||||
@JsonProperty("family_name")
|
@JsonProperty("family_name")
|
||||||
private String lastName;
|
private String lastName;
|
||||||
|
|
||||||
|
@JsonProperty("clientId")
|
||||||
|
private String clientId;
|
||||||
|
|
||||||
@JsonProperty("email")
|
@JsonProperty("email")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
@ -51,6 +54,10 @@ public class GcubeJwt {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isExternalService() {
|
||||||
|
return clientId != null;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFirstName() {
|
public String getFirstName() {
|
||||||
return firstName;
|
return firstName;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue