internal SSOService(ITokenProviderFactory factory, SSOTargetSettings targetSettings) { settings = targetSettings.ThrowIfNull(nameof(settings)); settings.AppName.ThrowIfNullOrEmpty(nameof(settings.AppName)); settings.AuthenticationUrlTemplate.ThrowIfNullOrEmpty(nameof(settings.AuthenticationUrlTemplate)); settings.TokenProviderSettings.ThrowIfNull(nameof(settings.TokenProviderSettings)); tokenProvider = factory.Create(settings.TokenProviderSettings); }
public SecureWebApiConfiguration(ITokenProviderFactory tokenProviderFactory) { if (this.TokenProviderType == null) { throw new ArgumentNullException("TokenProviderType"); } try { this.TokenProvider = tokenProviderFactory.Create(this.TokenProviderType); } catch (Exception ex) { throw new Exception(String.Format("Failed to create token provider of type '{0}'", this.TokenProviderType.FullName), ex); } }