• 1000 служба учетных данных клиента:
@service
public class MongoClientDetailsService implements ClientDetailsService {
private static final Logger logger = LogManager.getLogger(MongoClientDetailsService.class);
@Autowired
private IClientCredentialsRepository clientCredentialsRepo;
public MongoClientDetailsService() {
}
@Override
public ClientDetails loadClientByClientId(String clientId)
throws ClientRegistrationException {
try {
Optional<ClientCredentials> retVal = clientCredentialsRepo.findByClientId(clientId);
if (!retVal.isPresent()) {
logger.error(new LocalizedMessage(ResourceBundle.getBundle(Consts.LOGGING_MSG),
"client-not-found-in-db", clientId));
throw new InvalidGrantException("user is not present.");
}
return createClient();
} catch (MongoException e) {
logger.error(new LocalizedMessage(ResourceBundle.getBundle(Consts.LOGGING_MSG),
"exception-on-load-client", clientId, e.fillInStackTrace()));
throw new ClientRegistrationException("Error on loading client");
}
}
}