Skip to content

Commit

Permalink
Fix parameters sort order.
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelien-semence committed May 4, 2022
1 parent eafd8af commit b369a2d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func main() {

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

srv.SetPasswordAuthorizationHandler(func(ctx context.Context, username, password, clientID string) (userID string, err error) {
srv.SetPasswordAuthorizationHandler(func(ctx context.Context, clientID, username, password string) (userID string, err error) {
if username == "test" && password == "test" {
userID = "test"
}
Expand Down
2 changes: 1 addition & 1 deletion server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type (
UserAuthorizationHandler func(w http.ResponseWriter, r *http.Request) (userID string, err error)

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

// RefreshingScopeHandler check the scope of the refreshing token
RefreshingScopeHandler func(tgr *oauth2.TokenGenerateRequest, oldScope string) (allowed bool, err error)
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewServer(cfg *Config, manager oauth2.Manager) *Server {
return "", errors.ErrAccessDenied
}

srv.PasswordAuthorizationHandler = func(ctx context.Context, username, password, clientID string) (string, error) {
srv.PasswordAuthorizationHandler = func(ctx context.Context, clientID, username, password string) (string, error) {
return "", errors.ErrAccessDenied
}
return srv
Expand Down
2 changes: 1 addition & 1 deletion server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func TestPasswordCredentials(t *testing.T) {

manager.MapClientStorage(clientStore(""))
srv = server.NewDefaultServer(manager)
srv.SetPasswordAuthorizationHandler(func(ctx context.Context, username, password, clientID string) (userID string, err error) {
srv.SetPasswordAuthorizationHandler(func(ctx context.Context, clientID, username, password string) (userID string, err error) {
if username == "admin" && password == "123456" {
userID = "000000"
return
Expand Down

0 comments on commit b369a2d

Please sign in to comment.