Exemplo n.º 1
0
        public void Add(string requestHash, PermissionTicket ticket)
        {
            var hash = ticket.GetHash();

            this.tickets.Add(hash, ticket);
            this.requestMap.Add(requestHash, hash);
        }
Exemplo n.º 2
0
 public void Revoke(PermissionTicket ticket)
 {
     if (ticket == null)
     {
         throw new ArgumentNullException(nameof(ticket), "Ticket cannot be NULL");
     }
     this.storage.Remove(ticket.GetHash());
 }
        public void ValidateFromTicket(PermissionTicket ticket, bool expectedResult)
        {
            // Arrange
            this.storage.Add(ticket.GetHash(), ticket);

            // Act
            var validationResult = this.manager.Validate(ticket);

            // Assert
            validationResult.Should().Be(expectedResult);
        }
Exemplo n.º 4
0
 public bool Validate(PermissionTicket ticket) =>
 ticket != null &&
 ticket.IsValid &&
 !ticket.IsExpired(DateTimeOffset.UtcNow) &&
 this.storage.Find(ticket.GetHash()) != null;