SUPPORT-8817: fix for review (1)
This commit is contained in:
parent
08c1555e4e
commit
0b29dea6a2
3 changed files with 44 additions and 13 deletions
|
|
@ -56,9 +56,9 @@ public class ExtractController {
|
|||
).get();
|
||||
}
|
||||
else {
|
||||
String userAccountId = SecurityUtil.getUserId();
|
||||
if (userAccountId != null) {
|
||||
String esiaAccessToken = EsiaTokensStore.getAccessToken(userAccountId);
|
||||
String esiaUserId = SecurityUtil.getUserIdsPair().getEsiaUserId();
|
||||
if (esiaUserId != null) {
|
||||
String esiaAccessToken = EsiaTokensStore.getAccessToken(esiaUserId);
|
||||
PersonModel personModel = personalDataService.getPersonModel(esiaAccessToken);
|
||||
|
||||
ExtractEmptyRequestDto emptyRequest = new ExtractEmptyRequestDto(personModel.getLastName(),
|
||||
|
|
|
|||
|
|
@ -25,19 +25,11 @@ public final class SecurityUtil {
|
|||
}
|
||||
|
||||
public static String getErvuId() {
|
||||
return getUserAccountIdPart(1);
|
||||
}
|
||||
|
||||
public static String getUserId() {
|
||||
return getUserAccountIdPart(0);
|
||||
}
|
||||
|
||||
private static String getUserAccountIdPart(int index) {
|
||||
return Optional.ofNullable(SecurityContextHolder.getContext().getAuthentication())
|
||||
.map(a -> ((JwtAuthentication) a).getUserAccountId())
|
||||
.map(userAccountId -> {
|
||||
String userAccountIdPart = userAccountId.split(":")[index];
|
||||
return "null".equals(userAccountIdPart) ? null : userAccountIdPart;
|
||||
String ervuId = userAccountId.split(":")[1];
|
||||
return "null".equals(ervuId) ? null : ervuId;
|
||||
})
|
||||
.orElse(null);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue