-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathserver.go
More file actions
32 lines (26 loc) · 740 Bytes
/
server.go
File metadata and controls
32 lines (26 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package echoserver
import (
"sync"
"github.com/go-oauth2/oauth2/v4/manage"
"github.com/go-oauth2/oauth2/v4/server"
"github.com/labstack/echo/v4"
)
var (
eServer *server.Server
once sync.Once
)
// InitServer Initialize the service
func InitServer(manager *manage.Manager) *server.Server {
once.Do(func() {
eServer = server.NewDefaultServer(manager)
})
return eServer
}
// HandleAuthorizeRequest the authorization request handling
func HandleAuthorizeRequest(c echo.Context) error {
return eServer.HandleAuthorizeRequest(c.Response().Writer, c.Request())
}
// HandleTokenRequest token request handling
func HandleTokenRequest(c echo.Context) error {
return eServer.HandleTokenRequest(c.Response().Writer, c.Request())
}