/// <summary>
        /// Logs on with specified authentication method.
        /// </summary>
        /// <param name="authentication">The authentication method.</param>
        /// <returns></returns>
        /// <exception cref="System.InvalidOperationException">
        /// Already logged on
        /// or
        /// Another unfinished log on/off request exists.
        /// </exception>
        /// <exception cref="System.Exception">Null user info is not allowed</exception>
        public async Task LogOn(IAuthentication authentication)
        {

            if (UserInfo != null)
            {
                throw new InvalidOperationException("Already logged on");
            }
            if (Interlocked.CompareExchange(ref IsWorking, 1, 0) == 0)
            {
                try
                {
                    var result = await authentication.Authenticate();
                    if (result == null)
                    {
                        throw new Exception("Null user info is not allowed");
                    }
                    UserInfo = result;
                    ServerConnection.AccessToken = UserInfo.AccessToken;
                    return;
                }
                finally
                {
                    Interlocked.CompareExchange(ref IsWorking, 0, 1);
                }
            }
            throw new InvalidOperationException("Another unfinished log on/off request exists.");
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="authentication"></param>
		/// <param name="hasCommentary"></param>
		/// <param name="hasContext"></param>
		public TextClient(IAuthentication authentication, bool hasCommentary, bool hasContext)
			: base(authentication)
		{
			_authentication = authentication;
			HasCommentary = hasCommentary;
			HasContext = hasContext;
		}
 public AuthController(
     ICurrentUser currentUser,
     IAuthentication authentication)
 {
     _currentUser = currentUser;
     _authentication = authentication;
 }
 public BaseController()
 {
     _mail = new MailSandler();
     _repository = DependencyResolver.Current.GetService<IRepository>();
    _mapper = DependencyResolver.Current.GetService<IMapper>();
    _auth = DependencyResolver.Current.GetService<IAuthentication>();
 }
        public BaseController(IDb db, ILogger logger, IAuthentication authentication = null)
        {
            Db = db;
            Logger = logger;

            Authentication = authentication ?? DependencyManager.Authentication;
        }
 public BillingViewModelBuilder(CheckoutDetailsModel checkoutDetailsModel, IAuthentication authentication,ICustomerAccountService accountService, IMappingEngine mapper)
 {
     this.checkoutDetailsModel = checkoutDetailsModel;
     this.authentication = authentication;
     this.accountService = accountService;
     this.mapper = mapper;
 }
 public MembershipController(IUserService userService, IAuthentication authentication, IListingService listingService, IMembershipService membershipService)
 {
     _userService = userService;
     _authentication = authentication;
     _listingService = listingService;
     _membershipService = membershipService;
 }
 public QoamCornersController(IBaseScoreCardRepository baseScoreCardRepository, IValuationScoreCardRepository valuationScoreCardRepository, IUserProfileRepository userProfileRepository, IAuthentication authentication, IJournalRepository journalRepository, ICornerRepository cornerRepository, IBulkImporter<CornerToImport> bulkImporter)
     : base(baseScoreCardRepository, valuationScoreCardRepository, userProfileRepository, authentication)
 {
     _journalRepository = journalRepository;
     _cornerRepository = cornerRepository;
     _bulkImporter = bulkImporter;
 }
        public AdminBaseController( IAuthentication authentication = null)
        {
            

            // Allows us to injects a IUserHelper in unit tests
            Authentication = authentication ?? DependencyManager.Authentication;
        }
Exemple #10
0
        public AdminController(JournalsImport journalsImport, UlrichsImport ulrichsImport, DoajImport doajImport, JournalTocsImport journalsTocImport, JournalsExport journalsExport, IJournalRepository journalRepository, IUserProfileRepository userProfileRepository, IAuthentication authentication, IInstitutionRepository institutionRepository, IBlockedISSNRepository blockedIssnRepository, IBaseScoreCardRepository baseScoreCardRepository, IValuationScoreCardRepository valuationScoreCardRepository, IBulkImporter<SubmissionPageLink> bulkImporter, IBulkImporter<Institution> institutionImporter)
            : base(baseScoreCardRepository, valuationScoreCardRepository, userProfileRepository, authentication)
        {
            Requires.NotNull(journalsImport, nameof(journalsImport));
            Requires.NotNull(ulrichsImport, nameof(ulrichsImport));
            Requires.NotNull(journalsTocImport, nameof(journalsTocImport));
            Requires.NotNull(doajImport, nameof(doajImport));
            Requires.NotNull(journalsExport, nameof(journalsExport));
            Requires.NotNull(journalRepository, nameof(journalRepository));
            Requires.NotNull(institutionRepository, nameof(institutionRepository));
            Requires.NotNull(blockedIssnRepository, nameof(blockedIssnRepository));
            Requires.NotNull(bulkImporter, nameof(bulkImporter));
            Requires.NotNull(institutionImporter, nameof(institutionImporter));

            this.journalsImport = journalsImport;
            this.ulrichsImport = ulrichsImport;
            this.doajImport = doajImport;
            _journalsTocImport = journalsTocImport;
            this.journalsExport = journalsExport;
            this.journalRepository = journalRepository;
            this.institutionRepository = institutionRepository;
            this.blockedIssnRepository = blockedIssnRepository;

            _bulkImporter = bulkImporter;
            _institutionImporter = institutionImporter;
        }
 public PromotionController(IUserService userService, IAuthentication authentication, IListingService listingService, IPromotionService promotionService)
 {
     _userService = userService;
     _authentication = authentication;
     _listingService = listingService;
     _promotionService = promotionService;
 }
Exemple #12
0
        /// <summary>
        /// Updates the authentication that this Client uses.
        /// </summary>
        /// <param name="authentication">The authentication to put into this Client.</param>
        public void ChangeAuthentication(IAuthentication authentication)
        {
            if (authentication.AuthenticationType != AuthenticationType.ClientId)
                throw new NotImplementedException();

            Authentication = authentication;
        }
        public InstitutionsController(IInstitutionRepository institutionRepository, IBaseScoreCardRepository baseScoreCardRepository, IValuationScoreCardRepository valuationScoreCardRepository, IUserProfileRepository userProfileRepository, IAuthentication authentication)
            : base(baseScoreCardRepository, valuationScoreCardRepository, userProfileRepository, authentication)
        {
            Requires.NotNull(institutionRepository, nameof(institutionRepository));

            this.institutionRepository = institutionRepository;
        }
 public FeaturedController(IUserService userService, IAuthentication authentication, IListingService listingService, IFeaturedService featuredService)
 {
     _userService = userService;
     _authentication = authentication;
     _listingService = listingService;
     _featuredService = featuredService;
 }
Exemple #15
0
 public MapModule(IRegionManager regionManager, IAuthentication authentication, IEventAggregator eventAggregator)
 {
     this.regionManager = regionManager;
     this.authentication = authentication;
     if (eventAggregator != null)
         eventAggregator.GetEvent<CompositePresentationEvent<LogonData>>().Subscribe(OnLogonChanged);
 }
Exemple #16
0
 public HttpAuth(
     IPrincipalFactory principalFactory,
     IAuthentication authentication)
 {
     this.PrincipalFactory = principalFactory;
     this.Authentication = authentication;
 }
Exemple #17
0
        public ScoreController(IBaseScoreCardRepository baseScoreCardRepository, IBaseJournalPriceRepository baseJournalPriceRepository, IValuationScoreCardRepository valuationScoreCardRepository, IValuationJournalPriceRepository valuationJournalPriceRepository, IScoreCardVersionRepository scoreCardVersionRepository, IJournalRepository journalRepository, ILanguageRepository languageRepository, ISubjectRepository subjectRepository, IQuestionRepository questionRepository, GeneralSettings generalSettings, IUserProfileRepository userProfileRepository, IInstitutionRepository institutionRepository, IAuthentication authentication)
            : base(userProfileRepository, authentication)
        {
            Requires.NotNull(baseScoreCardRepository, "baseScoreCardRepository");
            Requires.NotNull(baseJournalPriceRepository, "baseJournalPriceRepository");
            Requires.NotNull(valuationScoreCardRepository, "valuationScoreCardRepository");
            Requires.NotNull(valuationJournalPriceRepository, "valuationJournalPriceRepository");
            Requires.NotNull(scoreCardVersionRepository, "scoreCardVersionRepository");
            Requires.NotNull(journalRepository, "journalRepository");
            Requires.NotNull(languageRepository, "languageRepository");
            Requires.NotNull(subjectRepository, "keywordRepository");
            Requires.NotNull(questionRepository, "questionRepository");
            Requires.NotNull(institutionRepository, "institutionRepository");
            Requires.NotNull(generalSettings, "generalSettings");

            this.baseScoreCardRepository = baseScoreCardRepository;
            this.scoreCardVersionRepository = scoreCardVersionRepository;
            this.valuationJournalPriceRepository = valuationJournalPriceRepository;
            this.valuationScoreCardRepository = valuationScoreCardRepository;
            this.journalRepository = journalRepository;
            this.languageRepository = languageRepository;
            this.subjectRepository = subjectRepository;
            this.questionRepository = questionRepository;
            this.baseJournalPriceRepository = baseJournalPriceRepository;
            this.institutionRepository = institutionRepository;
            this.generalSettings = generalSettings;
        }
Exemple #18
0
 public AuthenticateEndpoint(IEndpoint endpoint, IAuthenticationRuleCollection authenticationRuleCollection, IAuthentication authentication, 
     IOutputWriter outputWriter)
 {
     this.endpoint = endpoint;
     this.authenticationRuleCollection = authenticationRuleCollection;
     this.authentication = authentication;
     this.outputWriter = outputWriter;
 }
 public ShoppingCartViewModelBuilder(IShoppingCart shoppingCart, IJewelRepository jewelRepository, CartItemViewModelBuilder cartItemViewModelBuilder, IAuthentication authentication, IMappingEngine mapper)
 {
     this.shoppingCart = shoppingCart;
     this.jewelRepository = jewelRepository;
     this.cartItemViewModelBuilder = cartItemViewModelBuilder;
     this.authentication = authentication;
     this.mapper = mapper;
 }
        protected ApplicationController(IUserProfileRepository userProfileRepository, IAuthentication authentication)
        {
            Requires.NotNull(userProfileRepository, "userProfileRepository");
            Requires.NotNull(authentication, "authentication");

            this.UserProfileRepository = userProfileRepository;
            this.Authentication = authentication;
        }
        public SessionTests()
        {
            var mock = new Mock<IAuthentication>();
            mock.Setup(a => a.Authenticate()).ReturnsAsync(UserInfoExample);
            BasicAuthenticationMock = mock.Object;

            BasicServerConnectionMock = new Mock<IServerConnection>().Object;
        }
 //
 // GET: /MyAccount/
 public MyAccountController(IAuthentication authentication, ICustomerAccountService customerAccountService, IUserMailer mailer, IMappingEngine mapper, IOrderRepository orderReporistory)
 {
     this.authentication = authentication;
     this.customerAccountService = customerAccountService;
     this.mailer = mailer;
     this.mapper = mapper;
     this.orderReporistory = orderReporistory;
 }
		public BaseClient(IAuthentication authentication)
		{
			if (authentication == null)
			{
				throw new ArgumentException("The IAuthentication Object must not be null.");
			}

			Authentication = authentication;
		}
Exemple #24
0
 public HttpAuth(
     IPrincipalFactory principalFactory,
     IAuthentication<string> passAuthentication,
     IAuthentication<byte[]> hashAuthentication)
 {
     this.PrincipalFactory = principalFactory;
     this.PassAuthentication = passAuthentication;
     this.HashAuthentication = hashAuthentication;
 }
 public ContentController(
     ISession session,
     ILogger logger,
     IConfiguration configuration,
     IAuthentication authentication
     )
     : base(session, logger, configuration, authentication)
 {
 }
Exemple #26
0
        public ViewModel(IConfigurationForTenants configurationForTenants, IAuthentication authentication, IWorkspaces workspaces)
        {
            _configurationForTenants = configurationForTenants;
            
            _workspaces = workspaces;

            _authentication = authentication;

            configurationForTenants.GetAll().ForEach(_tenantsCollection.Add);
        }
Exemple #27
0
        public HomeController(IJournalRepository journalRepository, IMailSender mailSender, ContactSettings contactSettings, IUserProfileRepository userProfileRepository, IAuthentication authentication)
            : base(userProfileRepository, authentication)
        {
            Requires.NotNull(mailSender, "mailSender");
            Requires.NotNull(contactSettings, "contactSettings");

            this.journalRepository = journalRepository;
            this.mailSender = mailSender;
            this.contactSettings = contactSettings;
        }
 public void Initilise()
 {
     IList<User> users = new List<User>
     {
         new User { Id = 1, Username = "******", Name = "Fake User 1", Password = "******", Role = Role.Publisher },
         new User { Id = 2, Username = "******", Name = "Fake User 2", Password = "******", Role = Role.Employee }
     };
     IUserRepository userRepository = new FakeUserRepository(users);
     _authentication = new Authentication.Authentication(userRepository);
 }
 public FeedItemsProcessor(IFeedManager feedManager,
     IRssManager rssManager,
     IAuthentication authentication,
     FeedHubClient feedHubClient)
 {
     _feedManager = feedManager;
     _rssManager = rssManager;
     _authentication = authentication;
     _feedHubClient = feedHubClient;
 }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="authenticator"></param>
		/// <param name="hasCommentary"></param>
		/// <param name="hasContext"></param>
		public SefariaClient(IAuthentication authenticator, bool hasCommentary, bool hasContext)
		{
			HasCommentary = hasCommentary;
			HasContext = hasContext;
			_authenticator = authenticator;

			Texts = new TextClient(authenticator, HasCommentary, HasContext);
			Index = new IndexClient(authenticator);
			Links = new LinksClient(authenticator);
		}
 public AccountController(IAuthentication authentication)
 {
     _authentication = authentication;
 }
Exemple #32
0
 /// <summary>
 /// Initializes a new instance of the UploadClient class.
 /// </summary>
 /// <param name="auth">The IAuthenticator object used to authenticate with Strava.</param>
 public UploadClient(IAuthentication auth) : base(auth)
 {
 }
Exemple #33
0
 protected void SetPrivate(IAuthentication authentication)
 {
     this.accessInfo.SetPrivate(this.Path, authentication.SignatureDate);
     this.UpdateAccessParent(this);
     this.OnAccessChanged(EventArgs.Empty);
 }
Exemple #34
0
 public BaseProving(string tokenKeyName)
 {
     this.TokenKeyName   = tokenKeyName;
     this.Authentication = CreateAuthentication();
 }
Exemple #35
0
 protected void Unlock(IAuthentication authentication)
 {
     this.lockInfo = LockInfo.Empty;
     this.UpdateLockParent(this.lockParent);
     this.OnLockChanged(EventArgs.Empty);
 }
Exemple #36
0
 public virtual void OnValidateUnlock(IAuthentication authentication, object target)
 {
 }
Exemple #37
0
 public FailedCountDecorator(IAuthentication authenticationService, IFailedCounter failedCounter) : base(authenticationService)
 {
     _failedCounter = failedCounter;
 }
 public PickupUserController(IDatabaseWorker databaseWorker, IAuthentication authentication)
 {
     _databaseWorker = databaseWorker;
     _authentication = authentication;
 }
 public BaseController(IAuthentication authentication)
 {
     _auth = authentication;
 }
Exemple #40
0
 public IssueImageRepository(IAuthentication authentication)
 {
     _authentication = authentication;
 }
 public HttpClient(Uri endpoint, ILogger logger, IAuthentication auth) : this(endpoint, auth)
 {
     Logger = logger ?? new NullLogger();
 }
 public HttpClient(Uri endpoint, IAuthentication auth)
 {
     BaseUri = endpoint;
     _auth   = auth;
 }
 public HttpClient(string endpoint, IAuthentication auth)
 {
     BaseUri = new Uri(endpoint);
     _auth   = auth;
 }
 public BaseApiController(IAuthentication auth)
 {
     Auth = auth;
 }
 /// <summary>
 /// Инициализирует новый экземпляр InvestContext с внедрением зависемостей к хранилищу пользователей и с аутентификационной службой.</summary>
 /// <param name="userRepository">Экземпляр класса UserRepository, предоставляющий доступ к хранилищу пользователей.</param>
 /// <param name="authentication">аутентификационная служба</param>
 public BrioContext(IUserRepository userRepository, IAuthentication authentication)
 {
     this._userRepository = userRepository;
     this.Auth            = DependencyResolver.Current.GetService <IAuthentication>();
 }
Exemple #46
0
 public LogController(
     IAuthentication authentication, IMemoryCache memoryCache)
 {
     _authentication = authentication;
     _memoryCache    = memoryCache;
 }
 public Authorization(IAuthentication authentication, UnitOfWork unitOfWork)
 {
     _authentication = authentication;
     _unitOfWork     = unitOfWork;
 }
Exemple #48
0
 public bool VerifyAccessType(IAuthentication authentication, AccessType accessType)
 {
     return(this.GetAccessType(authentication).HasFlag(accessType));
 }
Exemple #49
0
 protected void ValidateDelete(IAuthentication authentication)
 {
     this.OnValidateDelete(authentication, this);
 }
Exemple #50
0
 public virtual void OnValidateRemoveAccessMember(IAuthentication authentication, object target)
 {
 }
Exemple #51
0
 protected void RemoveAccessMember(IAuthentication authentication, string memberID)
 {
     this.accessInfo.Remove(authentication.SignatureDate, memberID);
     this.UpdateAccessParent(this);
     this.OnAccessChanged(EventArgs.Empty);
 }
Exemple #52
0
 public SegmentClient(IAuthentication auth)
     : base(auth)
 {
 }
Exemple #53
0
 public virtual void OnValidateSetAccessMember(IAuthentication authentication, object target, string memberID, AccessType accessType)
 {
 }
Exemple #54
0
 public TakeParkingPlaceCommandHandler(MainDbContext AMainDbContext, ICommands ACommandStore, IAuthentication AAuthentication)
 {
     FMainDbContext  = AMainDbContext;
     FCommandStore   = ACommandStore;
     FAuthentication = AAuthentication;
 }
Exemple #55
0
 public AccountController(IAuthentication auth)
 {
     this.auth = auth;
 }
Exemple #56
0
 protected void SetPublic(IAuthentication authentication)
 {
     this.accessInfo.SetPublic();
     this.UpdateAccessParent(this.accessParent);
     this.OnAccessChanged(EventArgs.Empty);
 }
 public ActivityService(IAuthentication auth)
 {
     _auth = auth;
 }
 public SupplementationController(ILogger logger, IDataSetsHelper dataSetsHelper, IRoles roles, IAuthentication authentication, IFileSourceHelper fileSourceHelper, IMembershipService membershipService)
     : base(logger, dataSetsHelper, roles, authentication, fileSourceHelper, membershipService)
 {
     _authentication = authentication;
 }
Exemple #59
0
 public BaseProving(string tokenKeyName, IAuthentication authentication)
 {
     this.TokenKeyName   = tokenKeyName;
     this.Authentication = authentication;
 }
Exemple #60
0
 public virtual void OnValidateSetPrivate(IAuthentication authentication, object target)
 {
 }