public void ReadNotValidToken_Expires() { var provider = GetNewProvider(); var message = Guid.NewGuid().ToString(); var payload = new MessageTokenPayload(message); var token = provider.Generate <MessageTokenPayload>(payload, TimeSpan.FromSeconds(-10)); var decoded = provider.Read <MessageTokenPayload>(token, verify: true); Assert.Null(decoded); }
public void ReadNotValidToken_WrongSecret() { var providerA = GetNewProvider(); var providerB = GetNewProvider(); var messageB = Guid.NewGuid().ToString(); var sourceB = new MessageTokenPayload(messageB); var tokenB = providerB.Generate <MessageTokenPayload>(sourceB, TimeSpan.FromSeconds(33)); var decoded = providerA.Read <MessageTokenPayload>(tokenB, verify: true); Assert.Null(decoded); }