Beispiel #1
0
        public async Task <IdentityPrincipal> Remove(IWorkContext context)
        {
            Verify.IsNotNull(nameof(context), context);

            IdentityPrincipal client = await _identityRepository.RemoveAsync(context, new PrincipalId(ActorKey.VectorKey));

            _principal = null;
            return(client);
        }
Beispiel #2
0
        public async Task Set(IWorkContext context, IdentityPrincipal identityPrincipal)
        {
            Verify.IsNotNull(nameof(context), context);
            Verify.Assert(ActorKey.VectorKey.Equals(identityPrincipal.PrincipalId, StringComparison.OrdinalIgnoreCase), "Client identity does not match actor key");

            await _identityRepository.SetAsync(context, identityPrincipal);

            _principal = null;
        }
        public IdentityInMemoryStore Set(IWorkContext context, IdentityPrincipal identityPrincipal)
        {
            Verify.IsNotNull(nameof(context), context);
            Verify.IsNotNull(nameof(identityPrincipal), identityPrincipal);
            Verify.IsNotEmpty(nameof(identityPrincipal.PrincipalId), identityPrincipal.PrincipalId);

            _store[identityPrincipal.PrincipalId] = identityPrincipal.Clone();
            return(this);
        }
Beispiel #4
0
        public async Task SetAsync(IWorkContext context, IdentityPrincipal identityPrincipal)
        {
            Verify.IsNotNull(nameof(context), context);
            Verify.IsNotNull(nameof(identityPrincipal), identityPrincipal);

            IIdentityActor actor = await _actorManger.CreateProxyAsync <IIdentityActor>(context, new ActorKey(identityPrincipal.PrincipalId));

            await actor.Set(context, identityPrincipal);
        }
Beispiel #5
0
        public async Task <IdentityPrincipal> Get(IWorkContext context)
        {
            Verify.IsNotNull(nameof(context), context);

            if (_principal != null)
            {
                return(_principal);
            }

            _principal = await _identityRepository.GetAsync(context, new PrincipalId(ActorKey.VectorKey));

            return(_principal);
        }
 public static ActorKey CreateActorKey(this IdentityPrincipal self)
 {
     return(new ActorKey(self.PrincipalId));
 }
 public Task SetAsync(IWorkContext context, IdentityPrincipal identityPrincipal)
 {
     Set(context, identityPrincipal);
     return(Task.FromResult(0));
 }