Skip to content

Commit b369a2d

Browse files
Fix parameters sort order.
1 parent eafd8af commit b369a2d

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

example/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func main() {
6464

6565
srv := server.NewServer(server.NewConfig(), manager)
6666

67-
srv.SetPasswordAuthorizationHandler(func(ctx context.Context, username, password, clientID string) (userID string, err error) {
67+
srv.SetPasswordAuthorizationHandler(func(ctx context.Context, clientID, username, password string) (userID string, err error) {
6868
if username == "test" && password == "test" {
6969
userID = "test"
7070
}

server/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type (
2323
UserAuthorizationHandler func(w http.ResponseWriter, r *http.Request) (userID string, err error)
2424

2525
// PasswordAuthorizationHandler get user id from username and password
26-
PasswordAuthorizationHandler func(ctx context.Context, username, password, clientID string) (userID string, err error)
26+
PasswordAuthorizationHandler func(ctx context.Context, clientID, username, password string) (userID string, err error)
2727

2828
// RefreshingScopeHandler check the scope of the refreshing token
2929
RefreshingScopeHandler func(tgr *oauth2.TokenGenerateRequest, oldScope string) (allowed bool, err error)

server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func NewServer(cfg *Config, manager oauth2.Manager) *Server {
3232
return "", errors.ErrAccessDenied
3333
}
3434

35-
srv.PasswordAuthorizationHandler = func(ctx context.Context, username, password, clientID string) (string, error) {
35+
srv.PasswordAuthorizationHandler = func(ctx context.Context, clientID, username, password string) (string, error) {
3636
return "", errors.ErrAccessDenied
3737
}
3838
return srv

server/server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ func TestPasswordCredentials(t *testing.T) {
251251

252252
manager.MapClientStorage(clientStore(""))
253253
srv = server.NewDefaultServer(manager)
254-
srv.SetPasswordAuthorizationHandler(func(ctx context.Context, username, password, clientID string) (userID string, err error) {
254+
srv.SetPasswordAuthorizationHandler(func(ctx context.Context, clientID, username, password string) (userID string, err error) {
255255
if username == "admin" && password == "123456" {
256256
userID = "000000"
257257
return

0 commit comments

Comments
 (0)