Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 1394b475 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Fix error message for expired certificates

parent 71311416
Branches EDELIVERY-11518-adoptiumopenjdk-for-dockers
No related tags found
No related merge requests found
import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild,} from '@angular/core';
import {Component, ElementRef, EventEmitter, Input, Output, ViewChild,} from '@angular/core';
import {DomainRo} from "../../../common/model/domain-ro.model";
import {AbstractControl, FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms";
import {AdminDomainService} from "../admin-domain.service";
......
......@@ -181,6 +181,7 @@ public class UIUserService extends UIServiceBase<DBUser, UserRO> {
throw new SMPRuntimeException(ErrorCode.INVALID_REQUEST, "CertificateCredentials", "Certificate is not given for certificate credential!");
}
DBCredential dbCredential = conversionService.convert(credential, DBCredential.class);
dbCredential.setCredentialType(CredentialType.CERTIFICATE);
dbCredential.setCredentialTarget(CredentialTargetType.REST_API);
......@@ -197,8 +198,9 @@ public class UIUserService extends UIServiceBase<DBUser, UserRO> {
dbCredential.setCertificate(dbCertificate);
credentialDao.persistFlushDetach(dbCredential);
CredentialRO result = conversionService.convert(dbCredential, CredentialRO.class);
CertificateRO resultCertificate = conversionService.convert(dbCredential.getCertificate(), CertificateRO.class);
CertificateRO resultCertificate = truststoreService.getCertificateData(dbCertificate.getPemEncoding(), true, false);
result.setCertificate(resultCertificate);
result.setStatus(EntityROStatus.NEW.getStatusNumber());
return result;
......@@ -453,6 +455,7 @@ public class UIUserService extends UIServiceBase<DBUser, UserRO> {
credentialDao.remove(credential);
CredentialRO credentialRO = conversionService.convert(credential, CredentialRO.class);
credentialRO.setStatus(EntityROStatus.REMOVE.getStatusNumber());
return credentialRO;
}
......
......@@ -146,8 +146,11 @@ public class UserController {
Long accessTokenId = decryptEntityId(encAccessTokenId);
// delete user credential
return uiUserService.deleteUserCredentials(userId,
CredentialRO result = uiUserService.deleteUserCredentials(userId,
accessTokenId, CredentialType.ACCESS_TOKEN, CredentialTargetType.REST_API);
// set the same encrypted id so that UI can locate and update it
result.setCredentialId(encAccessTokenId);
return result;
}
@PreAuthorize("@smpAuthorizationService.isCurrentlyLoggedIn(#encUserId)")
......@@ -160,11 +163,14 @@ public class UserController {
Long accessTokenId = decryptEntityId(encAccessTokenId);
// delete user credential
return uiUserService.updateUserCredentials(userId,
CredentialRO result = uiUserService.updateUserCredentials(userId,
accessTokenId,
CredentialType.ACCESS_TOKEN,
CredentialTargetType.REST_API,
credentialRO);
// set the same encrypted credential id so that UI can remove it from the list
result.setCredentialId(encAccessTokenId);
return result;
}
@PreAuthorize("@smpAuthorizationService.isCurrentlyLoggedIn(#encUserId)")
......@@ -195,8 +201,11 @@ public class UserController {
Long userId = decryptEntityId(encUserId);
Long credentialId = decryptEntityId(encCredentialId);
// delete user credential
return uiUserService.deleteUserCredentials(userId,
CredentialRO result = uiUserService.deleteUserCredentials(userId,
credentialId, CredentialType.CERTIFICATE, CredentialTargetType.REST_API);
// set the same encrypted credential id so that UI can remove it from the list
result.setCredentialId(encCredentialId);
return result;
}
@PreAuthorize("@smpAuthorizationService.isCurrentlyLoggedIn(#encUserId)")
......@@ -208,11 +217,14 @@ public class UserController {
Long userId = decryptEntityId(encUserId);
Long credentialId = decryptEntityId(encCredentialId);
// delete user credential
return uiUserService.updateUserCredentials(userId,
CredentialRO result = uiUserService.updateUserCredentials(userId,
credentialId,
CredentialType.CERTIFICATE,
CredentialTargetType.REST_API,
credentialRO);
// set the same encrypted credential id so that UI can update it
result.setCredentialId(encCredentialId);
return result;
}
@PreAuthorize("@smpAuthorizationService.isCurrentlyLoggedIn(#encUserId)")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment