-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6eb9d7
commit 4a37b66
Showing
13 changed files
with
150 additions
and
2,231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
|
||
lint: | ||
golangci-lint run ./... | ||
@golangci-lint run ./... | ||
|
||
test-coverage: | ||
go test -coverprofile=coverage.out ./... | ||
go tool cover -func=coverage.out | ||
@go test -coverprofile=coverage.out ./... | ||
@go tool cover -func=coverage.out | ||
|
||
run-oauth2: | ||
docker run -p 8080:8080 --name keycloak -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:latest start-dev | ||
run: | ||
@cd script && ./run.sh | ||
|
||
shutdown-oauth2: | ||
docker stop keycloak | ||
docker rm keycloak | ||
@docker stop keycloak | ||
@docker rm keycloak | ||
|
||
create-realm: | ||
cd ./script && ./create-realm.sh | ||
|
||
run-api: | ||
./script/run-api.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,21 @@ func TestExtractRoles(t *testing.T) { | |
"realm_access": map[string]interface{}{ | ||
"roles": []interface{}{"admin", "user"}, | ||
}, | ||
"email": "[email protected]", | ||
}, | ||
} | ||
|
||
roles := extractRoles(token) | ||
email, roles := extractRoles(token) | ||
|
||
expectedRoles := []Role{"admin", "user"} | ||
if !reflect.DeepEqual(roles, expectedRoles) { | ||
t.Fatalf("Roles mismatch. Expected: %v, got: %v", expectedRoles, roles) | ||
} | ||
|
||
expectedEmail := Email("[email protected]") | ||
if email != expectedEmail { | ||
t.Fatalf("Email mismatch. Expected: %v, got: %v", expectedEmail, email) | ||
} | ||
} | ||
|
||
func TestParseJWT(t *testing.T) { | ||
|
@@ -41,7 +47,7 @@ func TestParseJWT(t *testing.T) { | |
} | ||
|
||
// Parse the token | ||
parsedToken, _, err := parseJWT(tokenString, []*rsa.PublicKey{pubKey}) | ||
parsedToken, _, _, err := parseJWT(tokenString, []*rsa.PublicKey{pubKey}) | ||
if err != nil { | ||
t.Fatalf("Failed to parse JWT: %v", err) | ||
} | ||
|
Oops, something went wrong.