From 3c8d5e02b04686a1e0bfbd28caa0bc536e3414e4 Mon Sep 17 00:00:00 2001 From: Gajewski Dmitriy Date: Fri, 28 Aug 2020 11:40:58 +0300 Subject: [PATCH] refactor: rename request_lifespan to lifespan (#677) Closes #666 BREAKING CHANGE: Configuration items `selfservice.flows..request_lifespan` have been renamed to `selfservice.flows..lifespan` to match the new flow semantics. --- .schema/api.swagger.json | 4 +-- .schema/config.schema.json | 10 +++--- .../kratos/email-password/kratos.yml | 4 +-- docs/docs/reference/configuration.md | 36 +++++++++---------- driver/configuration/provider_viper.go | 10 +++--- .../stub/.defaults-verification.yml | 2 +- internal/.kratos.yaml | 10 +++--- .../httpclient/client/admin/admin_client.go | 2 +- .../admin/create_recovery_link_responses.go | 2 +- .../strategy/recoverytoken/strategy.go | 2 +- test/e2e/profiles/recovery/.kratos.yml | 2 +- test/e2e/profiles/verification/.kratos.yml | 2 +- .../wrongTypes.main.yaml | 6 ++-- .../allKeys.main.yaml | 6 ++-- 14 files changed, 49 insertions(+), 49 deletions(-) diff --git a/.schema/api.swagger.json b/.schema/api.swagger.json index ee8caf33a11..9f8f9515b1a 100755 --- a/.schema/api.swagger.json +++ b/.schema/api.swagger.json @@ -322,7 +322,7 @@ }, "/metrics/prometheus": { "get": { - "description": "```\nmetadata:\nannotations:\nprometheus.io/port: \"4445\"\nprometheus.io/path: \"/metrics/prometheus\"\n```", + "description": "```\nmetadata:\nannotations:\nprometheus.io/port: \"4434\"\nprometheus.io/path: \"/metrics/prometheus\"\n```", "produces": [ "plain/text" ], @@ -367,7 +367,7 @@ ], "properties": { "expires_in": { - "description": "Link Expires In\n\nThe recovery link will expire at that point in time. Defaults to the configuration value of\n`selfservice.flows.recovery.request_lifespan`.", + "description": "Link Expires In\n\nThe recovery link will expire at that point in time. Defaults to the configuration value of\n`selfservice.flows.recovery.lifespan`.", "type": "string", "pattern": "^[0-9]+(ns|us|ms|s|m|h)$" }, diff --git a/.schema/config.schema.json b/.schema/config.schema.json index 4a23e1c0be5..367db0d5cd8 100644 --- a/.schema/config.schema.json +++ b/.schema/config.schema.json @@ -304,7 +304,7 @@ ], "default": "https://www.ory.sh/kratos/docs/fallback/settings" }, - "request_lifespan": { + "lifespan": { "type": "string", "pattern": "^[0-9]+(ns|us|ms|s|m|h)$", "default": "1h", @@ -358,7 +358,7 @@ ], "default": "https://www.ory.sh/kratos/docs/fallback/registration" }, - "request_lifespan": { + "lifespan": { "type": "string", "pattern": "^[0-9]+(ns|us|ms|s|m|h)$", "default": "1h", @@ -387,7 +387,7 @@ ], "default": "https://www.ory.sh/kratos/docs/fallback/login" }, - "request_lifespan": { + "lifespan": { "type": "string", "pattern": "^[0-9]+(ns|us|ms|s|m|h)$", "default": "1h", @@ -432,7 +432,7 @@ }, "additionalProperties": false }, - "request_lifespan": { + "lifespan": { "title": "Self-Service Verification Request Lifespan", "description": "Sets how long the verification request (for the UI interaction) is valid.", "type": "string", @@ -476,7 +476,7 @@ }, "additionalProperties": false }, - "request_lifespan": { + "lifespan": { "title": "Self-Service Recovery Request Lifespan", "description": "Sets how long the recovery request is valid. If expired, the user has to redo the flow.", "type": "string", diff --git a/contrib/quickstart/kratos/email-password/kratos.yml b/contrib/quickstart/kratos/email-password/kratos.yml index 1b633f6a03f..cf8c3fc92fd 100644 --- a/contrib/quickstart/kratos/email-password/kratos.yml +++ b/contrib/quickstart/kratos/email-password/kratos.yml @@ -41,10 +41,10 @@ selfservice: login: ui_url: http://127.0.0.1:4455/auth/login - request_lifespan: 10m + lifespan: 10m registration: - request_lifespan: 10m + lifespan: 10m ui_url: http://127.0.0.1:4455/auth/registration after: password: diff --git a/docs/docs/reference/configuration.md b/docs/docs/reference/configuration.md index 5d3f576d9fa..5d386a2102d 100644 --- a/docs/docs/reference/configuration.md +++ b/docs/docs/reference/configuration.md @@ -151,7 +151,7 @@ selfservice: # ui_url: https://www.ory.sh/kratos/docs/fallback/settings - ## request_lifespan ## + ## lifespan ## # # Default value: 1h # @@ -162,11 +162,11 @@ selfservice: # # Set this value using environment variables on # - Linux/macOS: - # $ export SELFSERVICE_FLOWS_SETTINGS_REQUEST_LIFESPAN= + # $ export SELFSERVICE_FLOWS_SETTINGS_LIFESPAN= # - Windows Command Line (CMD): - # > set SELFSERVICE_FLOWS_SETTINGS_REQUEST_LIFESPAN= + # > set SELFSERVICE_FLOWS_SETTINGS_LIFESPAN= # - request_lifespan: 1h + lifespan: 1h ## privileged_session_max_age ## # @@ -302,7 +302,7 @@ selfservice: # ui_url: https://www.ory.sh/kratos/docs/fallback/registration - ## request_lifespan ## + ## lifespan ## # # Default value: 1h # @@ -313,11 +313,11 @@ selfservice: # # Set this value using environment variables on # - Linux/macOS: - # $ export SELFSERVICE_FLOWS_REGISTRATION_REQUEST_LIFESPAN= + # $ export SELFSERVICE_FLOWS_REGISTRATION_LIFESPAN= # - Windows Command Line (CMD): - # > set SELFSERVICE_FLOWS_REGISTRATION_REQUEST_LIFESPAN= + # > set SELFSERVICE_FLOWS_REGISTRATION_LIFESPAN= # - request_lifespan: 1m + lifespan: 1m ## after ## # @@ -415,7 +415,7 @@ selfservice: # ui_url: https://my-app.com/login - ## request_lifespan ## + ## lifespan ## # # Default value: 1h # @@ -426,11 +426,11 @@ selfservice: # # Set this value using environment variables on # - Linux/macOS: - # $ export SELFSERVICE_FLOWS_LOGIN_REQUEST_LIFESPAN= + # $ export SELFSERVICE_FLOWS_LOGIN_LIFESPAN= # - Windows Command Line (CMD): - # > set SELFSERVICE_FLOWS_LOGIN_REQUEST_LIFESPAN= + # > set SELFSERVICE_FLOWS_LOGIN_LIFESPAN= # - request_lifespan: 1h + lifespan: 1h ## after ## # @@ -573,11 +573,11 @@ selfservice: # # Set this value using environment variables on # - Linux/macOS: - # $ export SELFSERVICE_FLOWS_VERIFICATION_REQUEST_LIFESPAN= + # $ export SELFSERVICE_FLOWS_VERIFICATION_LIFESPAN= # - Windows Command Line (CMD): - # > set SELFSERVICE_FLOWS_VERIFICATION_REQUEST_LIFESPAN= + # > set SELFSERVICE_FLOWS_VERIFICATION_LIFESPAN= # - request_lifespan: 1m + lifespan: 1m ## Account Recovery Configuration ## # @@ -644,11 +644,11 @@ selfservice: # # Set this value using environment variables on # - Linux/macOS: - # $ export SELFSERVICE_FLOWS_RECOVERY_REQUEST_LIFESPAN= + # $ export SELFSERVICE_FLOWS_RECOVERY_LIFESPAN= # - Windows Command Line (CMD): - # > set SELFSERVICE_FLOWS_RECOVERY_REQUEST_LIFESPAN= + # > set SELFSERVICE_FLOWS_RECOVERY_LIFESPAN= # - request_lifespan: 1s + lifespan: 1s ## error ## # diff --git a/driver/configuration/provider_viper.go b/driver/configuration/provider_viper.go index aa54adf8ced..92f8e71db1f 100644 --- a/driver/configuration/provider_viper.go +++ b/driver/configuration/provider_viper.go @@ -67,12 +67,12 @@ const ( ViperKeyURLsWhitelistedReturnToDomains = "selfservice.whitelisted_return_urls" ViperKeySelfServiceRegistrationUI = "selfservice.flows.registration.ui_url" - ViperKeySelfServiceRegistrationRequestLifespan = "selfservice.flows.registration.request_lifespan" + ViperKeySelfServiceRegistrationRequestLifespan = "selfservice.flows.registration.lifespan" ViperKeySelfServiceRegistrationAfter = "selfservice.flows.registration.after" ViperKeySelfServiceRegistrationBeforeHooks = "selfservice.flows.registration.before.hooks" ViperKeySelfServiceLoginUI = "selfservice.flows.login.ui_url" - ViperKeySelfServiceLoginRequestLifespan = "selfservice.flows.login.request_lifespan" + ViperKeySelfServiceLoginRequestLifespan = "selfservice.flows.login.lifespan" ViperKeySelfServiceLoginAfter = "selfservice.flows.login.after" ViperKeySelfServiceLoginBeforeHooks = "selfservice.flows.login.before.hooks" @@ -82,17 +82,17 @@ const ( ViperKeySelfServiceSettingsURL = "selfservice.flows.settings.ui_url" ViperKeySelfServiceSettingsAfter = "selfservice.flows.settings.after" - ViperKeySelfServiceSettingsRequestLifespan = "selfservice.flows.settings.request_lifespan" + ViperKeySelfServiceSettingsRequestLifespan = "selfservice.flows.settings.lifespan" ViperKeySelfServiceSettingsPrivilegedAuthenticationAfter = "selfservice.flows.settings.privileged_session_max_age" ViperKeySelfServiceRecoveryEnabled = "selfservice.flows.recovery.enabled" ViperKeySelfServiceRecoveryUI = "selfservice.flows.recovery.ui_url" - ViperKeySelfServiceRecoveryRequestLifespan = "selfservice.flows.recovery.request_lifespan" + ViperKeySelfServiceRecoveryRequestLifespan = "selfservice.flows.recovery.lifespan" ViperKeySelfServiceRecoveryBrowserDefaultReturnTo = "selfservice.flows.recovery.after." + DefaultBrowserReturnURL ViperKeySelfServiceVerificationEnabled = "selfservice.flows.verification.enabled" ViperKeySelfServiceVerificationUI = "selfservice.flows.verification.ui_url" - ViperKeySelfServiceVerificationRequestLifespan = "selfservice.flows.verification.request_lifespan" + ViperKeySelfServiceVerificationRequestLifespan = "selfservice.flows.verification.lifespan" ViperKeySelfServiceVerificationBrowserDefaultReturnTo = "selfservice.flows.verification.after." + DefaultBrowserReturnURL ViperKeyDefaultIdentitySchemaURL = "identity.default_schema_url" diff --git a/driver/configuration/stub/.defaults-verification.yml b/driver/configuration/stub/.defaults-verification.yml index f97bc085e0a..eae84dd5759 100644 --- a/driver/configuration/stub/.defaults-verification.yml +++ b/driver/configuration/stub/.defaults-verification.yml @@ -9,7 +9,7 @@ selfservice: verification: enabled: true - request_lifespan: 5s + lifespan: 5s after: default_browser_return_url: http://127.0.0.1:4455/ diff --git a/internal/.kratos.yaml b/internal/.kratos.yaml index 96ff56b5406..b8689f94c40 100644 --- a/internal/.kratos.yaml +++ b/internal/.kratos.yaml @@ -65,20 +65,20 @@ selfservice: recovery: enabled: true ui_url: http://test.kratos.ory.sh/recovery - request_lifespan: 98m + lifespan: 98m after: default_browser_return_url: http://test.kratos.ory.sh/dashboard verification: enabled: true - request_lifespan: 97m + lifespan: 97m ui_url: http://test.kratos.ory.sh/verification after: default_browser_return_url: http://test.kratos.ory.sh/dashboard settings: ui_url: http://test.kratos.ory.sh/settings - request_lifespan: 99m + lifespan: 99m privileged_session_max_age: 5m after: default_browser_return_url: https://self-service/settings/return_to @@ -86,7 +86,7 @@ selfservice: default_browser_return_url: https://self-service/settings/password/return_to login: ui_url: http://test.kratos.ory.sh/login - request_lifespan: 99m + lifespan: 99m after: default_browser_return_url: https://self-service/login/return_to password: @@ -100,7 +100,7 @@ selfservice: hook: revoke_active_sessions registration: ui_url: http://test.kratos.ory.sh/register - request_lifespan: 98m + lifespan: 98m after: default_browser_return_url: https://self-service/registration/return_to password: diff --git a/internal/httpclient/client/admin/admin_client.go b/internal/httpclient/client/admin/admin_client.go index a47919a2d15..80c33ec3480 100644 --- a/internal/httpclient/client/admin/admin_client.go +++ b/internal/httpclient/client/admin/admin_client.go @@ -240,7 +240,7 @@ func (a *Client) ListIdentities(params *ListIdentitiesParams) (*ListIdentitiesOK ``` metadata: annotations: -prometheus.io/port: "4445" +prometheus.io/port: "4434" prometheus.io/path: "/metrics/prometheus" ``` */ diff --git a/internal/httpclient/client/admin/create_recovery_link_responses.go b/internal/httpclient/client/admin/create_recovery_link_responses.go index eb651d02aba..9803d60e91f 100644 --- a/internal/httpclient/client/admin/create_recovery_link_responses.go +++ b/internal/httpclient/client/admin/create_recovery_link_responses.go @@ -196,7 +196,7 @@ type CreateRecoveryLinkBody struct { // Link Expires In // // The recovery link will expire at that point in time. Defaults to the configuration value of - // `selfservice.flows.recovery.request_lifespan`. + // `selfservice.flows.recovery.lifespan`. // Pattern: ^[0-9]+(ns|us|ms|s|m|h)$ ExpiresIn string `json:"expires_in,omitempty"` diff --git a/selfservice/strategy/recoverytoken/strategy.go b/selfservice/strategy/recoverytoken/strategy.go index 9d858e7cf9b..05333767b2e 100644 --- a/selfservice/strategy/recoverytoken/strategy.go +++ b/selfservice/strategy/recoverytoken/strategy.go @@ -130,7 +130,7 @@ type createRecoveryLinkParams struct { // Link Expires In // // The recovery link will expire at that point in time. Defaults to the configuration value of - // `selfservice.flows.recovery.request_lifespan`. + // `selfservice.flows.recovery.lifespan`. // // // pattern: ^[0-9]+(ns|us|ms|s|m|h)$ diff --git a/test/e2e/profiles/recovery/.kratos.yml b/test/e2e/profiles/recovery/.kratos.yml index 542228dd0dc..346ee41adc4 100644 --- a/test/e2e/profiles/recovery/.kratos.yml +++ b/test/e2e/profiles/recovery/.kratos.yml @@ -9,7 +9,7 @@ selfservice: recovery: enabled: true - request_lifespan: 5s + lifespan: 5s logout: after: diff --git a/test/e2e/profiles/verification/.kratos.yml b/test/e2e/profiles/verification/.kratos.yml index ffcf91b8d4a..fe05ce89982 100644 --- a/test/e2e/profiles/verification/.kratos.yml +++ b/test/e2e/profiles/verification/.kratos.yml @@ -9,7 +9,7 @@ selfservice: verification: enabled: true - request_lifespan: 5s + lifespan: 5s after: default_browser_return_url: http://127.0.0.1:4455/ diff --git a/test/schema/fixtures/config.schema.test.failure/wrongTypes.main.yaml b/test/schema/fixtures/config.schema.test.failure/wrongTypes.main.yaml index 15e12b5c139..0952110f006 100644 --- a/test/schema/fixtures/config.schema.test.failure/wrongTypes.main.yaml +++ b/test/schema/fixtures/config.schema.test.failure/wrongTypes.main.yaml @@ -13,15 +13,15 @@ selfservice: redirect_to: 0 profile: - request_lifespan: 10 + lifespan: 10 login: - request_lifespan: 10 + lifespan: 10 before: foo after: foo registration: - request_lifespan: 10 + lifespan: 10 before: - foo after: foo diff --git a/test/schema/fixtures/config.schema.test.success/allKeys.main.yaml b/test/schema/fixtures/config.schema.test.success/allKeys.main.yaml index 0b84634d6ba..4b84caac658 100644 --- a/test/schema/fixtures/config.schema.test.success/allKeys.main.yaml +++ b/test/schema/fixtures/config.schema.test.success/allKeys.main.yaml @@ -13,7 +13,7 @@ selfservice: redirect_to: https://example.com profile: - request_lifespan: 10m + lifespan: 10m after: profile: hooks: "#/definitions/selfServiceAfterLoginStrategy" @@ -21,7 +21,7 @@ selfservice: hooks: "#/definitions/selfServiceAfterLoginStrategy" login: - request_lifespan: 10m + lifespan: 10m before: hooks: "#/definitions/selfServiceBefore" after: @@ -31,7 +31,7 @@ selfservice: hooks: "#/definitions/selfServiceAfterLoginStrategy" registration: - request_lifespan: 10m + lifespan: 10m before: hooks: "#/definitions/selfServiceBefore" after: