-
Notifications
You must be signed in to change notification settings - Fork 969
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: client-side PKCE take 3 (#4078)
* feat: client-side PKCE This change introduces a new configuration for OIDC providers: pkce with values auto (default), never, force. When auto is specified or the field is omitted, Kratos will perform autodiscovery and perform PKCE when the server advertises support for it. This requires the issuer_url to be set for the provider. never completely disables PKCE support. This is only theoretically useful: when a provider advertises PKCE support but doesn't actually implement it. force always sends a PKCE challenge in the initial redirect URL, regardless of what the provider advertises. This setting is useful when the provider offers PKCE but doesn't advertise it in his ./well-known/openid-configuration. Important: When setting pkce: force, you must whitelist a different return URL for your OAuth2 client in the provider's configuration. Instead of <base-url>/self-service/methods/oidc/callback/<provider>, you must use <base-url>/self-service/methods/oidc/callback (note missing last path segment). This is to enable the use of the same OAuth client ID+secret when configuring several Kratos OIDC providers, without having to whitelist individual redirect_uris for each Kratos provider config. * chore: regenerate SDK, bump DB versions, cleanup tool install * chore: get final organization ID from provider config during registration and login * chore: fixup OIDC function signatures and improve tests
- Loading branch information
Showing
70 changed files
with
4,301 additions
and
517 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
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 |
---|---|---|
|
@@ -32,9 +32,8 @@ $(call make-lint-dependency) | |
echo "deprecated usage, use docs/cli instead" | ||
go build -o .bin/clidoc ./cmd/clidoc/. | ||
|
||
.PHONY: .bin/yq | ||
.bin/yq: | ||
go build -o .bin/yq github.com/mikefarah/yq/v4 | ||
.bin/yq: Makefile | ||
GOBIN=$(PWD)/.bin go install github.com/mikefarah/yq/[email protected] | ||
|
||
.PHONY: docs/cli | ||
docs/cli: | ||
|
@@ -58,17 +57,31 @@ docs/swagger: | |
curl https://raw.githubusercontent.com/ory/meta/master/install.sh | bash -s -- -b .bin ory v0.2.2 | ||
touch -a -m .bin/ory | ||
|
||
.bin/buf: Makefile | ||
curl -sSL \ | ||
"https://github.com/bufbuild/buf/releases/download/v1.39.0/buf-$(shell uname -s)-$(shell uname -m).tar.gz" | \ | ||
tar -xvzf - -C ".bin/" --strip-components=2 buf/bin/buf buf/bin/protoc-gen-buf-breaking buf/bin/protoc-gen-buf-lint | ||
touch -a -m .bin/buf | ||
|
||
.PHONY: lint | ||
lint: .bin/golangci-lint | ||
golangci-lint run -v --timeout 10m ./... | ||
.bin/golangci-lint run -v --timeout 10m ./... | ||
.bin/buf lint | ||
|
||
.PHONY: mocks | ||
mocks: .bin/mockgen | ||
mockgen -mock_names Manager=MockLoginExecutorDependencies -package internal -destination internal/hook_login_executor_dependencies.go github.com/ory/kratos/selfservice loginExecutorDependencies | ||
|
||
.PHONY: proto | ||
proto: gen/oidc/v1/state.pb.go | ||
|
||
gen/oidc/v1/state.pb.go: proto/oidc/v1/state.proto buf.yaml buf.gen.yaml .bin/buf .bin/goimports | ||
.bin/buf generate | ||
.bin/goimports -w gen/ | ||
|
||
.PHONY: install | ||
install: | ||
GO111MODULE=on go install -tags sqlite . | ||
go install -tags sqlite . | ||
|
||
.PHONY: test-resetdb | ||
test-resetdb: | ||
|
@@ -163,11 +176,12 @@ authors: # updates the AUTHORS file | |
|
||
# Formats the code | ||
.PHONY: format | ||
format: .bin/goimports .bin/ory node_modules | ||
.bin/ory dev headers copyright --exclude=internal/httpclient --exclude=internal/client-go --exclude test/e2e/proxy/node_modules --exclude test/e2e/node_modules --exclude node_modules | ||
format: .bin/goimports .bin/ory node_modules .bin/buf | ||
.bin/ory dev headers copyright --exclude=gen --exclude=internal/httpclient --exclude=internal/client-go --exclude test/e2e/proxy/node_modules --exclude test/e2e/node_modules --exclude node_modules | ||
goimports -w -local github.com/ory . | ||
npm exec -- prettier --write 'test/e2e/**/*{.ts,.js}' | ||
npm exec -- prettier --write '.github' | ||
.bin/buf format --write | ||
|
||
# Build local docker image | ||
.PHONY: docker | ||
|
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: v2 | ||
managed: | ||
enabled: true | ||
override: | ||
- file_option: go_package_prefix | ||
value: github.com/ory/kratos | ||
plugins: | ||
- remote: buf.build/protocolbuffers/go | ||
out: gen | ||
opt: paths=source_relative | ||
inputs: | ||
- directory: proto |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: v2 | ||
modules: | ||
- path: proto | ||
lint: | ||
use: | ||
- DEFAULT | ||
breaking: | ||
use: | ||
- FILE |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.