示例#1
0
        public override async Task OnConnected()
        {
            string appKey = Context.Request.Headers.Get(Headers.FooidityAppKey);

            if (string.IsNullOrWhiteSpace(appKey))
            {
                Clients.Caller.notifyMissingAppKey();
                return;
            }

            try
            {
                OrganizationApplicationKey application = await _getApplicationKey.Execute(new GetApplicationKeyQuery(appKey));

                await Groups.Add(Context.ConnectionId, application.ApplicationId);

                _appKeys.TryAdd(Context.ConnectionId, application);
            }
            catch (ApplicationNotFoundException)
            {
                Clients.Caller.notifyInvalidAppKey();
            }

            await base.OnConnected();
        }
        public bool TryAdd(string connectionId, OrganizationApplicationKey appKey)
        {
            if (_ids.TryAdd(connectionId, appKey))
                return true;

            return false;
        }
        public bool TryGetAppKey(string connectionId, out OrganizationApplicationKey appKey)
        {
            if (_ids.TryGetValue(connectionId, out appKey))
                return true;

            return false;
        }
示例#4
0
        public bool TryAdd(string connectionId, OrganizationApplicationKey appKey)
        {
            if (_ids.TryAdd(connectionId, appKey))
            {
                return(true);
            }

            return(false);
        }
示例#5
0
        public bool TryGetAppKey(string connectionId, out OrganizationApplicationKey appKey)
        {
            if (_ids.TryGetValue(connectionId, out appKey))
            {
                return(true);
            }

            return(false);
        }
        public async Task <ActionResult> CreateKey(CreateApplicationKeyViewModel model, CancellationToken cancellationToken)
        {
            if (ModelState.IsValid)
            {
                var command = new CreateApplicationKeyCommand(User.Identity.GetUserId(), model.OrganizationId, model.ApplicationId);

                OrganizationApplicationKey key = await _createApplicationKey.Execute(command, cancellationToken);

                return(RedirectToAction("Details", new { id = model.ApplicationId }));
            }

            return(RedirectToAction("Index"));
        }
示例#7
0
 public bool TryRemove(string connectionId, out OrganizationApplicationKey application)
 {
     return(_ids.TryRemove(connectionId, out application));
 }
 public bool TryRemove(string connectionId, out OrganizationApplicationKey application)
 {
     return _ids.TryRemove(connectionId, out application);
 }