public IdentityServerOptionsService(
            string adminUsername,
            string adminPassword,
            string identityManagerUri,
            string identityAdminUri,
            string identityServerUri,
            IUserService userService,
            ExternalIdentityProviderService externalIdentityProviderService)
        {
            if (string.IsNullOrWhiteSpace(adminUsername))
            {
                throw new ArgumentNullException("adminUsername");
            }

            if (string.IsNullOrWhiteSpace(adminPassword))
            {
                throw new ArgumentNullException("adminPassword");
            }

            if (string.IsNullOrWhiteSpace(identityManagerUri))
            {
                throw new ArgumentNullException("identityManagerUri");
            }

            if (string.IsNullOrWhiteSpace(identityAdminUri))
            {
                throw new ArgumentNullException("identityAdminUri");
            }

            if (string.IsNullOrWhiteSpace(identityServerUri))
            {
                throw new ArgumentNullException(nameof(identityServerUri));
            }

            if (userService == null)
            {
                throw new ArgumentNullException(nameof(userService));
            }

            if (externalIdentityProviderService == null)
            {
                throw new ArgumentNullException(nameof(externalIdentityProviderService));
            }

            this.adminUsername = adminUsername;
            this.adminPassword = adminPassword;
            this.identityManagerUri = identityManagerUri;
            this.identityAdminUri = identityAdminUri;
            this.identityServerUri = identityServerUri;
            this.userService = userService;
            this.externalIdentityProviderService = externalIdentityProviderService;
        }
        public IdentityServerBootstrapper(IUserService userService,
            ExternalIdentityProviderService externalIdentityProviderService,
            IConfigurationService configService)
        {
            if (userService == null)
            {
                throw new ArgumentNullException(nameof(userService));
            }

            if (externalIdentityProviderService == null)
            {
                throw new ArgumentNullException(nameof(externalIdentityProviderService));
            }

            if (configService == null)
            {
                throw new ArgumentNullException(nameof(configService));
            }

            this.userService = userService;
            this.externalIdentityProviderService = externalIdentityProviderService;
            this.configService = configService;
        }
Exemplo n.º 3
0
        private static void RegisterExternalIdentityProviders(IConfigurationService configService, ContainerBuilder builder)
        {
            var externalIdentityProviderService = new ExternalIdentityProviderService()
                .WithGoogleAuthentication(configService.GetSetting("externalProviders:google:clientId", string.Empty), configService.GetSetting("externalProviders:google:clientSecret", string.Empty))
                .WithFacebookAuthentication(configService.GetSetting("externalProviders:facebook:clientId", string.Empty), configService.GetSetting("externalProviders:facebook:clientSecret", string.Empty))
                .WithTwitterAuthentication(configService.GetSetting("externalProviders:twitter:clientId", string.Empty), configService.GetSetting("externalProviders:twitter:clientSecret", string.Empty));

            builder.Register(ctx => externalIdentityProviderService);
        }