|
1 | | -/* |
2 | | -OAuth 2.0 server library for the Go programming language |
3 | | -
|
4 | | - package main |
5 | | -
|
6 | | - import ( |
7 | | - "net/http" |
8 | | -
|
9 | | - "gopkg.in/oauth2.v3/manage" |
10 | | - "gopkg.in/oauth2.v3/server" |
11 | | - "gopkg.in/oauth2.v3/store" |
12 | | - ) |
13 | | -
|
14 | | - func main() { |
15 | | - manager := manage.NewDefaultManager() |
16 | | - manager.MustTokenStorage(store.NewMemoryTokenStore()) |
17 | | - manager.MapClientStorage(store.NewTestClientStore()) |
18 | | -
|
19 | | - srv := server.NewDefaultServer(manager) |
20 | | - http.HandleFunc("/authorize", func(w http.ResponseWriter, r *http.Request) { |
21 | | - srv.HandleAuthorizeRequest(w, r) |
22 | | - }) |
23 | | - http.HandleFunc("/token", func(w http.ResponseWriter, r *http.Request) { |
24 | | - srv.HandleTokenRequest(w, r) |
25 | | - }) |
26 | | -
|
27 | | - http.ListenAndServe(":9096", nil) |
28 | | - } |
29 | | -
|
30 | | -*/ |
| 1 | +// OAuth 2.0 server library for the Go programming language |
| 2 | +// package main |
| 3 | +// import ( |
| 4 | +// "net/http" |
| 5 | +// "gopkg.in/oauth2.v3/manage" |
| 6 | +// "gopkg.in/oauth2.v3/server" |
| 7 | +// "gopkg.in/oauth2.v3/store" |
| 8 | +// ) |
| 9 | +// func main() { |
| 10 | +// manager := manage.NewDefaultManager() |
| 11 | +// manager.MustTokenStorage(store.NewMemoryTokenStore()) |
| 12 | +// manager.MapClientStorage(store.NewTestClientStore()) |
| 13 | +// srv := server.NewDefaultServer(manager) |
| 14 | +// http.HandleFunc("/authorize", func(w http.ResponseWriter, r *http.Request) { |
| 15 | +// srv.HandleAuthorizeRequest(w, r) |
| 16 | +// }) |
| 17 | +// http.HandleFunc("/token", func(w http.ResponseWriter, r *http.Request) { |
| 18 | +// srv.HandleTokenRequest(w, r) |
| 19 | +// }) |
| 20 | +// http.ListenAndServe(":9096", nil) |
| 21 | +// } |
31 | 22 |
|
32 | 23 | package oauth2 |
0 commit comments