summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-12-17 18:34:49 +0000
committerrinpatch <rinpatch@sdf.org>2020-12-17 18:34:49 +0000
commitafc68a052c384adffc7040df9e1faeb2ffacf6e4 (patch)
tree9d4aace3e63cd7d1f1ba1ea6c7d343f3bb5897ef
parentff7f7416f70591439579fd370aaebd4fb4b21249 (diff)
parent62bf4a12929fb61164874180af491f9e12f21084 (diff)
downloadpleroma-afc68a052c384adffc7040df9e1faeb2ffacf6e4.tar.gz
pleroma-afc68a052c384adffc7040df9e1faeb2ffacf6e4.zip
Merge branch 'long-life-oauth-tokens' into 'develop'
[#2353] Virtually never-expiring OAuth tokens (new and already issued ones) Closes #2353 See merge request pleroma/pleroma!3205
-rw-r--r--config/config.exs2
-rw-r--r--priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs13
2 files changed, 14 insertions, 1 deletions
diff --git a/config/config.exs b/config/config.exs
index 98c87a4f9..3ccb6a3f5 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -648,7 +648,7 @@ config :pleroma, :email_notifications,
}
config :pleroma, :oauth2,
- token_expires_in: 3600 * 24 * 30,
+ token_expires_in: 3600 * 24 * 365 * 100,
issue_new_refresh_token: true,
clean_expired_tokens: false
diff --git a/priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs b/priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs
new file mode 100644
index 000000000..560cc7447
--- /dev/null
+++ b/priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs
@@ -0,0 +1,13 @@
+defmodule Pleroma.Repo.Migrations.DataMigrationProlongOAuthTokensValidUntil do
+ use Ecto.Migration
+
+ def up do
+ expires_in = Pleroma.Config.get!([:oauth2, :token_expires_in])
+ valid_until = NaiveDateTime.add(NaiveDateTime.utc_now(), expires_in, :second)
+ execute("update oauth_tokens set valid_until = '#{valid_until}'")
+ end
+
+ def down do
+ :noop
+ end
+end