use of eu.cryptoeuro.accountmapper.error.LdapNotFoundException in project account-identity by cryptofiat.
the class LdapController method checkIdCode.
@RequestMapping(method = RequestMethod.GET, value = "/{idCode}")
public ResponseEntity<LdapResponse> checkIdCode(@PathVariable("idCode") long idCode) {
LdapResponse lr = ldapService.lookupIdCode(idCode);
// should check if didn't return, then respond with 404
if (lr != null && lr.getIdCode() > 0) {
HttpHeaders headers = new HttpHeaders();
headers.setCacheControl("max-age=3600");
return new ResponseEntity<LdapResponse>(lr, headers, HttpStatus.OK);
} else {
throw new LdapNotFoundException();
}
}
use of eu.cryptoeuro.accountmapper.error.LdapNotFoundException in project account-identity by cryptofiat.
the class EscrowController method getEscrow.
@RequestMapping(method = RequestMethod.GET, value = "/{idCode}")
public ResponseEntity<AccountActivationResponse> getEscrow(@PathVariable("idCode") @Valid long idCode) throws IOException {
if (accountService.hasActivatedAccount(idCode)) {
throw new HasActiveAccountException();
}
;
if (ldapService.lookupIdCode(idCode) == null) {
throw new LdapNotFoundException();
}
;
EthereumAccount account;
account = escrowService.approveEscrowAccountForId(idCode);
AccountActivationResponse aaResponse = AccountActivationResponse.builder().authenticationStatus(AuthenticationStatus.LOGIN_SUCCESS.name()).ownerId(account.getOwnerId()).address(account.getAddress()).transactionHash(account.getTransactionHash()).build();
return new ResponseEntity<AccountActivationResponse>(aaResponse, HttpStatus.OK);
}
Aggregations