コード例 #1
0
        public async Task RevokeAsync(DomainAuthorization authorization)
        {
            Ensure.NotNull(authorization, nameof(authorization));

            await db.DomainAuthorizations.PatchAsync(authorization.Id, new[] {
                Change.Replace("revoked", Expression.Func("NOW"))
            }, condition : Expression.IsNull("revoked"));
        }
コード例 #2
0
        public async Task CompleteAsync(DomainAuthorization authorization, DateTime expires)
        {
            Ensure.NotNull(authorization, nameof(authorization));

            await db.DomainAuthorizations.PatchAsync(authorization.Id, new[] {
                Change.Replace("completed", Expression.Func("NOW")),
                Change.Replace("expires", expires),
            }, condition : Expression.IsNull("completed"));
        }
コード例 #3
0
        public async Task <DomainAuthorization> CreateAsync(CreateDomainAuthorizationRequest request)
        {
            Ensure.NotNull(request, nameof(request));

            var id = await DomainAuthorizationId.NextAsync(db.Context, request.DomainId);

            var authorization = new DomainAuthorization(id, request.Type, request.Properties);

            await db.DomainAuthorizations.InsertAsync(authorization);

            return(authorization);
        }