Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
const_test.go 588 Bytes
Copy Edit Raw Blame History
Nikolas Sepos authored 2020-12-20 12:31 . better challenge validation
package oauth2_test
import (
"testing"
"github.com/go-oauth2/oauth2/v4"
)
func TestValidatePlain(t *testing.T) {
cc := oauth2.CodeChallengePlain
if !cc.Validate("plaintest", "plaintest") {
t.Fatal("not valid")
}
}
func TestValidateS256(t *testing.T) {
cc := oauth2.CodeChallengeS256
if !cc.Validate("W6YWc_4yHwYN-cGDgGmOMHF3l7KDy7VcRjf7q2FVF-o=", "s256test") {
t.Fatal("not valid")
}
}
func TestValidateS256NoPadding(t *testing.T) {
cc := oauth2.CodeChallengeS256
if !cc.Validate("W6YWc_4yHwYN-cGDgGmOMHF3l7KDy7VcRjf7q2FVF-o", "s256test") {
t.Fatal("not valid")
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化