diff --git a/backend/src/main/java/ru/micord/ervu/security/esia/service/EsiaAuthService.java b/backend/src/main/java/ru/micord/ervu/security/esia/service/EsiaAuthService.java index 9db721d2..a70c5ba5 100644 --- a/backend/src/main/java/ru/micord/ervu/security/esia/service/EsiaAuthService.java +++ b/backend/src/main/java/ru/micord/ervu/security/esia/service/EsiaAuthService.java @@ -280,7 +280,7 @@ public class EsiaAuthService { Thread.currentThread().getId(), timeSignSecret, timeRequestAccessToken, timeVerifySecret); } OrgInfo orgInfo = null; - String status = null, ervuId = null; + String status = null; try { orgInfo = getOrgInfo(esiaAccessTokenStr); hasRole = ulDataService.checkRole(esiaAccessTokenStr); @@ -289,8 +289,9 @@ public class EsiaAuthService { LOGGER.error("The user with id = " + prnOid + " does not have the required role"); throw new LocalizedException("access_denied", MESSAGE_SOURCE); } - ervuId = getErvuId(prnOid, orgInfo); + String ervuId = getErvuId(prnOid, orgInfo); status = AuditConstants.SUCCESS_STATUS_TYPE; + createTokenAndAddCookie(response, prnOid, ervuId, hasRole, fileUploadAllowed, expiresIn); } catch (JsonProcessingException e) { throw new EsiaException(e); @@ -303,7 +304,6 @@ public class EsiaAuthService { auditService.processAuthEvent(request, orgInfo, prnOid, status, AuditConstants.LOGIN_EVENT_TYPE); } - createTokenAndAddCookie(response, prnOid, ervuId, hasRole, fileUploadAllowed, expiresIn); } }