SUPPORT-8407: Fix

This commit is contained in:
Eduard Tihomirov 2024-08-07 13:30:54 +03:00
parent 146d638631
commit 08f6639c73
5 changed files with 25 additions and 20 deletions

View file

@ -34,7 +34,9 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
"component.addresses",
"gen",
"ru.cg",
"ru.micord"
"ru.micord",
"crypto",
"esia"
}, excludeFilters = {
@ComponentScan.Filter(type = FilterType.REGEX, pattern = "security.WebSecurityConfig")
})

View file

@ -42,7 +42,7 @@ public class EsiaConfig {
public String getEsiaOrgScope() {
// return String.join(" ", esiaOrgScopes);
return "http://esia.gosuslugi.ru/org_fullname http://esia.gosuslugi.ru/org_brhs http://esia.gosuslugi.ru/org_brhs_ctts http://esia.gosuslugi.ru/org_brhs_addrs http://esia.gosuslugi.ru/org_emps";
return "http://esia.gosuslugi.ru/org_fullname http://esia.gosuslugi.ru/org_brhs http://esia.gosuslugi.ru/org_brhs_ctts http://esia.gosuslugi.ru/org_brhs_addrs http://esia.gosuslugi.ru/org_emps http://esia.gosuslugi.ru/org_emps http://esia.gosuslugi.ru/org_type http://esia.gosuslugi.ru/org_ogrn";
}
public String getEsiaScope() {
@ -61,6 +61,6 @@ public class EsiaConfig {
}
public String getEsiaBaseUri() {
return esiaBaseUri;
return "https://esia-portal1.test.gosuslugi.ru/";
}
}

View file

@ -14,15 +14,15 @@ public class OrganizationModel implements Serializable {
private static final long serialVersionUID = 1L;
private String orgOid;
private String oid;
private String fullName;
private String shortName;
private String orgType;
private String type;
private String orgTypeName;
private String typeName;
private String inn;
@ -48,12 +48,12 @@ public class OrganizationModel implements Serializable {
private List<BrhsModel> brhsModels;
public String getOrgOid() {
return orgOid;
public String getOid() {
return oid;
}
public void setOrgOid(String orgOid) {
this.orgOid = orgOid;
public void setOid(String oid) {
this.oid = oid;
}
public String getFullName() {
@ -144,20 +144,20 @@ public class OrganizationModel implements Serializable {
this.email = email;
}
public String getOrgType() {
return orgType;
public String getType() {
return type;
}
public void setOrgType(String orgType) {
this.orgType = orgType;
public void setType(String type) {
this.type = type;
}
public String getOrgTypeName() {
return orgTypeName;
public String getTypeName() {
return typeName;
}
public void setOrgTypeName(String orgTypeName) {
this.orgTypeName = orgTypeName;
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public Long getStaffCount() {

View file

@ -85,7 +85,6 @@ public class EsiaAuthService {
"client_secret", clientSecret,
"response_type", responseType,
"redirect_uri", redirectUrlEncoded,
"obj_type", "L B F",
"client_certificate_hash", CLIENT_CERTIFICATE_HASH);
return makeRequest(url, params);
@ -178,6 +177,7 @@ public class EsiaAuthService {
cookie.setHttpOnly(true);
cookie.setSecure(true);
cookie.setPath("/");
response.addCookie(cookie);
String refreshToken = tokenResponse.getRefresh_token();
Cookie cookieRefresh = new Cookie("refresh_token", refreshToken);
@ -262,6 +262,7 @@ public class EsiaAuthService {
cookie.setHttpOnly(true);
cookie.setSecure(true);
cookie.setPath("/");
response.addCookie(cookie);
String newRefreshToken = tokenResponse.getRefresh_token();
Cookie cookieRefresh = new Cookie("refresh_token", newRefreshToken);

View file

@ -106,7 +106,9 @@ public class UlDataServiceImpl implements UlDataService {
try {
byte[] decodedBytes = Base64.getDecoder()
.decode(
accessToken.substring(accessToken.indexOf('.') + 1, accessToken.lastIndexOf('.')));
accessToken.substring(accessToken.indexOf('.') + 1, accessToken.lastIndexOf('.'))
.replace('-', '+')
.replace('_', '/'));
String decodedString = new String(decodedBytes);
EsiaAccessToken esiaAccessToken = objectMapper.readValue(decodedString,
EsiaAccessToken.class