public BasicAuthentication(IAuthenticationSession session, IPrincipalContext context, IPrincipalBuilder builder, ICredentialsAuthenticator authenticator)
 {
     _session = session;
     _context = context;
     _builder = builder;
     _authenticator = authenticator;
 }
Esempio n. 2
0
        public override async Task ExecuteAsync(CancellationToken cancellationToken)
        {
            if (!_auth.TryGetValue(Mechanism, out Lazy <IAuthenticationSession, AuthencticationMechanismMetadata> mechanism))
            {
                await EndWithResultAsync(_channel, CommandResult.No, "unknown mechanism", cancellationToken);

                return;
            }

            if (mechanism.Metadata.RequiresEncryption)
            {
                if (_channel.State != SessionState.NotAuthenticated)
                {
                    await EndWithResultAsync(_channel, CommandResult.Bad, "AUTHENTCATE not valid at this time", cancellationToken);

                    return;
                }
            }
            else
            {
                if (_channel.State != SessionState.Open && _channel.State != SessionState.NotAuthenticated)
                {
                    await EndWithResultAsync(_channel, CommandResult.Bad, "AUTHENTCATE not valid at this time", cancellationToken);

                    return;
                }
            }

            IAuthenticationSession authSession = mechanism.Value;

            UserData userData;

            try
            {
                userData = await authSession.AuthenticateAsync(false, cancellationToken);
            }
            catch (ArgumentException)
            {
                await EndWithResultAsync(_channel, CommandResult.Bad, "invalid arguments", cancellationToken);

                return;
            }

            if (userData == null)
            {
                await EndWithResultAsync(_channel, CommandResult.No, "credentials rejected", cancellationToken);

                return;
            }

            _channel.AuthenticatedUser = userData;

            await
            EndWithResultAsync(
                _channel,
                CommandResult.Ok,
                $"{Mechanism} authenticate completed, now in authenticated state",
                cancellationToken);
        }
Esempio n. 3
0
 public BasicAuthentication(IAuthenticationSession session, IPrincipalContext context, IPrincipalBuilder builder, ICredentialsAuthenticator authenticator, ILockedOutRule lockedOutRule)
 {
     _session = session;
     _context = context;
     _builder = builder;
     _authenticator = authenticator;
     _lockedOutRule = lockedOutRule;
 }
 public BasicAuthentication(IAuthenticationSession session, IPrincipalContext context, IPrincipalBuilder builder, ICredentialsAuthenticator authenticator, ILockedOutRule lockedOutRule)
 {
     _session       = session;
     _context       = context;
     _builder       = builder;
     _authenticator = authenticator;
     _lockedOutRule = lockedOutRule;
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Backuper"/> class.
 /// </summary>
 /// <param name="unitOfWork">Unit of work.</param>
 /// <param name="authenticationSession">Authentication session.</param>
 /// <param name="settingsService">Setting service.</param>
 public Backuper(
     IUnitOfWork unitOfWork,
     IAuthenticationSession authenticationSession,
     ISettingsService settingsService)
 {
     this.authenticationSession = authenticationSession;
     this.unitOfWork            = unitOfWork;
     this.settingsService       = settingsService;
 }
 public LoginBehavior(ICurrentHttpRequest httpRequest, IAuthenticationService service,
                      IAuthenticationSession session, IFubuRequest request, ILoginSuccessHandler handler)
     : base(PartialBehavior.Ignored)
 {
     _httpRequest = httpRequest;
     _service = service;
     _session = session;
     _request = request;
     _handler = handler;
 }
Esempio n. 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// </summary>
        /// <param name="authenticationSession">Unit of work.</param>
        /// <param name="startupServicesProvider">Startup services provider.</param>
        public MainViewModel(
            IAuthenticationSession authenticationSession,
            IStartupServicesProvider startupServicesProvider)
        {
            Log.Debug("Start resolving main view model.");

#if DEBUG
            authenticationSession.CreateSession("DEBUG USER", 1, true, DateTime.Now);
#endif

            startupServicesProvider.StartServices();

            Log.Debug("Main view model was initialized.");
        }
Esempio n. 8
0
 public SamlDirector(IPrincipalBuilder principalBuilder, IAuthenticationSession session, IPrincipalContext context)
 {
     _principalBuilder = principalBuilder;
     _session = session;
     _context = context;
     _result = new AuthResult
     {
         Success = false,
         Continuation =
             FubuContinuation.RedirectTo(new LoginRequest
             {
                 Message = SamlValidationKeys.UnableToValidationSamlResponse
             }, "GET")
     };
 }
Esempio n. 9
0
 public SamlDirector(IPrincipalBuilder principalBuilder, IAuthenticationSession session, IPrincipalContext context)
 {
     _principalBuilder = principalBuilder;
     _session          = session;
     _context          = context;
     _result           = new AuthResult
     {
         Success      = false,
         Continuation =
             FubuContinuation.RedirectTo(new LoginRequest
         {
             Message = SamlValidationKeys.UnableToValidationSamlResponse
         }, "GET")
     };
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="LoginingDialogViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="authenticationSession">Authentication session.</param>
        /// <param name="viewBuilder">View model builder.</param>
        /// <param name="resourceHandler">Resource handler.</param>
        public LoginingDialogViewModel(
            IUnitOfWork unitOfWork,
            IAuthenticationSession authenticationSession,
            IViewBuilder viewBuilder,
            IResourceHandler resourceHandler)
        {
            this.unitOfWork            = unitOfWork;
            this.authenticationSession = authenticationSession;
            this.viewBuilder           = viewBuilder;
            this.resourceHandler       = resourceHandler;

            this.Model = new LoginModel
            {
                IsFullValidation = false
            };

            this.isLoginEnabled = true;
        }
Esempio n. 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationGroupRepository"/> class.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="authenticationSession">Authentication session.</param>
 public NotificationGroupRepository(dentistEntities entity, IAuthenticationSession authenticationSession) :
     base(entity, authenticationSession)
 {
 }
 public LoginController(IDocumentSession documentSession, IAuthenticationSession authenticationSession)
 {
     _documentSession = documentSession;
     _authenticationSession = authenticationSession;
 }
 public WindowsAuthentication(IAuthenticationSession session, IWindowsPrincipalHandler handler, ILoginAuditor auditor)
 {
     _session = session;
     _handler = handler;
     _auditor = auditor;
 }
Esempio n. 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReminderRepository"/> class.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="authenticationSession">Authentication session.</param>
 public ReminderRepository(dentistEntities entity, IAuthenticationSession authenticationSession) :
     base(entity, authenticationSession)
 {
 }
 public WindowsController(IAuthenticationSession session, IWindowsAuthenticationContext windowsContext, IOutputWriter writer)
 {
     _session = session;
     _windowsContext = windowsContext;
     _writer = writer;
 }
 public LogoutController(IAuthenticationSession session)
 {
     _session = session;
 }
 public OAuth2Callback(IOAuth2Proxy proxy, IAuthenticationSession session, IOAuth2ResponseHandler handlers)
 {
     _proxy = proxy;
     _session = session;
     _handlers = handlers;
 }
Esempio n. 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RepositoryBase"/> class.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="authenticationSession">Authentication session.</param>
 protected RepositoryBase(dentistEntities entity, IAuthenticationSession authenticationSession)
 {
     this.Entities = entity;
     this.AuthenticationSession = authenticationSession;
 }
Esempio n. 19
0
 public LogoutController(IAuthenticationSession session, ILogoutSuccessHandler logoutSuccessHandler)
 {
     _session = session;
     _logoutSuccessHandler = logoutSuccessHandler;
 }
Esempio n. 20
0
 public MembershipAuthentication(IAuthenticationSession session, IPrincipalContext context, IMembershipRepository membership, ILockedOutRule lockedOutRule)
 {
     _membership = membership;
     _inner      = new BasicAuthentication(session, context, this, this, lockedOutRule);
 }
Esempio n. 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LoginRepository"/> class.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="authenticationSession">Authentication session.</param>
 public LoginRepository(dentistEntities entity, IAuthenticationSession authenticationSession) :
     base(entity, authenticationSession)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AppointmentRepository"/> class.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="authenticationSession">Authentication session.</param>
 public AppointmentRepository(dentistEntities entity, IAuthenticationSession authenticationSession)
     : base(entity, authenticationSession)
 {
 }
Esempio n. 23
0
 public WindowsAuthentication(IAuthenticationSession session, IWindowsPrincipalHandler handler, ILoginAuditor auditor)
 {
     _session = session;
     _handler = handler;
     _auditor = auditor;
 }
 public TwitterCallback(ITwitterProxy twitter, IAuthenticationSession session, ITwitterResponseHandler handlers)
 {
     _twitter = twitter;
     _session = session;
     _handlers = handlers;
 }
 public MembershipAuthentication(IAuthenticationSession session, IPrincipalContext context, IMembershipRepository membership, ILockedOutRule lockedOutRule)
 {
     _membership = membership;
     _inner = new BasicAuthentication(session, context, this, this, lockedOutRule);
 }
Esempio n. 26
0
 public LogoutController(IAuthenticationSession session, ILogoutSuccessHandler logoutSuccessHandler)
 {
     _session = session;
     _logoutSuccessHandler = logoutSuccessHandler;
 }
 public OAuth2Callback(IOAuth2Proxy proxy, IAuthenticationSession session, IOAuth2ResponseHandler handlers)
 {
     _proxy    = proxy;
     _session  = session;
     _handlers = handlers;
 }
 public TwitterCallback(ITwitterProxy twitter, IAuthenticationSession session, ITwitterResponseHandler handlers)
 {
     _twitter  = twitter;
     _session  = session;
     _handlers = handlers;
 }