added validations

This commit is contained in:
harish
2024-10-20 12:07:36 +05:30
parent 13ddfeaabf
commit dffb17bb4c
8 changed files with 40 additions and 54 deletions

View File

@@ -123,9 +123,9 @@ public class SamlSuccessHandler implements AuthenticationSuccessHandler {
}
}
public void validateToken(String token, String codiceFiscale) {
public void validateToken(String token, String codiceFiscale, String hubUuid) {
SamlResponseEntity samlResponseLogEntity = samlResponseLogRepository.findByToken(token);
if (samlResponseLogEntity == null) {
if (samlResponseLogEntity == null || Boolean.FALSE.equals(hubUuid.equals(samlResponseLogEntity.getHubUuid()))) {
throw new CustomValidationException(Status.VALIDATION_ERROR,
Translator.toLocale(GepafinConstant.INVALID_TOKEN_MSG));
}
@@ -136,7 +136,6 @@ public class SamlSuccessHandler implements AuthenticationSuccessHandler {
throw new CustomValidationException(Status.VALIDATION_ERROR,
Translator.toLocale(GepafinConstant.INVALID_TOKEN_MSG));
}
samlResponseLogRepository.delete(samlResponseLogEntity);
}
}