forked from mystiq/dex
44c6cb44f5
This enables us to control the length of the bytes that will be bcrypted, by default it's 64. Also changed the token's stored form from string('text') to []byte('bytea') and added some test cases for different types of invalid tokens.
18 lines
507 B
Go
18 lines
507 B
Go
package refreshtest
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/coreos/dex/refresh"
|
|
)
|
|
|
|
// NewTestRefreshTokenRepo returns a test repo whose tokens monotonically increase.
|
|
// The tokens are in the form { refresh-1, refresh-2 ... refresh-n}.
|
|
func NewTestRefreshTokenRepo() (refresh.RefreshTokenRepo, error) {
|
|
var tokenIdx int
|
|
tokenGenerator := func() ([]byte, error) {
|
|
tokenIdx++
|
|
return []byte(fmt.Sprintf("refresh-%d", tokenIdx)), nil
|
|
}
|
|
return refresh.NewRefreshTokenRepoWithTokenGenerator(tokenGenerator), nil
|
|
}
|