mirror of
https://github.com/hanzoai/iam.git
synced 2026-11-19 18:37:16 +00:00
This repo is public and its LICENSE called the source "confidential and
proprietary ... All rights reserved". Public visibility contradicts
confidentiality, and HIP-0130 puts `iam` in the OSS core tier. The declaration
now matches both.
LICENSE-APACHE and LICENSE-MIT carry the canonical texts, unedited —
LICENSE-APACHE is byte-identical to apache.org/licenses/LICENSE-2.0.txt
(sha256 cfc7749b…, 11358 bytes, blob d645695). LICENSE declares the pair.
LICENSE-MIT carries the copyright line the notice requires.
249 Go files led with `// Copyright 2026 Hanzo AI, Inc. All rights reserved.`
— the classic proprietary reservation, and a per-file contradiction of the new
grant. Each now carries `// SPDX-License-Identifier: MIT OR Apache-2.0`. The
word "confidential" survives untouched in the OIDC sense (confidential client),
which is protocol vocabulary, not a licence claim.
There is nothing else to declare: `go.mod` has no licence field and this repo
ships no Cargo/npm/PyPI manifest.
Relicensing is ours alone to do. The tree is original work, not a fork:
`fork: false` with no parent, its own root commit, and no Casdoor-lineage tag
is an ancestor of `main`. The retired Casdoor fork is `hanzoai/iam-v1`; the
provenance note in LICENSE names it, restoring the vendor name a clean-room
assertion needs in order to say what it is clean of.
Build, vet and all 29 test packages green.
Co-authored-by: Hanzo Dev <[email protected]>
49 lines
1.7 KiB
Go
49 lines
1.7 KiB
Go
// Copyright 2026 Hanzo AI, Inc.
|
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
|
|
package pkce
|
|
|
|
import "testing"
|
|
|
|
// The canonical RFC 7636 Appendix B vector. This is the contract every client
|
|
// derives against, so it is pinned where the derivation lives rather than
|
|
// separately in each caller.
|
|
func TestChallengeMatchesRFC7636Vector(t *testing.T) {
|
|
const (
|
|
verifier = "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
|
|
want = "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"
|
|
)
|
|
if got := Challenge(verifier); got != want {
|
|
t.Fatalf("Challenge = %q, want %q (RFC 7636 Appendix B)", got, want)
|
|
}
|
|
}
|
|
|
|
// The encoding must be base64url WITHOUT padding, and must not use the
|
|
// standard alphabet: a '+' or '/' in a query parameter, or a trailing '=',
|
|
// produces a challenge the server will not match.
|
|
func TestChallengeIsUnpaddedBase64URL(t *testing.T) {
|
|
// This verifier hashes to a digest containing bytes that encode to '-'
|
|
// and '_' under base64url and to '+' and '/' under the standard alphabet.
|
|
for _, verifier := range []string{"", "a", "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"} {
|
|
got := Challenge(verifier)
|
|
if len(got) != 43 {
|
|
t.Errorf("Challenge(%q) is %d chars, want 43 (unpadded 256-bit digest)", verifier, len(got))
|
|
}
|
|
for _, r := range got {
|
|
ok := r == '-' || r == '_' ||
|
|
(r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9')
|
|
if !ok {
|
|
t.Errorf("Challenge(%q) = %q contains %q, outside the base64url alphabet", verifier, got, r)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Method is what clients send; if it ever stopped being S256 the server would
|
|
// reject every request that trusted it.
|
|
func TestMethodIsS256(t *testing.T) {
|
|
if Method != "S256" {
|
|
t.Fatalf("Method = %q, want S256", Method)
|
|
}
|
|
}
|