summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/superseriousbusiness/oauth2/v4/server/server_config.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-03-02 16:42:51 +0100
committerLibravatar GitHub <noreply@github.com>2025-03-02 16:42:51 +0100
commit8488ac928651656c6f7bebf5eaabce62c2b9fb66 (patch)
tree94357311026e5ed96862a647400375a4543dd815 /vendor/codeberg.org/superseriousbusiness/oauth2/v4/server/server_config.go
parent[chore] go-swagger -> codeberg (#3856) (diff)
downloadgotosocial-8488ac928651656c6f7bebf5eaabce62c2b9fb66.tar.xz
[chore] migrate oauth2 -> codeberg (#3857)
Diffstat (limited to 'vendor/codeberg.org/superseriousbusiness/oauth2/v4/server/server_config.go')
-rw-r--r--vendor/codeberg.org/superseriousbusiness/oauth2/v4/server/server_config.go85
1 files changed, 85 insertions, 0 deletions
diff --git a/vendor/codeberg.org/superseriousbusiness/oauth2/v4/server/server_config.go b/vendor/codeberg.org/superseriousbusiness/oauth2/v4/server/server_config.go
new file mode 100644
index 000000000..e190630e9
--- /dev/null
+++ b/vendor/codeberg.org/superseriousbusiness/oauth2/v4/server/server_config.go
@@ -0,0 +1,85 @@
+package server
+
+import (
+ "codeberg.org/superseriousbusiness/oauth2/v4"
+)
+
+// SetTokenType token type
+func (s *Server) SetTokenType(tokenType string) {
+ s.Config.TokenType = tokenType
+}
+
+// SetAllowGetAccessRequest to allow GET requests for the token
+func (s *Server) SetAllowGetAccessRequest(allow bool) {
+ s.Config.AllowGetAccessRequest = allow
+}
+
+// SetAllowedResponseType allow the authorization types
+func (s *Server) SetAllowedResponseType(types ...oauth2.ResponseType) {
+ s.Config.AllowedResponseTypes = types
+}
+
+// SetAllowedGrantType allow the grant types
+func (s *Server) SetAllowedGrantType(types ...oauth2.GrantType) {
+ s.Config.AllowedGrantTypes = types
+}
+
+// SetClientInfoHandler get client info from request
+func (s *Server) SetClientInfoHandler(handler ClientInfoHandler) {
+ s.ClientInfoHandler = handler
+}
+
+// SetClientAuthorizedHandler check the client allows to use this authorization grant type
+func (s *Server) SetClientAuthorizedHandler(handler ClientAuthorizedHandler) {
+ s.ClientAuthorizedHandler = handler
+}
+
+// SetClientScopeHandler check the client allows to use scope
+func (s *Server) SetClientScopeHandler(handler ClientScopeHandler) {
+ s.ClientScopeHandler = handler
+}
+
+// SetUserAuthorizationHandler get user id from request authorization
+func (s *Server) SetUserAuthorizationHandler(handler UserAuthorizationHandler) {
+ s.UserAuthorizationHandler = handler
+}
+
+// SetPasswordAuthorizationHandler get user id from username and password
+func (s *Server) SetPasswordAuthorizationHandler(handler PasswordAuthorizationHandler) {
+ s.PasswordAuthorizationHandler = handler
+}
+
+// SetRefreshingScopeHandler check the scope of the refreshing token
+func (s *Server) SetRefreshingScopeHandler(handler RefreshingScopeHandler) {
+ s.RefreshingScopeHandler = handler
+}
+
+// SetRefreshingValidationHandler check if refresh_token is still valid. eg no revocation or other
+func (s *Server) SetRefreshingValidationHandler(handler RefreshingValidationHandler) {
+ s.RefreshingValidationHandler = handler
+}
+
+// SetResponseErrorHandler response error handling
+func (s *Server) SetResponseErrorHandler(handler ResponseErrorHandler) {
+ s.ResponseErrorHandler = handler
+}
+
+// SetInternalErrorHandler internal error handling
+func (s *Server) SetInternalErrorHandler(handler InternalErrorHandler) {
+ s.InternalErrorHandler = handler
+}
+
+// SetExtensionFieldsHandler in response to the access token with the extension of the field
+func (s *Server) SetExtensionFieldsHandler(handler ExtensionFieldsHandler) {
+ s.ExtensionFieldsHandler = handler
+}
+
+// SetAccessTokenExpHandler set expiration date for the access token
+func (s *Server) SetAccessTokenExpHandler(handler AccessTokenExpHandler) {
+ s.AccessTokenExpHandler = handler
+}
+
+// SetAuthorizeScopeHandler set scope for the access token
+func (s *Server) SetAuthorizeScopeHandler(handler AuthorizeScopeHandler) {
+ s.AuthorizeScopeHandler = handler
+}