/// <summary> /// Constructor for SSO class. /// </summary> /// <param name="callbackUri">The Callback URL that you provided in your ESI application. If this doesn't match with what ESI has then SSO auth will fail.</param> /// <param name="clientId">The Client Id you were assigned in your ESI application.</param> /// <param name="secretKey">The Secret Key you were assigned in your ESI application, this should NEVER be human-readable in your application.</param> /// <param name="dataSource"></param> /// <exception cref="EVEStandardException" >Called when any of the parameters is null or empty.</exception> /// <remarks> /// Except for public data within ESI, you need an application to gain access behind SSO. You can create an application at <see> /// <cref>https://developers.eveonline.com/</cref> /// </see> /// You will probably want to create at least two applications, one for local development and one for production since the <paramref name="callbackUri"/> requires to match in the callback. /// </remarks> internal SSOv2(string callbackUri, string clientId, string secretKey, DataSource dataSource, SSOMode ssoMode) { if (string.IsNullOrEmpty(callbackUri) || string.IsNullOrEmpty(clientId)) { throw new EVEStandardException("SSO should be initialized with non-null and non-empty strings. callbackUri: " + callbackUri + " clientId: " + clientId + " secretKey: " + secretKey); } if (string.IsNullOrEmpty(secretKey) && ssoMode != SSOMode.Native) { throw new EVEStandardException("SSO should be initialized with non-null and non-empty secretKey."); } CallbackUri = callbackUri; ClientId = clientId; SecretKey = secretKey; SsoMode = ssoMode; this.dataSource = dataSource; }
/// <inheritdoc /> /// <summary> /// Initialize the EVE Standard Library with Single Sign On support. /// </summary> /// <param name="userAgent"></param> /// <param name="dataSource"></param> /// <param name="timeOut"></param> /// <param name="callbackUri"></param> /// <param name="clientId"></param> /// <param name="secretKey"></param> public EVEStandardAPI(string userAgent, DataSource dataSource, TimeSpan timeOut, string callbackUri, string clientId, string secretKey, SSOVersion ssoVersion = SSOVersion.v1, SSOMode ssoMode = SSOMode.Web) : this(userAgent, dataSource, timeOut) { if (ssoVersion == SSOVersion.v1) { SSO.HTTP = http; SSO = new SSO(callbackUri, clientId, secretKey, dataSource); } else { SSOv2.HTTP = http; SSOv2 = new SSOv2(callbackUri, clientId, secretKey, dataSource, ssoMode); } }