package com.eactive.eai.authoutbound.client.impl;

import java.util.Properties;

import com.eactive.eai.authoutbound.OutboundOAuthCredentialVo;
import com.eactive.eai.authoutbound.client.HttpClientAccessTokenServiceByDB;
import com.openbanking.eai.common.token.OAuth2AccessTokenVO;

public class HttpClientAccessTokenServiceWithFixedToken implements HttpClientAccessTokenServiceByDB {
	
	@Override
	public Object execute(String adapterGroupName, Properties adapterProp, OutboundOAuthCredentialVo oAuthCredentialVo)
			throws Exception {
		
		OAuth2AccessTokenVO fixedAccessToken = new OAuth2AccessTokenVO();
			
		fixedAccessToken.setAccessToken(oAuthCredentialVo.getClientSecret());
		fixedAccessToken.setClientId("none");
		fixedAccessToken.setClientUseCode("anyone");
		fixedAccessToken.setExpiresIn(60 * 60 * 24 * 365); //1년
		fixedAccessToken.setScope("none");
		fixedAccessToken.setTokenType("fixed");

		return fixedAccessToken;
	}

}
