コード例 #1
0
 public AuthenticateController(
     IAuthenticateActions authenticateActions,
     IProfileActions profileActions,
     IDataProtectionProvider dataProtectionProvider,
     IEncoder encoder,
     ITranslationManager translationManager,
     IOpenIdEventSource simpleIdentityServerEventSource,
     IUrlHelperFactory urlHelperFactory,
     IActionContextAccessor actionContextAccessor,
     IEventPublisher eventPublisher,
     IAuthenticationService authenticationService,
     IAuthenticationSchemeProvider authenticationSchemeProvider,
     IUserActions userActions,
     IPayloadSerializer payloadSerializer,
     IConfigurationService configurationService,
     IAuthenticateHelper authenticateHelper,
     IResourceOwnerAuthenticateHelper resourceOwnerAuthenticateHelper,
     ITwoFactorAuthenticationHandler twoFactorAuthenticationHandler,
     BasicAuthenticateOptions basicAuthenticateOptions) : base(authenticateActions, profileActions, dataProtectionProvider, encoder,
                                                               translationManager, simpleIdentityServerEventSource, urlHelperFactory, actionContextAccessor, eventPublisher,
                                                               authenticationService, authenticationSchemeProvider, userActions, payloadSerializer, configurationService,
                                                               authenticateHelper, twoFactorAuthenticationHandler, basicAuthenticateOptions)
 {
     _resourceOwnerAuthenticateHelper = resourceOwnerAuthenticateHelper;
 }
コード例 #2
0
 public BaseAuthenticateController(
     IOpenidAuthenticateResourceOwnerAction openidAuthenticateResourceOwnerAction,
     IProfileActions profileActions,
     IDataProtectionProvider dataProtectionProvider,
     IEncoder encoder,
     ITranslationManager translationManager,
     IOpenIdEventSource simpleIdentityServerEventSource,
     IUrlHelperFactory urlHelperFactory,
     IActionContextAccessor actionContextAccessor,
     IEventPublisher eventPublisher,
     IAuthenticationService authenticationService,
     IAuthenticationSchemeProvider authenticationSchemeProvider,
     IUserActions userActions,
     IPayloadSerializer payloadSerializer,
     IConfigurationService configurationService,
     IAuthenticateHelper authenticateHelper,
     BasicAuthenticateOptions basicAuthenticateOptions) : base(authenticationService)
 {
     _openidAuthenticateResourceOwnerAction = openidAuthenticateResourceOwnerAction;
     _profileActions     = profileActions;
     _dataProtector      = dataProtectionProvider.CreateProtector("Request");
     _encoder            = encoder;
     _translationManager = translationManager;
     _simpleIdentityServerEventSource = simpleIdentityServerEventSource;
     _urlHelper                    = urlHelperFactory.GetUrlHelper(actionContextAccessor.ActionContext);
     _eventPublisher               = eventPublisher;
     _payloadSerializer            = payloadSerializer;
     _authenticationSchemeProvider = authenticationSchemeProvider;
     _userActions                  = userActions;
     _configurationService         = configurationService;
     _authenticateHelper           = authenticateHelper;
     _basicAuthenticateOptions     = basicAuthenticateOptions;
 }
コード例 #3
0
        private BasicAuthenticateOptions GetOptions()
        {
            var result = new BasicAuthenticateOptions();

            if (_properties != null)
            {
                result.ClaimsIncludedInUserCreation = _properties.TryGetArr("ClaimsIncludedInUserCreation");
            }

            return(result);
        }
コード例 #4
0
        public static IServiceCollection AddLoginPasswordAuthentication(this IServiceCollection services, IMvcBuilder mvcBuilder, BasicAuthenticateOptions basicAuthenticateOptions)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

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

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

            var assembly             = typeof(AuthenticateController).Assembly;
            var embeddedFileProvider = new EmbeddedFileProvider(assembly);

            services.Configure <RazorViewEngineOptions>(opts =>
            {
                opts.FileProviders.Add(embeddedFileProvider);
                opts.CompilationCallback = (context) =>
                {
                    var assm            = MetadataReference.CreateFromFile(Assembly.Load("SimpleIdentityServer.Authenticate.Basic").Location);
                    context.Compilation = context.Compilation.AddReferences(assm);
                };
            });
            services.AddSingleton(basicAuthenticateOptions);
            services.AddTransient <IAuthenticateResourceOwnerService, PasswordAuthenticateResourceOwnerService>();
            mvcBuilder.AddApplicationPart(assembly);
            return(services);
        }