Skip to content

Commit 669d51f

Browse files
committed
Updated
1 parent 31d3a1d commit 669d51f

File tree

2 files changed

+2
-81
lines changed

2 files changed

+2
-81
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[*.go]
2-
end_of_line = crlf
2+
end_of_line = cr

server/server_config.go

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1 @@
1-
package server
2-
3-
import (
4-
"github.com/go-oauth2/oauth2/v4"
5-
)
6-
7-
// SetTokenType token type
8-
func (s *Server) SetTokenType(tokenType string) {
9-
s.Config.TokenType = tokenType
10-
}
11-
12-
// SetAllowGetAccessRequest to allow GET requests for the token
13-
func (s *Server) SetAllowGetAccessRequest(allow bool) {
14-
s.Config.AllowGetAccessRequest = allow
15-
}
16-
17-
// SetAllowedResponseType allow the authorization types
18-
func (s *Server) SetAllowedResponseType(types ...oauth2.ResponseType) {
19-
s.Config.AllowedResponseTypes = types
20-
}
21-
22-
// SetAllowedGrantType allow the grant types
23-
func (s *Server) SetAllowedGrantType(types ...oauth2.GrantType) {
24-
s.Config.AllowedGrantTypes = types
25-
}
26-
27-
// SetClientInfoHandler get client info from request
28-
func (s *Server) SetClientInfoHandler(handler ClientInfoHandler) {
29-
s.ClientInfoHandler = handler
30-
}
31-
32-
// SetClientAuthorizedHandler check the client allows to use this authorization grant type
33-
func (s *Server) SetClientAuthorizedHandler(handler ClientAuthorizedHandler) {
34-
s.ClientAuthorizedHandler = handler
35-
}
36-
37-
// SetClientScopeHandler check the client allows to use scope
38-
func (s *Server) SetClientScopeHandler(handler ClientScopeHandler) {
39-
s.ClientScopeHandler = handler
40-
}
41-
42-
// SetUserAuthorizationHandler get user id from request authorization
43-
func (s *Server) SetUserAuthorizationHandler(handler UserAuthorizationHandler) {
44-
s.UserAuthorizationHandler = handler
45-
}
46-
47-
// SetPasswordAuthorizationHandler get user id from username and password
48-
func (s *Server) SetPasswordAuthorizationHandler(handler PasswordAuthorizationHandler) {
49-
s.PasswordAuthorizationHandler = handler
50-
}
51-
52-
// SetRefreshingScopeHandler check the scope of the refreshing token
53-
func (s *Server) SetRefreshingScopeHandler(handler RefreshingScopeHandler) {
54-
s.RefreshingScopeHandler = handler
55-
}
56-
57-
// SetResponseErrorHandler response error handling
58-
func (s *Server) SetResponseErrorHandler(handler ResponseErrorHandler) {
59-
s.ResponseErrorHandler = handler
60-
}
61-
62-
// SetInternalErrorHandler internal error handling
63-
func (s *Server) SetInternalErrorHandler(handler InternalErrorHandler) {
64-
s.InternalErrorHandler = handler
65-
}
66-
67-
// SetExtensionFieldsHandler in response to the access token with the extension of the field
68-
func (s *Server) SetExtensionFieldsHandler(handler ExtensionFieldsHandler) {
69-
s.ExtensionFieldsHandler = handler
70-
}
71-
72-
// SetAccessTokenExpHandler set expiration date for the access token
73-
func (s *Server) SetAccessTokenExpHandler(handler AccessTokenExpHandler) {
74-
s.AccessTokenExpHandler = handler
75-
}
76-
77-
// SetAuthorizeScopeHandler set scope for the access token
78-
func (s *Server) SetAuthorizeScopeHandler(handler AuthorizeScopeHandler) {
79-
s.AuthorizeScopeHandler = handler
80-
}
1+
package serverimport ( "github.com/go-oauth2/oauth2/v4")// SetTokenType token typefunc (s *Server) SetTokenType(tokenType string) { s.Config.TokenType = tokenType}// SetAllowGetAccessRequest to allow GET requests for the tokenfunc (s *Server) SetAllowGetAccessRequest(allow bool) { s.Config.AllowGetAccessRequest = allow}// SetAllowedResponseType allow the authorization typesfunc (s *Server) SetAllowedResponseType(types ...oauth2.ResponseType) { s.Config.AllowedResponseTypes = types}// SetAllowedGrantType allow the grant typesfunc (s *Server) SetAllowedGrantType(types ...oauth2.GrantType) { s.Config.AllowedGrantTypes = types}// SetClientInfoHandler get client info from requestfunc (s *Server) SetClientInfoHandler(handler ClientInfoHandler) { s.ClientInfoHandler = handler}// SetClientAuthorizedHandler check the client allows to use this authorization grant typefunc (s *Server) SetClientAuthorizedHandler(handler ClientAuthorizedHandler) { s.ClientAuthorizedHandler = handler}// SetClientScopeHandler check the client allows to use scopefunc (s *Server) SetClientScopeHandler(handler ClientScopeHandler) { s.ClientScopeHandler = handler}// SetUserAuthorizationHandler get user id from request authorizationfunc (s *Server) SetUserAuthorizationHandler(handler UserAuthorizationHandler) { s.UserAuthorizationHandler = handler}// SetPasswordAuthorizationHandler get user id from username and passwordfunc (s *Server) SetPasswordAuthorizationHandler(handler PasswordAuthorizationHandler) { s.PasswordAuthorizationHandler = handler}// SetRefreshingScopeHandler check the scope of the refreshing tokenfunc (s *Server) SetRefreshingScopeHandler(handler RefreshingScopeHandler) { s.RefreshingScopeHandler = handler}// SetResponseErrorHandler response error handlingfunc (s *Server) SetResponseErrorHandler(handler ResponseErrorHandler) { s.ResponseErrorHandler = handler}// SetInternalErrorHandler internal error handlingfunc (s *Server) SetInternalErrorHandler(handler InternalErrorHandler) { s.InternalErrorHandler = handler}// SetExtensionFieldsHandler in response to the access token with the extension of the fieldfunc (s *Server) SetExtensionFieldsHandler(handler ExtensionFieldsHandler) { s.ExtensionFieldsHandler = handler}// SetAccessTokenExpHandler set expiration date for the access tokenfunc (s *Server) SetAccessTokenExpHandler(handler AccessTokenExpHandler) { s.AccessTokenExpHandler = handler}// SetAuthorizeScopeHandler set scope for the access tokenfunc (s *Server) SetAuthorizeScopeHandler(handler AuthorizeScopeHandler) { s.AuthorizeScopeHandler = handler}

0 commit comments

Comments
 (0)