public OAuthTokenService(IHttpClientGovernor httpClientGovernor, string clientId, string clientSecret, string scope, string tokenEndpoint) { if (httpClientGovernor == null) { throw new ArgumentException("httpClientGovernor"); } if (string.IsNullOrWhiteSpace(clientId)) { throw new ArgumentException("clientId"); } if (string.IsNullOrWhiteSpace(clientSecret)) { throw new ArgumentException("clientSecret"); } if (string.IsNullOrWhiteSpace(scope)) { throw new ArgumentException("scope"); } if (string.IsNullOrWhiteSpace(tokenEndpoint)) { throw new ArgumentException("tokenEndpoint"); } _httpClientGovernor = httpClientGovernor; _clientId = clientId; _clientSecret = clientSecret; _scope = scope; _tokenEndpoint = tokenEndpoint; }
static HomeController() { // This stuff should come from config and get set up // as part of the app start-up (IoC config, etc...) _httpClientGovernor = new HttpClientGovernor(); var clientId = @"362b88659454lt0g8b3ontlr7e"; var clientSecret = @""; // Ask me for this. var scope = @"Default/STS"; var tokenEndpoint = @"https://95be0fd7-c5a6-4581-967e-27a82f7abdc1.auth.us-east-1.amazoncognito.com/oauth2/token"; _oAuthTokenService = new CachingOAuthTokenServiceDecorator( new ReliableOAuthTokenServiceDecorator( new OAuthTokenService(_httpClientGovernor, clientId, clientSecret, scope, tokenEndpoint))); }