summaryrefslogtreecommitdiff
path: root/vendor/code.superseriousbusiness.org/oauth2/v4/manage/config.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-04-25 15:15:36 +0200
committerLibravatar GitHub <noreply@github.com>2025-04-25 15:15:36 +0200
commitffde1b150faca940bc6c172068aa068cf468aa39 (patch)
tree2b325bf50946b95502d948d5700c148d667346d8 /vendor/code.superseriousbusiness.org/oauth2/v4/manage/config.go
parent[chore] Update `activity` to v1.14.0 (#4038) (diff)
downloadgotosocial-ffde1b150faca940bc6c172068aa068cf468aa39.tar.xz
[chore] Move deps to code.superseriousbusiness.org (#4054)
Diffstat (limited to 'vendor/code.superseriousbusiness.org/oauth2/v4/manage/config.go')
-rw-r--r--vendor/code.superseriousbusiness.org/oauth2/v4/manage/config.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/code.superseriousbusiness.org/oauth2/v4/manage/config.go b/vendor/code.superseriousbusiness.org/oauth2/v4/manage/config.go
new file mode 100644
index 000000000..664c0a386
--- /dev/null
+++ b/vendor/code.superseriousbusiness.org/oauth2/v4/manage/config.go
@@ -0,0 +1,39 @@
+package manage
+
+import "time"
+
+// Config authorization configuration parameters
+type Config struct {
+ // access token expiration time, 0 means it doesn't expire
+ AccessTokenExp time.Duration
+ // refresh token expiration time, 0 means it doesn't expire
+ RefreshTokenExp time.Duration
+ // whether to generate the refreshing token
+ IsGenerateRefresh bool
+}
+
+// RefreshingConfig refreshing token config
+type RefreshingConfig struct {
+ // access token expiration time, 0 means it doesn't expire
+ AccessTokenExp time.Duration
+ // refresh token expiration time, 0 means it doesn't expire
+ RefreshTokenExp time.Duration
+ // whether to generate the refreshing token
+ IsGenerateRefresh bool
+ // whether to reset the refreshing create time
+ IsResetRefreshTime bool
+ // whether to remove access token
+ IsRemoveAccess bool
+ // whether to remove refreshing token
+ IsRemoveRefreshing bool
+}
+
+// default configs
+var (
+ DefaultCodeExp = time.Minute * 10
+ DefaultAuthorizeCodeTokenCfg = &Config{AccessTokenExp: time.Hour * 2, RefreshTokenExp: time.Hour * 24 * 3, IsGenerateRefresh: true}
+ DefaultImplicitTokenCfg = &Config{AccessTokenExp: time.Hour * 1}
+ DefaultPasswordTokenCfg = &Config{AccessTokenExp: time.Hour * 2, RefreshTokenExp: time.Hour * 24 * 7, IsGenerateRefresh: true}
+ DefaultClientTokenCfg = &Config{AccessTokenExp: time.Hour * 2}
+ DefaultRefreshTokenCfg = &RefreshingConfig{IsGenerateRefresh: true, IsRemoveAccess: true, IsRemoveRefreshing: true}
+)