mirror of
https://github.com/pushbits/server.git
synced 2025-05-24 14:26:35 +02:00
Reintroduce check for minimum token length
This commit is contained in:
parent
47f10c03ae
commit
500a8cd4b0
1 changed files with 6 additions and 0 deletions
|
@ -7,6 +7,10 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const (
|
||||
minTokenLength = 14
|
||||
)
|
||||
|
||||
func isGoodToken(assert *assert.Assertions, require *require.Assertions, token string, compat bool) {
|
||||
if compat {
|
||||
assert.Equal(len(token), compatTokenLength, "Unexpected compatibility token length")
|
||||
|
@ -14,6 +18,8 @@ func isGoodToken(assert *assert.Assertions, require *require.Assertions, token s
|
|||
assert.Equal(len(token), regularTokenLength, "Unexpected regular token length")
|
||||
}
|
||||
|
||||
assert.GreaterOrEqual(len(token), minTokenLength, "Token is too short to give sufficient entropy")
|
||||
|
||||
prefix := token[0:len(applicationTokenPrefix)]
|
||||
|
||||
assert.Equal(prefix, applicationTokenPrefix, "Invalid token prefix")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue