Esempio n. 1
0
// BenchmarkServeHTTPHMACSimpleBL-4	  100000	     16037 ns/op	    3808 B/op	      82 allocs/op Go 1.5.0
func BenchmarkServeHTTPHMACSimpleBL(b *testing.B) {
	bl := ctxjwt.NewSimpleMapBlackList()
	password := []byte(`Rump3lst!lzch3n`)
	bmServeHTTP(b,
		ctxjwt.WithPassword(password),
		ctxjwt.WithBlacklist(bl),
	)
	b.Logf("Blacklist Items %d", bl.Len())
}
Esempio n. 2
0
func TestSimpleMapBlackListHas(t *testing.T) {

	token := "My new token cannot be spoken."
	bl := ctxjwt.NewSimpleMapBlackList()

	assert.NoError(t, bl.Set(token, time.Millisecond*1))
	assert.True(t, bl.Has(token))
	time.Sleep(time.Millisecond * 4)
	assert.False(t, bl.Has(token))
	assert.False(t, bl.Has(token))
}