diff --git a/Makefile b/Makefile index eec7fcabf0ff..49d4cae2379f 100644 --- a/Makefile +++ b/Makefile @@ -111,11 +111,26 @@ sdk: .bin/swagger .bin/ory node_modules -g go \ -o "internal/httpclient" \ --git-user-id ory \ - --git-repo-id kratos-client-go \ + --git-repo-id client-go \ --git-host github.com \ -t .schema/openapi/templates/go \ -c .schema/openapi/gen.go.yml + (cd internal/httpclient; rm -rf go.mod go.sum test api docs) + + rm -rf internal/httpclient-central + mkdir -p internal/httpclient-central/ + npm run openapi-generator-cli -- generate -i "spec/api.json" \ + -g go \ + -o "internal/client-go" \ + --git-user-id ory \ + --git-repo-id client-go \ + --git-host github.com \ + -t .schema/openapi/templates/go \ + -c .schema/openapi/gen.go.yml + + (cd internal/client-go; go mod edit -module github.com/ory/client-go go.mod; rm -rf test api docs) + make format .PHONY: quickstart @@ -135,7 +150,7 @@ authors: # updates the AUTHORS file # Formats the code .PHONY: format format: .bin/goimports .bin/ory node_modules - .bin/ory dev headers license --exclude=internal/httpclient + .bin/ory dev headers license --exclude=internal/httpclient --exclude=internal/httpclient-ory goimports -w -local github.com/ory . npm exec -- prettier --write 'test/e2e/**/*{.ts,.js}' npm exec -- prettier --write '.github' diff --git a/cmd/cliclient/client.go b/cmd/cliclient/client.go index ca0bec6b773d..9c8ea40db76b 100644 --- a/cmd/cliclient/client.go +++ b/cmd/cliclient/client.go @@ -5,6 +5,7 @@ package cliclient import ( "fmt" + "net/http" "net/url" "os" "time" @@ -17,7 +18,7 @@ import ( "github.com/spf13/pflag" - kratos "github.com/ory/kratos-client-go" + kratos "github.com/ory/kratos/internal/httpclient" ) const ( @@ -31,9 +32,22 @@ const ( ClientContextKey ContextKey = iota + 1 ) +type ClientContext struct { + Endpoint string + HTTPClient *http.Client +} + func NewClient(cmd *cobra.Command) (*kratos.APIClient, error) { - if f, ok := cmd.Context().Value(ClientContextKey).(func(cmd *cobra.Command) (*kratos.APIClient, error)); ok { - return f(cmd) + if f, ok := cmd.Context().Value(ClientContextKey).(func(cmd *cobra.Command) (*ClientContext, error)); ok { + cc, err := f(cmd) + if err != nil { + return nil, err + } + + conf := kratos.NewConfiguration() + conf.HTTPClient = cc.HTTPClient + conf.Servers = kratos.ServerConfigurations{{URL: cc.Endpoint}} + return kratos.NewAPIClient(conf), nil } else if f != nil { return nil, errors.Errorf("ClientContextKey was expected to be *client.OryKratos but it contained an invalid type %T ", f) } diff --git a/cmd/identities/definitions.go b/cmd/identities/definitions.go index 5897cdd5bc8a..12b98b9540fc 100644 --- a/cmd/identities/definitions.go +++ b/cmd/identities/definitions.go @@ -6,7 +6,7 @@ package identities import ( "strings" - kratos "github.com/ory/kratos-client-go" + kratos "github.com/ory/kratos/internal/httpclient" "github.com/ory/x/cmdx" ) diff --git a/cmd/identities/get.go b/cmd/identities/get.go index 1e0ad9a939f9..474067e13eac 100644 --- a/cmd/identities/get.go +++ b/cmd/identities/get.go @@ -6,7 +6,7 @@ package identities import ( "fmt" - kratos "github.com/ory/kratos-client-go" + kratos "github.com/ory/kratos/internal/httpclient" "github.com/ory/kratos/x" "github.com/ory/x/cmdx" "github.com/ory/x/stringsx" diff --git a/cmd/identities/import.go b/cmd/identities/import.go index e8c8b262c595..53a8bb87dea4 100644 --- a/cmd/identities/import.go +++ b/cmd/identities/import.go @@ -7,7 +7,7 @@ import ( "encoding/json" "fmt" - kratos "github.com/ory/kratos-client-go" + kratos "github.com/ory/kratos/internal/httpclient" "github.com/ory/x/cmdx" diff --git a/cmd/identities/import_test.go b/cmd/identities/import_test.go index 34021f7f661c..f8d91186482a 100644 --- a/cmd/identities/import_test.go +++ b/cmd/identities/import_test.go @@ -17,8 +17,8 @@ import ( "github.com/stretchr/testify/require" "github.com/tidwall/gjson" - kratos "github.com/ory/kratos-client-go" "github.com/ory/kratos/driver/config" + kratos "github.com/ory/kratos/internal/httpclient" ) func TestImportCmd(t *testing.T) { diff --git a/examples/go/identity/create/main.go b/examples/go/identity/create/main.go index 911da8d67dd0..4a46856b3cab 100644 --- a/examples/go/identity/create/main.go +++ b/examples/go/identity/create/main.go @@ -6,7 +6,7 @@ package main import ( "context" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" "github.com/ory/kratos/examples/go/pkg" "github.com/ory/kratos/x" ) diff --git a/examples/go/identity/get/main.go b/examples/go/identity/get/main.go index d4e8fefc89c4..b36cf8a30176 100644 --- a/examples/go/identity/get/main.go +++ b/examples/go/identity/get/main.go @@ -6,7 +6,7 @@ package main import ( "context" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" "github.com/ory/kratos/examples/go/pkg" ) diff --git a/examples/go/identity/update/main.go b/examples/go/identity/update/main.go index ea840c899a10..c976e87ff799 100644 --- a/examples/go/identity/update/main.go +++ b/examples/go/identity/update/main.go @@ -6,7 +6,7 @@ package main import ( "context" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" "github.com/ory/kratos/examples/go/pkg" "github.com/ory/kratos/x" ) diff --git a/examples/go/pkg/common.go b/examples/go/pkg/common.go index 37fe3d0a2ab3..d2edd7f14521 100644 --- a/examples/go/pkg/common.go +++ b/examples/go/pkg/common.go @@ -15,7 +15,7 @@ import ( "github.com/ory/kratos/internal/testhelpers" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" ) func PrintJSONPretty(v interface{}) { diff --git a/examples/go/pkg/resources.go b/examples/go/pkg/resources.go index 8ded1e1c6658..556b18c82ad7 100644 --- a/examples/go/pkg/resources.go +++ b/examples/go/pkg/resources.go @@ -10,7 +10,7 @@ import ( "github.com/google/uuid" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" ) func RandomCredentials() (email, password string) { diff --git a/examples/go/selfservice/error/main.go b/examples/go/selfservice/error/main.go index f06840017efe..1c2516f1cb25 100644 --- a/examples/go/selfservice/error/main.go +++ b/examples/go/selfservice/error/main.go @@ -6,7 +6,7 @@ package main import ( "github.com/ory/kratos/examples/go/pkg" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" ) // If you use Open Source this would be: diff --git a/examples/go/selfservice/login/main.go b/examples/go/selfservice/login/main.go index e7bd868600c7..72c8dc657271 100644 --- a/examples/go/selfservice/login/main.go +++ b/examples/go/selfservice/login/main.go @@ -8,7 +8,7 @@ import ( "github.com/ory/kratos/examples/go/pkg" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" ) // If you use Open Source this would be: diff --git a/examples/go/selfservice/logout/main.go b/examples/go/selfservice/logout/main.go index aad0ca255dbf..9842abcdc51c 100644 --- a/examples/go/selfservice/logout/main.go +++ b/examples/go/selfservice/logout/main.go @@ -8,7 +8,7 @@ import ( "github.com/ory/kratos/examples/go/pkg" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" ) // If you use Open Source this would be: diff --git a/examples/go/selfservice/recovery/main.go b/examples/go/selfservice/recovery/main.go index 1986bba60771..c39c7845e886 100644 --- a/examples/go/selfservice/recovery/main.go +++ b/examples/go/selfservice/recovery/main.go @@ -8,7 +8,7 @@ import ( "github.com/ory/kratos/examples/go/pkg" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" ) // If you use Open Source this would be: diff --git a/examples/go/selfservice/recovery/main_test.go b/examples/go/selfservice/recovery/main_test.go index 0324a4e432a1..0878735f4f66 100644 --- a/examples/go/selfservice/recovery/main_test.go +++ b/examples/go/selfservice/recovery/main_test.go @@ -6,17 +6,13 @@ package main import ( "testing" - ory "github.com/ory/kratos-client-go" - - "github.com/stretchr/testify/assert" - "github.com/google/uuid" - - "github.com/ory/kratos/internal/testhelpers" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/ory/kratos/examples/go/pkg" - - "github.com/stretchr/testify/require" + ory "github.com/ory/kratos/internal/httpclient" + "github.com/ory/kratos/internal/testhelpers" ) func TestFunc(t *testing.T) { @@ -25,5 +21,5 @@ func TestFunc(t *testing.T) { flow := performRecovery("dev+" + uuid.New().String() + "@ory.sh") require.NotEmpty(t, flow.Id) - assert.Equal(t, ory.SELFSERVICERECOVERYFLOWSTATE_SENT_EMAIL, flow.State) + assert.EqualValues(t, ory.SELFSERVICERECOVERYFLOWSTATE_SENT_EMAIL, flow.State) } diff --git a/examples/go/selfservice/registration/main.go b/examples/go/selfservice/registration/main.go index 74b44c479d28..8270237c0677 100644 --- a/examples/go/selfservice/registration/main.go +++ b/examples/go/selfservice/registration/main.go @@ -8,7 +8,7 @@ import ( "github.com/ory/kratos/examples/go/pkg" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" ) // If you use Open Source this would be: diff --git a/examples/go/selfservice/settings/main.go b/examples/go/selfservice/settings/main.go index af979aa3337f..d4f4eef74f59 100644 --- a/examples/go/selfservice/settings/main.go +++ b/examples/go/selfservice/settings/main.go @@ -8,7 +8,7 @@ import ( "github.com/ory/kratos/examples/go/pkg" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" ) // If you use Open Source this would be: diff --git a/examples/go/selfservice/settings/main_test.go b/examples/go/selfservice/settings/main_test.go index 7e49b1bb9c7b..ef4865972a3c 100644 --- a/examples/go/selfservice/settings/main_test.go +++ b/examples/go/selfservice/settings/main_test.go @@ -6,7 +6,7 @@ package main import ( "testing" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/kratos/internal/httpclient" "github.com/stretchr/testify/assert" @@ -24,11 +24,11 @@ func TestSettings(t *testing.T) { email, password := pkg.RandomCredentials() result := changePassword(email, password) require.NotEmpty(t, result.Id) - assert.Equal(t, ory.SELFSERVICESETTINGSFLOWSTATE_SUCCESS, result.State) + assert.EqualValues(t, ory.SELFSERVICESETTINGSFLOWSTATE_SUCCESS, result.State) email, password = pkg.RandomCredentials() result = changeTraits(email, password) require.NotEmpty(t, result.Id) - assert.Equal(t, ory.SELFSERVICESETTINGSFLOWSTATE_SUCCESS, result.State) + assert.EqualValues(t, ory.SELFSERVICESETTINGSFLOWSTATE_SUCCESS, result.State) assert.Equal(t, "not-"+email, result.Identity.Traits.(map[string]interface{})["email"].(string)) } diff --git a/examples/go/selfservice/verification/main.go b/examples/go/selfservice/verification/main.go index c6eba8114159..39229494eb4b 100644 --- a/examples/go/selfservice/verification/main.go +++ b/examples/go/selfservice/verification/main.go @@ -8,7 +8,7 @@ import ( "github.com/ory/kratos/examples/go/pkg" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" ) // If you use Open Source this would be: diff --git a/examples/go/selfservice/verification/main_test.go b/examples/go/selfservice/verification/main_test.go index 88be9b79e2af..8439c1468e71 100644 --- a/examples/go/selfservice/verification/main_test.go +++ b/examples/go/selfservice/verification/main_test.go @@ -6,17 +6,13 @@ package main import ( "testing" - ory "github.com/ory/kratos-client-go" - - "github.com/stretchr/testify/assert" - "github.com/google/uuid" - - "github.com/ory/kratos/internal/testhelpers" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/ory/kratos/examples/go/pkg" - - "github.com/stretchr/testify/require" + ory "github.com/ory/kratos/internal/httpclient" + "github.com/ory/kratos/internal/testhelpers" ) func TestFunc(t *testing.T) { @@ -25,5 +21,5 @@ func TestFunc(t *testing.T) { flow := performVerification("dev+" + uuid.New().String() + "@ory.sh") require.NotEmpty(t, flow.Id) - assert.Equal(t, ory.SELFSERVICEVERIFICATIONFLOWSTATE_SENT_EMAIL, flow.State) + assert.EqualValues(t, ory.SELFSERVICEVERIFICATIONFLOWSTATE_SENT_EMAIL, flow.State) } diff --git a/examples/go/session/tosession/main.go b/examples/go/session/tosession/main.go index 61e3a81d1d8d..ab3682567914 100644 --- a/examples/go/session/tosession/main.go +++ b/examples/go/session/tosession/main.go @@ -6,7 +6,7 @@ package main import ( "github.com/ory/kratos/examples/go/pkg" - ory "github.com/ory/kratos-client-go" + ory "github.com/ory/client-go" ) // If you use Open Source this would be: diff --git a/go.mod b/go.mod index ed09ccc2166c..70efcf1b3a53 100644 --- a/go.mod +++ b/go.mod @@ -6,14 +6,14 @@ replace ( github.com/bradleyjkemp/cupaloy/v2 => github.com/aeneasr/cupaloy/v2 v2.6.1-0.20210924214125-3dfdd01210a3 github.com/gorilla/sessions => github.com/ory/sessions v1.2.2-0.20220110165800-b09c17334dc2 github.com/knadh/koanf => github.com/aeneasr/koanf v0.14.1-0.20211230115640-aa3902b3267a - // github.com/luna-duclos/instrumentedsql => github.com/ory/instrumentedsql v1.2.0 - // github.com/luna-duclos/instrumentedsql/opentracing => github.com/ory/instrumentedsql/opentracing v0.0.0-20210903114257-c8963b546c5c + github.com/mattn/go-sqlite3 => github.com/mattn/go-sqlite3 v1.14.7-0.20210414154423-1157a4212dcb github.com/oleiade/reflections => github.com/oleiade/reflections v1.0.1 + + github.com/ory/client-go => ./internal/httpclient-ory + // Use the internal httpclient which can be generated in this codebase but mark it as the // official SDK, allowing for the Ory CLI to consume Ory Kratos' CLI commands. - github.com/ory/kratos-client-go => ./internal/httpclient - go.mongodb.org/mongo-driver => go.mongodb.org/mongo-driver v1.4.6 golang.org/x/sys => golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 gopkg.in/DataDog/dd-trace-go.v1 => gopkg.in/DataDog/dd-trace-go.v1 v1.27.1-0.20201005154917-54b73b3e126a @@ -67,14 +67,14 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe github.com/ory/analytics-go/v4 v4.0.3 + github.com/ory/client-go v0.2.0-alpha.60 github.com/ory/dockertest/v3 v3.9.1 github.com/ory/go-acc v0.2.8 github.com/ory/go-convenience v0.1.0 github.com/ory/graceful v0.1.3 github.com/ory/herodot v0.9.13 - github.com/ory/hydra-client-go v1.11.8 + github.com/ory/hydra-client-go v1.11.9-0.20221102130300-f558e85344c8 github.com/ory/jsonschema/v3 v3.0.7 - github.com/ory/kratos-client-go v0.6.3-alpha.1 github.com/ory/mail/v3 v3.0.0 github.com/ory/nosurf v1.2.7 github.com/ory/x v0.0.513 diff --git a/go.sum b/go.sum index e44f8edc9a22..b526ba6abcee 100644 --- a/go.sum +++ b/go.sum @@ -1126,8 +1126,8 @@ github.com/ory/graceful v0.1.3 h1:FaeXcHZh168WzS+bqruqWEw/HgXWLdNv2nJ+fbhxbhc= github.com/ory/graceful v0.1.3/go.mod h1:4zFz687IAF7oNHHiB586U4iL+/4aV09o/PYLE34t2bA= github.com/ory/herodot v0.9.13 h1:cN/Z4eOkErl/9W7hDIDLb79IO/bfsH+8yscBjRpB4IU= github.com/ory/herodot v0.9.13/go.mod h1:IWDs9kSvFQqw/cQ8zi5ksyYvITiUU4dI7glUrhZcJYo= -github.com/ory/hydra-client-go v1.11.8 h1:GwJjvH/DBcfYzoST4vUpi4pIRzDGH5oODKpIVuhwVyc= -github.com/ory/hydra-client-go v1.11.8/go.mod h1:4YuBuwUEC4yiyDrnKjGYc1tB3gUXan4ZiUYMjXJbfxA= +github.com/ory/hydra-client-go v1.11.9-0.20221102130300-f558e85344c8 h1:lxE11nBH6k0DvE1GMhWnZewGLAqVMSDj7cUhdHr9BHI= +github.com/ory/hydra-client-go v1.11.9-0.20221102130300-f558e85344c8/go.mod h1:4YuBuwUEC4yiyDrnKjGYc1tB3gUXan4ZiUYMjXJbfxA= github.com/ory/jsonschema/v3 v3.0.7 h1:GQ9qfZDiJqs4l2d3p56dozCChvejQFZyLKGHYzDzOSo= github.com/ory/jsonschema/v3 v3.0.7/go.mod h1:g8c8YOtN4TrR2wYeMdT02GDmzJDI0fEW2nI26BECafY= github.com/ory/mail v2.3.1+incompatible/go.mod h1:87D9/1gB6ewElQoN0lXJ0ayfqcj3cW3qCTXh+5E9mfU= @@ -1139,8 +1139,8 @@ github.com/ory/sessions v1.2.2-0.20220110165800-b09c17334dc2 h1:zm6sDvHy/U9XrGpi github.com/ory/sessions v1.2.2-0.20220110165800-b09c17334dc2/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/ory/viper v1.7.5 h1:+xVdq7SU3e1vNaCsk/ixsfxE4zylk1TJUiJrY647jUE= github.com/ory/viper v1.7.5/go.mod h1:ypOuyJmEUb3oENywQZRgeAMwqgOyDqwboO1tj3DjTaM= -github.com/ory/x v0.0.513 h1:45AruNHDwqhTvNtMnQy2/wYooMv+raVhuOP454mV/Os= -github.com/ory/x v0.0.513/go.mod h1:xUtRpoiRARyJNPVk/fcCNKzyp25Foxt9GPlj8pd7egY= +github.com/ory/x v0.0.511-0.20221108105728-3fed9bc99daf h1:sPEIGYHzmEu4tPiRUYgKfXPOAqneNuB1aaKvrT6aBXE= +github.com/ory/x v0.0.511-0.20221108105728-3fed9bc99daf/go.mod h1:xUtRpoiRARyJNPVk/fcCNKzyp25Foxt9GPlj8pd7egY= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= diff --git a/hydra/fake.go b/hydra/fake.go index 293261556d50..35d15d38643c 100644 --- a/hydra/fake.go +++ b/hydra/fake.go @@ -36,12 +36,12 @@ func (h *FakeHydra) AcceptLoginRequest(ctx context.Context, hlc uuid.UUID, sub s } } -func (h *FakeHydra) GetLoginRequest(ctx context.Context, hlc uuid.NullUUID) (*hydraclientgo.LoginRequest, error) { +func (h *FakeHydra) GetLoginRequest(ctx context.Context, hlc uuid.NullUUID) (*hydraclientgo.OAuth2LoginRequest, error) { switch hlc.UUID.String() { case FAKE_ACCEPT_REQUEST_FAIL: - return &hydraclientgo.LoginRequest{}, nil + return &hydraclientgo.OAuth2LoginRequest{}, nil case FAKE_SUCCESS: - return &hydraclientgo.LoginRequest{}, nil + return &hydraclientgo.OAuth2LoginRequest{}, nil default: panic("unknown fake login_challenge " + hlc.UUID.String()) } diff --git a/hydra/hydra.go b/hydra/hydra.go index fcda69d25aa3..bc8455ac8026 100644 --- a/hydra/hydra.go +++ b/hydra/hydra.go @@ -31,7 +31,7 @@ type ( } Hydra interface { AcceptLoginRequest(ctx context.Context, hlc uuid.UUID, sub string, amr session.AuthenticationMethods) (string, error) - GetLoginRequest(ctx context.Context, hlc uuid.NullUUID) (*hydraclientgo.LoginRequest, error) + GetLoginRequest(ctx context.Context, hlc uuid.NullUUID) (*hydraclientgo.OAuth2LoginRequest, error) } DefaultHydra struct { d hydraDependencies @@ -67,7 +67,7 @@ func (h *DefaultHydra) getAdminURL(ctx context.Context) (string, error) { return u.String(), nil } -func (h *DefaultHydra) getAdminAPIClient(ctx context.Context) (hydraclientgo.AdminApi, error) { +func (h *DefaultHydra) getAdminAPIClient(ctx context.Context) (hydraclientgo.OAuth2Api, error) { url, err := h.getAdminURL(ctx) if err != nil { return nil, err @@ -82,14 +82,14 @@ func (h *DefaultHydra) getAdminAPIClient(ctx context.Context) (hydraclientgo.Adm } configuration.HTTPClient = client - return hydraclientgo.NewAPIClient(configuration).AdminApi, nil + return hydraclientgo.NewAPIClient(configuration).OAuth2Api, nil } func (h *DefaultHydra) AcceptLoginRequest(ctx context.Context, hlc uuid.UUID, sub string, amr session.AuthenticationMethods) (string, error) { remember := h.d.Config().SessionPersistentCookie(ctx) rememberFor := int64(h.d.Config().SessionLifespan(ctx) / time.Second) - alr := hydraclientgo.NewAcceptLoginRequest(sub) + alr := hydraclientgo.NewAcceptOAuth2LoginRequest(sub) alr.Remember = &remember alr.RememberFor = &rememberFor alr.Amr = []string{} @@ -102,7 +102,7 @@ func (h *DefaultHydra) AcceptLoginRequest(ctx context.Context, hlc uuid.UUID, su return "", err } - resp, r, err := aa.AcceptLoginRequest(ctx).LoginChallenge(fmt.Sprintf("%x", hlc)).AcceptLoginRequest(*alr).Execute() + resp, r, err := aa.AcceptOAuth2LoginRequest(ctx).LoginChallenge(fmt.Sprintf("%x", hlc)).AcceptOAuth2LoginRequest(*alr).Execute() if err != nil { innerErr := herodot.ErrInternalServerError.WithWrap(err).WithReasonf("Unable to accept OAuth 2.0 Login Challenge.") if r != nil { @@ -116,7 +116,7 @@ func (h *DefaultHydra) AcceptLoginRequest(ctx context.Context, hlc uuid.UUID, su return resp.RedirectTo, nil } -func (h *DefaultHydra) GetLoginRequest(ctx context.Context, hlc uuid.NullUUID) (*hydraclientgo.LoginRequest, error) { +func (h *DefaultHydra) GetLoginRequest(ctx context.Context, hlc uuid.NullUUID) (*hydraclientgo.OAuth2LoginRequest, error) { if !hlc.Valid { return nil, errors.WithStack(herodot.ErrBadRequest.WithReason("invalid login_challenge")) } @@ -126,7 +126,7 @@ func (h *DefaultHydra) GetLoginRequest(ctx context.Context, hlc uuid.NullUUID) ( return nil, err } - hlr, r, err := aa.GetLoginRequest(ctx).LoginChallenge(fmt.Sprintf("%x", hlc.UUID)).Execute() + hlr, r, err := aa.GetOAuth2LoginRequest(ctx).LoginChallenge(fmt.Sprintf("%x", hlc.UUID)).Execute() if err != nil { innerErr := herodot.ErrInternalServerError.WithWrap(err).WithReasonf("Unable to get OAuth 2.0 Login Challenge.") if r != nil { diff --git a/internal/client-go/.gitignore b/internal/client-go/.gitignore new file mode 100644 index 000000000000..daf913b1b347 --- /dev/null +++ b/internal/client-go/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/internal/client-go/.openapi-generator-ignore b/internal/client-go/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/internal/client-go/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/internal/client-go/.openapi-generator/FILES b/internal/client-go/.openapi-generator/FILES new file mode 100644 index 000000000000..26dab1ea383a --- /dev/null +++ b/internal/client-go/.openapi-generator/FILES @@ -0,0 +1,210 @@ +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +api_metadata.go +api_v0alpha2.go +client.go +configuration.go +docs/AdminCreateIdentityBody.md +docs/AdminCreateIdentityImportCredentialsOidc.md +docs/AdminCreateIdentityImportCredentialsOidcConfig.md +docs/AdminCreateIdentityImportCredentialsOidcProvider.md +docs/AdminCreateIdentityImportCredentialsPassword.md +docs/AdminCreateIdentityImportCredentialsPasswordConfig.md +docs/AdminCreateSelfServiceRecoveryCodeBody.md +docs/AdminCreateSelfServiceRecoveryLinkBody.md +docs/AdminIdentityImportCredentials.md +docs/AdminUpdateIdentityBody.md +docs/AuthenticatorAssuranceLevel.md +docs/CourierMessageStatus.md +docs/CourierMessageType.md +docs/ErrorAuthenticatorAssuranceLevelNotSatisfied.md +docs/GenericError.md +docs/GetVersion200Response.md +docs/HealthNotReadyStatus.md +docs/HealthStatus.md +docs/Identity.md +docs/IdentityCredentials.md +docs/IdentityCredentialsOidc.md +docs/IdentityCredentialsOidcProvider.md +docs/IdentityCredentialsPassword.md +docs/IdentityCredentialsType.md +docs/IdentitySchemaContainer.md +docs/IdentityState.md +docs/IsAlive200Response.md +docs/IsReady503Response.md +docs/JsonError.md +docs/JsonPatch.md +docs/LoginRequest.md +docs/Message.md +docs/MetadataApi.md +docs/NeedsPrivilegedSessionError.md +docs/OAuth2Client.md +docs/OpenIDConnectContext.md +docs/Pagination.md +docs/RecoveryIdentityAddress.md +docs/RevokedSessions.md +docs/SelfServiceBrowserLocationChangeRequiredError.md +docs/SelfServiceError.md +docs/SelfServiceFlowExpiredError.md +docs/SelfServiceLoginFlow.md +docs/SelfServiceLogoutUrl.md +docs/SelfServiceRecoveryCode.md +docs/SelfServiceRecoveryFlow.md +docs/SelfServiceRecoveryFlowState.md +docs/SelfServiceRecoveryLink.md +docs/SelfServiceRegistrationFlow.md +docs/SelfServiceSettingsFlow.md +docs/SelfServiceSettingsFlowState.md +docs/SelfServiceVerificationFlow.md +docs/SelfServiceVerificationFlowState.md +docs/Session.md +docs/SessionAuthenticationMethod.md +docs/SessionDevice.md +docs/SettingsProfileFormConfig.md +docs/SubmitSelfServiceFlowWithWebAuthnRegistrationMethod.md +docs/SubmitSelfServiceLoginFlowBody.md +docs/SubmitSelfServiceLoginFlowWithLookupSecretMethodBody.md +docs/SubmitSelfServiceLoginFlowWithOidcMethodBody.md +docs/SubmitSelfServiceLoginFlowWithPasswordMethodBody.md +docs/SubmitSelfServiceLoginFlowWithTotpMethodBody.md +docs/SubmitSelfServiceLoginFlowWithWebAuthnMethodBody.md +docs/SubmitSelfServiceLogoutFlowWithoutBrowserBody.md +docs/SubmitSelfServiceRecoveryFlowBody.md +docs/SubmitSelfServiceRecoveryFlowWithCodeMethodBody.md +docs/SubmitSelfServiceRecoveryFlowWithLinkMethodBody.md +docs/SubmitSelfServiceRegistrationFlowBody.md +docs/SubmitSelfServiceRegistrationFlowWithOidcMethodBody.md +docs/SubmitSelfServiceRegistrationFlowWithPasswordMethodBody.md +docs/SubmitSelfServiceRegistrationFlowWithWebAuthnMethodBody.md +docs/SubmitSelfServiceSettingsFlowBody.md +docs/SubmitSelfServiceSettingsFlowWithLookupMethodBody.md +docs/SubmitSelfServiceSettingsFlowWithOidcMethodBody.md +docs/SubmitSelfServiceSettingsFlowWithPasswordMethodBody.md +docs/SubmitSelfServiceSettingsFlowWithProfileMethodBody.md +docs/SubmitSelfServiceSettingsFlowWithTotpMethodBody.md +docs/SubmitSelfServiceSettingsFlowWithWebAuthnMethodBody.md +docs/SubmitSelfServiceVerificationFlowBody.md +docs/SubmitSelfServiceVerificationFlowWithLinkMethodBody.md +docs/SuccessfulSelfServiceLoginWithoutBrowser.md +docs/SuccessfulSelfServiceRegistrationWithoutBrowser.md +docs/TokenPagination.md +docs/TokenPaginationHeaders.md +docs/UiContainer.md +docs/UiNode.md +docs/UiNodeAnchorAttributes.md +docs/UiNodeAttributes.md +docs/UiNodeImageAttributes.md +docs/UiNodeInputAttributes.md +docs/UiNodeMeta.md +docs/UiNodeScriptAttributes.md +docs/UiNodeTextAttributes.md +docs/UiText.md +docs/V0alpha2Api.md +docs/VerifiableIdentityAddress.md +docs/Version.md +git_push.sh +go.mod +go.sum +model_admin_create_identity_body.go +model_admin_create_identity_import_credentials_oidc.go +model_admin_create_identity_import_credentials_oidc_config.go +model_admin_create_identity_import_credentials_oidc_provider.go +model_admin_create_identity_import_credentials_password.go +model_admin_create_identity_import_credentials_password_config.go +model_admin_create_self_service_recovery_code_body.go +model_admin_create_self_service_recovery_link_body.go +model_admin_identity_import_credentials.go +model_admin_update_identity_body.go +model_authenticator_assurance_level.go +model_courier_message_status.go +model_courier_message_type.go +model_error_authenticator_assurance_level_not_satisfied.go +model_generic_error.go +model_get_version_200_response.go +model_health_not_ready_status.go +model_health_status.go +model_identity.go +model_identity_credentials.go +model_identity_credentials_oidc.go +model_identity_credentials_oidc_provider.go +model_identity_credentials_password.go +model_identity_credentials_type.go +model_identity_schema_container.go +model_identity_state.go +model_is_alive_200_response.go +model_is_ready_503_response.go +model_json_error.go +model_json_patch.go +model_login_request.go +model_message.go +model_needs_privileged_session_error.go +model_o_auth2_client.go +model_open_id_connect_context.go +model_pagination.go +model_recovery_identity_address.go +model_revoked_sessions.go +model_self_service_browser_location_change_required_error.go +model_self_service_error.go +model_self_service_flow_expired_error.go +model_self_service_login_flow.go +model_self_service_logout_url.go +model_self_service_recovery_code.go +model_self_service_recovery_flow.go +model_self_service_recovery_flow_state.go +model_self_service_recovery_link.go +model_self_service_registration_flow.go +model_self_service_settings_flow.go +model_self_service_settings_flow_state.go +model_self_service_verification_flow.go +model_self_service_verification_flow_state.go +model_session.go +model_session_authentication_method.go +model_session_device.go +model_settings_profile_form_config.go +model_submit_self_service_flow_with_web_authn_registration_method.go +model_submit_self_service_login_flow_body.go +model_submit_self_service_login_flow_with_lookup_secret_method_body.go +model_submit_self_service_login_flow_with_oidc_method_body.go +model_submit_self_service_login_flow_with_password_method_body.go +model_submit_self_service_login_flow_with_totp_method_body.go +model_submit_self_service_login_flow_with_web_authn_method_body.go +model_submit_self_service_logout_flow_without_browser_body.go +model_submit_self_service_recovery_flow_body.go +model_submit_self_service_recovery_flow_with_code_method_body.go +model_submit_self_service_recovery_flow_with_link_method_body.go +model_submit_self_service_registration_flow_body.go +model_submit_self_service_registration_flow_with_oidc_method_body.go +model_submit_self_service_registration_flow_with_password_method_body.go +model_submit_self_service_registration_flow_with_web_authn_method_body.go +model_submit_self_service_settings_flow_body.go +model_submit_self_service_settings_flow_with_lookup_method_body.go +model_submit_self_service_settings_flow_with_oidc_method_body.go +model_submit_self_service_settings_flow_with_password_method_body.go +model_submit_self_service_settings_flow_with_profile_method_body.go +model_submit_self_service_settings_flow_with_totp_method_body.go +model_submit_self_service_settings_flow_with_web_authn_method_body.go +model_submit_self_service_verification_flow_body.go +model_submit_self_service_verification_flow_with_link_method_body.go +model_successful_self_service_login_without_browser.go +model_successful_self_service_registration_without_browser.go +model_token_pagination.go +model_token_pagination_headers.go +model_ui_container.go +model_ui_node.go +model_ui_node_anchor_attributes.go +model_ui_node_attributes.go +model_ui_node_image_attributes.go +model_ui_node_input_attributes.go +model_ui_node_meta.go +model_ui_node_script_attributes.go +model_ui_node_text_attributes.go +model_ui_text.go +model_verifiable_identity_address.go +model_version.go +response.go +test/api_metadata_test.go +test/api_v0alpha2_test.go +utils.go diff --git a/internal/client-go/.openapi-generator/VERSION b/internal/client-go/.openapi-generator/VERSION new file mode 100644 index 000000000000..0df17dd0f6a3 --- /dev/null +++ b/internal/client-go/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/internal/client-go/.travis.yml b/internal/client-go/.travis.yml new file mode 100644 index 000000000000..f5cb2ce9a5aa --- /dev/null +++ b/internal/client-go/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/internal/client-go/README.md b/internal/client-go/README.md new file mode 100644 index 000000000000..193b41ff05c6 --- /dev/null +++ b/internal/client-go/README.md @@ -0,0 +1,268 @@ +# Go API client for client + +Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs +are exposed on different ports. Public APIs can face the public internet without any protection +while administrative APIs should never be exposed without prior authorization. To protect +the administative API port you should use something like Nginx, Ory Oathkeeper, or any other +technology capable of authorizing incoming requests. + + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```golang +import client "github.com/ory/client-go" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```golang +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. + +```golang +ctx := context.WithValue(context.Background(), client.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. + +```golang +ctx := context.WithValue(context.Background(), client.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identifield by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. + +``` +ctx := context.WithValue(context.Background(), client.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), client.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*MetadataApi* | [**GetVersion**](docs/MetadataApi.md#getversion) | **Get** /version | Return Running Software Version. +*MetadataApi* | [**IsAlive**](docs/MetadataApi.md#isalive) | **Get** /health/alive | Check HTTP Server Status +*MetadataApi* | [**IsReady**](docs/MetadataApi.md#isready) | **Get** /health/ready | Check HTTP Server and Database Status +*V0alpha2Api* | [**AdminCreateIdentity**](docs/V0alpha2Api.md#admincreateidentity) | **Post** /admin/identities | Create an Identity +*V0alpha2Api* | [**AdminCreateSelfServiceRecoveryCode**](docs/V0alpha2Api.md#admincreateselfservicerecoverycode) | **Post** /admin/recovery/code | Create a Recovery Code +*V0alpha2Api* | [**AdminCreateSelfServiceRecoveryLink**](docs/V0alpha2Api.md#admincreateselfservicerecoverylink) | **Post** /admin/recovery/link | Create a Recovery Link +*V0alpha2Api* | [**AdminDeleteIdentity**](docs/V0alpha2Api.md#admindeleteidentity) | **Delete** /admin/identities/{id} | Delete an Identity +*V0alpha2Api* | [**AdminDeleteIdentitySessions**](docs/V0alpha2Api.md#admindeleteidentitysessions) | **Delete** /admin/identities/{id}/sessions | Delete & Invalidate an Identity's Sessions +*V0alpha2Api* | [**AdminExtendSession**](docs/V0alpha2Api.md#adminextendsession) | **Patch** /admin/sessions/{id}/extend | Extend a Session +*V0alpha2Api* | [**AdminGetIdentity**](docs/V0alpha2Api.md#admingetidentity) | **Get** /admin/identities/{id} | Get an Identity +*V0alpha2Api* | [**AdminGetSession**](docs/V0alpha2Api.md#admingetsession) | **Get** /admin/sessions/{id} | This endpoint returns the session object with expandables specified. +*V0alpha2Api* | [**AdminListCourierMessages**](docs/V0alpha2Api.md#adminlistcouriermessages) | **Get** /admin/courier/messages | List Messages +*V0alpha2Api* | [**AdminListIdentities**](docs/V0alpha2Api.md#adminlistidentities) | **Get** /admin/identities | List Identities +*V0alpha2Api* | [**AdminListIdentitySessions**](docs/V0alpha2Api.md#adminlistidentitysessions) | **Get** /admin/identities/{id}/sessions | List an Identity's Sessions +*V0alpha2Api* | [**AdminListSessions**](docs/V0alpha2Api.md#adminlistsessions) | **Get** /admin/sessions | This endpoint returns all sessions that exist. +*V0alpha2Api* | [**AdminPatchIdentity**](docs/V0alpha2Api.md#adminpatchidentity) | **Patch** /admin/identities/{id} | Patch an Identity +*V0alpha2Api* | [**AdminUpdateIdentity**](docs/V0alpha2Api.md#adminupdateidentity) | **Put** /admin/identities/{id} | Update an Identity +*V0alpha2Api* | [**CreateSelfServiceLogoutFlowUrlForBrowsers**](docs/V0alpha2Api.md#createselfservicelogoutflowurlforbrowsers) | **Get** /self-service/logout/browser | Create a Logout URL for Browsers +*V0alpha2Api* | [**GetIdentitySchema**](docs/V0alpha2Api.md#getidentityschema) | **Get** /schemas/{id} | +*V0alpha2Api* | [**GetSelfServiceError**](docs/V0alpha2Api.md#getselfserviceerror) | **Get** /self-service/errors | Get Self-Service Errors +*V0alpha2Api* | [**GetSelfServiceLoginFlow**](docs/V0alpha2Api.md#getselfserviceloginflow) | **Get** /self-service/login/flows | Get Login Flow +*V0alpha2Api* | [**GetSelfServiceRecoveryFlow**](docs/V0alpha2Api.md#getselfservicerecoveryflow) | **Get** /self-service/recovery/flows | Get Recovery Flow +*V0alpha2Api* | [**GetSelfServiceRegistrationFlow**](docs/V0alpha2Api.md#getselfserviceregistrationflow) | **Get** /self-service/registration/flows | Get Registration Flow +*V0alpha2Api* | [**GetSelfServiceSettingsFlow**](docs/V0alpha2Api.md#getselfservicesettingsflow) | **Get** /self-service/settings/flows | Get Settings Flow +*V0alpha2Api* | [**GetSelfServiceVerificationFlow**](docs/V0alpha2Api.md#getselfserviceverificationflow) | **Get** /self-service/verification/flows | Get Verification Flow +*V0alpha2Api* | [**GetWebAuthnJavaScript**](docs/V0alpha2Api.md#getwebauthnjavascript) | **Get** /.well-known/ory/webauthn.js | Get WebAuthn JavaScript +*V0alpha2Api* | [**InitializeSelfServiceLoginFlowForBrowsers**](docs/V0alpha2Api.md#initializeselfserviceloginflowforbrowsers) | **Get** /self-service/login/browser | Initialize Login Flow for Browsers +*V0alpha2Api* | [**InitializeSelfServiceLoginFlowWithoutBrowser**](docs/V0alpha2Api.md#initializeselfserviceloginflowwithoutbrowser) | **Get** /self-service/login/api | Initialize Login Flow for APIs, Services, Apps, ... +*V0alpha2Api* | [**InitializeSelfServiceRecoveryFlowForBrowsers**](docs/V0alpha2Api.md#initializeselfservicerecoveryflowforbrowsers) | **Get** /self-service/recovery/browser | Initialize Recovery Flow for Browsers +*V0alpha2Api* | [**InitializeSelfServiceRecoveryFlowWithoutBrowser**](docs/V0alpha2Api.md#initializeselfservicerecoveryflowwithoutbrowser) | **Get** /self-service/recovery/api | Initialize Recovery Flow for APIs, Services, Apps, ... +*V0alpha2Api* | [**InitializeSelfServiceRegistrationFlowForBrowsers**](docs/V0alpha2Api.md#initializeselfserviceregistrationflowforbrowsers) | **Get** /self-service/registration/browser | Initialize Registration Flow for Browsers +*V0alpha2Api* | [**InitializeSelfServiceRegistrationFlowWithoutBrowser**](docs/V0alpha2Api.md#initializeselfserviceregistrationflowwithoutbrowser) | **Get** /self-service/registration/api | Initialize Registration Flow for APIs, Services, Apps, ... +*V0alpha2Api* | [**InitializeSelfServiceSettingsFlowForBrowsers**](docs/V0alpha2Api.md#initializeselfservicesettingsflowforbrowsers) | **Get** /self-service/settings/browser | Initialize Settings Flow for Browsers +*V0alpha2Api* | [**InitializeSelfServiceSettingsFlowWithoutBrowser**](docs/V0alpha2Api.md#initializeselfservicesettingsflowwithoutbrowser) | **Get** /self-service/settings/api | Initialize Settings Flow for APIs, Services, Apps, ... +*V0alpha2Api* | [**InitializeSelfServiceVerificationFlowForBrowsers**](docs/V0alpha2Api.md#initializeselfserviceverificationflowforbrowsers) | **Get** /self-service/verification/browser | Initialize Verification Flow for Browser Clients +*V0alpha2Api* | [**InitializeSelfServiceVerificationFlowWithoutBrowser**](docs/V0alpha2Api.md#initializeselfserviceverificationflowwithoutbrowser) | **Get** /self-service/verification/api | Initialize Verification Flow for APIs, Services, Apps, ... +*V0alpha2Api* | [**ListIdentitySchemas**](docs/V0alpha2Api.md#listidentityschemas) | **Get** /schemas | +*V0alpha2Api* | [**ListSessions**](docs/V0alpha2Api.md#listsessions) | **Get** /sessions | Get Active Sessions +*V0alpha2Api* | [**RevokeSession**](docs/V0alpha2Api.md#revokesession) | **Delete** /sessions/{id} | Invalidate a Session +*V0alpha2Api* | [**RevokeSessions**](docs/V0alpha2Api.md#revokesessions) | **Delete** /sessions | Invalidate all Other Sessions +*V0alpha2Api* | [**SubmitSelfServiceLoginFlow**](docs/V0alpha2Api.md#submitselfserviceloginflow) | **Post** /self-service/login | Submit a Login Flow +*V0alpha2Api* | [**SubmitSelfServiceLogoutFlow**](docs/V0alpha2Api.md#submitselfservicelogoutflow) | **Get** /self-service/logout | Complete Self-Service Logout +*V0alpha2Api* | [**SubmitSelfServiceLogoutFlowWithoutBrowser**](docs/V0alpha2Api.md#submitselfservicelogoutflowwithoutbrowser) | **Delete** /self-service/logout/api | Perform Logout for APIs, Services, Apps, ... +*V0alpha2Api* | [**SubmitSelfServiceRecoveryFlow**](docs/V0alpha2Api.md#submitselfservicerecoveryflow) | **Post** /self-service/recovery | Complete Recovery Flow +*V0alpha2Api* | [**SubmitSelfServiceRegistrationFlow**](docs/V0alpha2Api.md#submitselfserviceregistrationflow) | **Post** /self-service/registration | Submit a Registration Flow +*V0alpha2Api* | [**SubmitSelfServiceSettingsFlow**](docs/V0alpha2Api.md#submitselfservicesettingsflow) | **Post** /self-service/settings | Complete Settings Flow +*V0alpha2Api* | [**SubmitSelfServiceVerificationFlow**](docs/V0alpha2Api.md#submitselfserviceverificationflow) | **Post** /self-service/verification | Complete Verification Flow +*V0alpha2Api* | [**ToSession**](docs/V0alpha2Api.md#tosession) | **Get** /sessions/whoami | Check Who the Current HTTP Session Belongs To + + +## Documentation For Models + + - [AdminCreateIdentityBody](docs/AdminCreateIdentityBody.md) + - [AdminCreateIdentityImportCredentialsOidc](docs/AdminCreateIdentityImportCredentialsOidc.md) + - [AdminCreateIdentityImportCredentialsOidcConfig](docs/AdminCreateIdentityImportCredentialsOidcConfig.md) + - [AdminCreateIdentityImportCredentialsOidcProvider](docs/AdminCreateIdentityImportCredentialsOidcProvider.md) + - [AdminCreateIdentityImportCredentialsPassword](docs/AdminCreateIdentityImportCredentialsPassword.md) + - [AdminCreateIdentityImportCredentialsPasswordConfig](docs/AdminCreateIdentityImportCredentialsPasswordConfig.md) + - [AdminCreateSelfServiceRecoveryCodeBody](docs/AdminCreateSelfServiceRecoveryCodeBody.md) + - [AdminCreateSelfServiceRecoveryLinkBody](docs/AdminCreateSelfServiceRecoveryLinkBody.md) + - [AdminIdentityImportCredentials](docs/AdminIdentityImportCredentials.md) + - [AdminUpdateIdentityBody](docs/AdminUpdateIdentityBody.md) + - [AuthenticatorAssuranceLevel](docs/AuthenticatorAssuranceLevel.md) + - [CourierMessageStatus](docs/CourierMessageStatus.md) + - [CourierMessageType](docs/CourierMessageType.md) + - [ErrorAuthenticatorAssuranceLevelNotSatisfied](docs/ErrorAuthenticatorAssuranceLevelNotSatisfied.md) + - [GenericError](docs/GenericError.md) + - [GetVersion200Response](docs/GetVersion200Response.md) + - [HealthNotReadyStatus](docs/HealthNotReadyStatus.md) + - [HealthStatus](docs/HealthStatus.md) + - [Identity](docs/Identity.md) + - [IdentityCredentials](docs/IdentityCredentials.md) + - [IdentityCredentialsOidc](docs/IdentityCredentialsOidc.md) + - [IdentityCredentialsOidcProvider](docs/IdentityCredentialsOidcProvider.md) + - [IdentityCredentialsPassword](docs/IdentityCredentialsPassword.md) + - [IdentityCredentialsType](docs/IdentityCredentialsType.md) + - [IdentitySchemaContainer](docs/IdentitySchemaContainer.md) + - [IdentityState](docs/IdentityState.md) + - [IsAlive200Response](docs/IsAlive200Response.md) + - [IsReady503Response](docs/IsReady503Response.md) + - [JsonError](docs/JsonError.md) + - [JsonPatch](docs/JsonPatch.md) + - [LoginRequest](docs/LoginRequest.md) + - [Message](docs/Message.md) + - [NeedsPrivilegedSessionError](docs/NeedsPrivilegedSessionError.md) + - [OAuth2Client](docs/OAuth2Client.md) + - [OpenIDConnectContext](docs/OpenIDConnectContext.md) + - [Pagination](docs/Pagination.md) + - [RecoveryIdentityAddress](docs/RecoveryIdentityAddress.md) + - [RevokedSessions](docs/RevokedSessions.md) + - [SelfServiceBrowserLocationChangeRequiredError](docs/SelfServiceBrowserLocationChangeRequiredError.md) + - [SelfServiceError](docs/SelfServiceError.md) + - [SelfServiceFlowExpiredError](docs/SelfServiceFlowExpiredError.md) + - [SelfServiceLoginFlow](docs/SelfServiceLoginFlow.md) + - [SelfServiceLogoutUrl](docs/SelfServiceLogoutUrl.md) + - [SelfServiceRecoveryCode](docs/SelfServiceRecoveryCode.md) + - [SelfServiceRecoveryFlow](docs/SelfServiceRecoveryFlow.md) + - [SelfServiceRecoveryFlowState](docs/SelfServiceRecoveryFlowState.md) + - [SelfServiceRecoveryLink](docs/SelfServiceRecoveryLink.md) + - [SelfServiceRegistrationFlow](docs/SelfServiceRegistrationFlow.md) + - [SelfServiceSettingsFlow](docs/SelfServiceSettingsFlow.md) + - [SelfServiceSettingsFlowState](docs/SelfServiceSettingsFlowState.md) + - [SelfServiceVerificationFlow](docs/SelfServiceVerificationFlow.md) + - [SelfServiceVerificationFlowState](docs/SelfServiceVerificationFlowState.md) + - [Session](docs/Session.md) + - [SessionAuthenticationMethod](docs/SessionAuthenticationMethod.md) + - [SessionDevice](docs/SessionDevice.md) + - [SettingsProfileFormConfig](docs/SettingsProfileFormConfig.md) + - [SubmitSelfServiceFlowWithWebAuthnRegistrationMethod](docs/SubmitSelfServiceFlowWithWebAuthnRegistrationMethod.md) + - [SubmitSelfServiceLoginFlowBody](docs/SubmitSelfServiceLoginFlowBody.md) + - [SubmitSelfServiceLoginFlowWithLookupSecretMethodBody](docs/SubmitSelfServiceLoginFlowWithLookupSecretMethodBody.md) + - [SubmitSelfServiceLoginFlowWithOidcMethodBody](docs/SubmitSelfServiceLoginFlowWithOidcMethodBody.md) + - [SubmitSelfServiceLoginFlowWithPasswordMethodBody](docs/SubmitSelfServiceLoginFlowWithPasswordMethodBody.md) + - [SubmitSelfServiceLoginFlowWithTotpMethodBody](docs/SubmitSelfServiceLoginFlowWithTotpMethodBody.md) + - [SubmitSelfServiceLoginFlowWithWebAuthnMethodBody](docs/SubmitSelfServiceLoginFlowWithWebAuthnMethodBody.md) + - [SubmitSelfServiceLogoutFlowWithoutBrowserBody](docs/SubmitSelfServiceLogoutFlowWithoutBrowserBody.md) + - [SubmitSelfServiceRecoveryFlowBody](docs/SubmitSelfServiceRecoveryFlowBody.md) + - [SubmitSelfServiceRecoveryFlowWithCodeMethodBody](docs/SubmitSelfServiceRecoveryFlowWithCodeMethodBody.md) + - [SubmitSelfServiceRecoveryFlowWithLinkMethodBody](docs/SubmitSelfServiceRecoveryFlowWithLinkMethodBody.md) + - [SubmitSelfServiceRegistrationFlowBody](docs/SubmitSelfServiceRegistrationFlowBody.md) + - [SubmitSelfServiceRegistrationFlowWithOidcMethodBody](docs/SubmitSelfServiceRegistrationFlowWithOidcMethodBody.md) + - [SubmitSelfServiceRegistrationFlowWithPasswordMethodBody](docs/SubmitSelfServiceRegistrationFlowWithPasswordMethodBody.md) + - [SubmitSelfServiceRegistrationFlowWithWebAuthnMethodBody](docs/SubmitSelfServiceRegistrationFlowWithWebAuthnMethodBody.md) + - [SubmitSelfServiceSettingsFlowBody](docs/SubmitSelfServiceSettingsFlowBody.md) + - [SubmitSelfServiceSettingsFlowWithLookupMethodBody](docs/SubmitSelfServiceSettingsFlowWithLookupMethodBody.md) + - [SubmitSelfServiceSettingsFlowWithOidcMethodBody](docs/SubmitSelfServiceSettingsFlowWithOidcMethodBody.md) + - [SubmitSelfServiceSettingsFlowWithPasswordMethodBody](docs/SubmitSelfServiceSettingsFlowWithPasswordMethodBody.md) + - [SubmitSelfServiceSettingsFlowWithProfileMethodBody](docs/SubmitSelfServiceSettingsFlowWithProfileMethodBody.md) + - [SubmitSelfServiceSettingsFlowWithTotpMethodBody](docs/SubmitSelfServiceSettingsFlowWithTotpMethodBody.md) + - [SubmitSelfServiceSettingsFlowWithWebAuthnMethodBody](docs/SubmitSelfServiceSettingsFlowWithWebAuthnMethodBody.md) + - [SubmitSelfServiceVerificationFlowBody](docs/SubmitSelfServiceVerificationFlowBody.md) + - [SubmitSelfServiceVerificationFlowWithLinkMethodBody](docs/SubmitSelfServiceVerificationFlowWithLinkMethodBody.md) + - [SuccessfulSelfServiceLoginWithoutBrowser](docs/SuccessfulSelfServiceLoginWithoutBrowser.md) + - [SuccessfulSelfServiceRegistrationWithoutBrowser](docs/SuccessfulSelfServiceRegistrationWithoutBrowser.md) + - [TokenPagination](docs/TokenPagination.md) + - [TokenPaginationHeaders](docs/TokenPaginationHeaders.md) + - [UiContainer](docs/UiContainer.md) + - [UiNode](docs/UiNode.md) + - [UiNodeAnchorAttributes](docs/UiNodeAnchorAttributes.md) + - [UiNodeAttributes](docs/UiNodeAttributes.md) + - [UiNodeImageAttributes](docs/UiNodeImageAttributes.md) + - [UiNodeInputAttributes](docs/UiNodeInputAttributes.md) + - [UiNodeMeta](docs/UiNodeMeta.md) + - [UiNodeScriptAttributes](docs/UiNodeScriptAttributes.md) + - [UiNodeTextAttributes](docs/UiNodeTextAttributes.md) + - [UiText](docs/UiText.md) + - [VerifiableIdentityAddress](docs/VerifiableIdentityAddress.md) + - [Version](docs/Version.md) + + +## Documentation For Authorization + + + +### oryAccessToken + +- **Type**: API key +- **API key parameter name**: Authorization +- **Location**: HTTP header + +Note, each API key must be added to a map of `map[string]APIKey` where the key is: Authorization and passed in as the auth context for each request. + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + +hi@ory.sh + diff --git a/internal/client-go/api/openapi.yaml b/internal/client-go/api/openapi.yaml new file mode 100644 index 000000000000..57b2cffbf9a7 --- /dev/null +++ b/internal/client-go/api/openapi.yaml @@ -0,0 +1,7074 @@ +openapi: 3.0.3 +info: + contact: + email: hi@ory.sh + description: | + Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs + are exposed on different ports. Public APIs can face the public internet without any protection + while administrative APIs should never be exposed without prior authorization. To protect + the administative API port you should use something like Nginx, Ory Oathkeeper, or any other + technology capable of authorizing incoming requests. + license: + name: Apache 2.0 + title: Ory Kratos API + version: "" +servers: +- url: / +paths: + /.well-known/ory/webauthn.js: + get: + description: |- + This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. + + If you are building a JavaScript Browser App (e.g. in ReactJS or AngularJS) you will need to load this file: + + ```html +