package com.moomanow.web.security.openid.service;


import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.mitre.oauth2.model.RegisteredClient;
import org.mitre.openid.connect.client.service.RegisteredClientService;
import org.springframework.beans.factory.annotation.Autowired;

import com.moomanow.core.common.exception.NonRollBackException;
import com.moomanow.core.common.exception.RollBackException;
import com.moomanow.web.security.openid.dao.OpenIdDao;

public class RegisteredClientServiceImpl implements RegisteredClientService {

	private Map<String, RegisteredClient> clients = new ConcurrentHashMap<>();
	@Autowired
	private OpenIdDao openIdDao;
	
	@Override
	public RegisteredClient getByIssuer(String issuer) {
		try {
			RegisteredClient registeredClient =null;
			if(!clients.containsKey(issuer)){
				registeredClient = openIdDao.findByIssuer(issuer);
				if(registeredClient!=null)
				clients.put(issuer, registeredClient);
			}else{
				registeredClient = clients.get(issuer);
			}
			return registeredClient;
		} catch (RollBackException | NonRollBackException e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public void save(String issuer, RegisteredClient client) {
		try {
			openIdDao.saveRegisteredClient(issuer,client);
		} catch (RollBackException | NonRollBackException e) {
			e.printStackTrace();
		}
	}

}

@@ -297,16 +297,78 @@
 towired;
+%0Aimport org.springframework.beans.factory.annotation.Required;
 %0A%0Aimport
@@ -702,37 +702,125 @@
 );%0A%09
-@Autowired%0A%09private O
+private OpenIdDao openIdDao;%0A%09@Autowired%0A%09@Required%0A%09public void setOpenIdDao(OpenIdDao openIdDao) %7B%0A%09%09this.o
 penIdDao
  ope
@@ -807,32 +807,34 @@
 %09%09this.openIdDao
+ =
  openIdDao;%0A%09%0A%09@
@@ -829,16 +829,19 @@
 nIdDao;%0A
+%09%7D%0A
 %09%0A%09@Over

Fix it