Skip to content

Commit a156fbe

Browse files
committed
Modify module path to github.com/go-oauth2/oauth2/v4
1 parent a6ff933 commit a156fbe

29 files changed

+119
-210
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: go
22
sudo: false
3-
go_import_path: gopkg.in/oauth2.v4
3+
go_import_path: github.com/go-oauth2/oauth2/v4
44
go:
5-
- 1.9
5+
- 1.13
66
before_install:
77
- go get -t -v ./...
88

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
### Download and install
3232

3333
``` bash
34-
go get -u -v gopkg.in/oauth2.v4/...
34+
go get -u -v github.com/go-oauth2/oauth2/v4/...
3535
```
3636

3737
### Create file `server.go`
@@ -43,11 +43,11 @@ import (
4343
"log"
4444
"net/http"
4545

46-
"gopkg.in/oauth2.v4/errors"
47-
"gopkg.in/oauth2.v4/manage"
48-
"gopkg.in/oauth2.v4/models"
49-
"gopkg.in/oauth2.v4/server"
50-
"gopkg.in/oauth2.v4/store"
46+
"github.com/go-oauth2/oauth2/v4/errors"
47+
"github.com/go-oauth2/oauth2/v4/manage"
48+
"github.com/go-oauth2/oauth2/v4/models"
49+
"github.com/go-oauth2/oauth2/v4/server"
50+
"github.com/go-oauth2/oauth2/v4/store"
5151
)
5252

5353
func main() {
@@ -135,7 +135,7 @@ Simulation examples of authorization code model, please check [example](/example
135135
```go
136136

137137
import (
138-
"gopkg.in/oauth2.v4/generates"
138+
"github.com/go-oauth2/oauth2/v4/generates"
139139
"github.com/dgrijalva/jwt-go"
140140
)
141141

@@ -180,9 +180,9 @@ if !ok || !token.Valid {
180180
[Build-Status-Image]: https://travis-ci.org/go-oauth2/oauth2.svg?branch=master
181181
[codecov-url]: https://codecov.io/gh/go-oauth2/oauth2
182182
[codecov-image]: https://codecov.io/gh/go-oauth2/oauth2/branch/master/graph/badge.svg
183-
[reportcard-url]: https://goreportcard.com/report/gopkg.in/oauth2.v4
184-
[reportcard-image]: https://goreportcard.com/badge/gopkg.in/oauth2.v4
185-
[godoc-url]: https://godoc.org/gopkg.in/oauth2.v4
186-
[godoc-image]: https://godoc.org/gopkg.in/oauth2.v4?status.svg
183+
[reportcard-url]: https://goreportcard.com/report/github.com/go-oauth2/oauth2/v4
184+
[reportcard-image]: https://goreportcard.com/badge/github.com/go-oauth2/oauth2/v4
185+
[godoc-url]: https://godoc.org/github.com/go-oauth2/oauth2/v4
186+
[godoc-image]: https://godoc.org/github.com/go-oauth2/oauth2/v4?status.svg
187187
[license-url]: http://opensource.org/licenses/MIT
188188
[license-image]: https://img.shields.io/npm/l/express.svg

doc.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// package main
44
// import (
55
// "net/http"
6-
// "gopkg.in/oauth2.v4/manage"
7-
// "gopkg.in/oauth2.v4/server"
8-
// "gopkg.in/oauth2.v4/store"
6+
// "github.com/go-oauth2/oauth2/v4/manage"
7+
// "github.com/go-oauth2/oauth2/v4/server"
8+
// "github.com/go-oauth2/oauth2/v4/store"
99
// )
1010
// func main() {
1111
// manager := manage.NewDefaultManager()

errors/error.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ package errors
22

33
import "errors"
44

5+
// New returns an error that formats as the given text.
6+
var New = errors.New
7+
58
// known errors
69
var (
710
ErrInvalidRedirectURI = errors.New("invalid redirect uri")

errors/response.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ import (
55
"net/http"
66
)
77

8-
// Define alias
9-
var (
10-
New = errors.New
11-
)
12-
138
// Response error response
149
type Response struct {
1510
Error error

example/server/server.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99
"time"
1010

1111
"github.com/dgrijalva/jwt-go"
12+
"github.com/go-oauth2/oauth2/v4/errors"
13+
"github.com/go-oauth2/oauth2/v4/generates"
14+
"github.com/go-oauth2/oauth2/v4/manage"
15+
"github.com/go-oauth2/oauth2/v4/models"
16+
"github.com/go-oauth2/oauth2/v4/server"
17+
"github.com/go-oauth2/oauth2/v4/store"
1218
"github.com/go-session/session"
13-
"gopkg.in/oauth2.v4/errors"
14-
"gopkg.in/oauth2.v4/generates"
15-
"gopkg.in/oauth2.v4/manage"
16-
"gopkg.in/oauth2.v4/models"
17-
"gopkg.in/oauth2.v4/server"
18-
"gopkg.in/oauth2.v4/store"
1919
)
2020

2121
func main() {

generates/access.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"strconv"
88
"strings"
99

10-
"gopkg.in/oauth2.v4"
11-
"gopkg.in/oauth2.v4/utils/uuid"
10+
"github.com/go-oauth2/oauth2/v4"
11+
"github.com/google/uuid"
1212
)
1313

1414
// NewAccessGenerate create to generate the access token instance
@@ -26,11 +26,11 @@ func (ag *AccessGenerate) Token(ctx context.Context, data *oauth2.GenerateBasic,
2626
buf.WriteString(data.UserID)
2727
buf.WriteString(strconv.FormatInt(data.CreateAt.UnixNano(), 10))
2828

29-
access := base64.URLEncoding.EncodeToString(uuid.NewMD5(uuid.Must(uuid.NewRandom()), buf.Bytes()).Bytes())
29+
access := base64.URLEncoding.EncodeToString([]byte(uuid.NewMD5(uuid.Must(uuid.NewRandom()), buf.Bytes()).String()))
3030
access = strings.ToUpper(strings.TrimRight(access, "="))
3131
refresh := ""
3232
if isGenRefresh {
33-
refresh = base64.URLEncoding.EncodeToString(uuid.NewSHA1(uuid.Must(uuid.NewRandom()), buf.Bytes()).Bytes())
33+
refresh = base64.URLEncoding.EncodeToString([]byte(uuid.NewSHA1(uuid.Must(uuid.NewRandom()), buf.Bytes()).String()))
3434
refresh = strings.ToUpper(strings.TrimRight(refresh, "="))
3535
}
3636

generates/access_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"testing"
66
"time"
77

8-
"gopkg.in/oauth2.v4"
9-
"gopkg.in/oauth2.v4/generates"
10-
"gopkg.in/oauth2.v4/models"
8+
"github.com/go-oauth2/oauth2/v4"
9+
"github.com/go-oauth2/oauth2/v4/generates"
10+
"github.com/go-oauth2/oauth2/v4/models"
1111

1212
. "github.com/smartystreets/goconvey/convey"
1313
)

generates/authorize.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"encoding/base64"
77
"strings"
88

9-
"gopkg.in/oauth2.v4"
10-
"gopkg.in/oauth2.v4/utils/uuid"
9+
"github.com/go-oauth2/oauth2/v4"
10+
"github.com/google/uuid"
1111
)
1212

1313
// NewAuthorizeGenerate create to generate the authorize code instance
@@ -23,7 +23,7 @@ func (ag *AuthorizeGenerate) Token(ctx context.Context, data *oauth2.GenerateBas
2323
buf := bytes.NewBufferString(data.Client.GetID())
2424
buf.WriteString(data.UserID)
2525
token := uuid.NewMD5(uuid.Must(uuid.NewRandom()), buf.Bytes())
26-
code := base64.URLEncoding.EncodeToString(token.Bytes())
26+
code := base64.URLEncoding.EncodeToString([]byte(token.String()))
2727
code = strings.ToUpper(strings.TrimRight(code, "="))
2828

2929
return code, nil

generates/authorize_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"testing"
66
"time"
77

8-
"gopkg.in/oauth2.v4"
9-
"gopkg.in/oauth2.v4/generates"
10-
"gopkg.in/oauth2.v4/models"
8+
"github.com/go-oauth2/oauth2/v4"
9+
"github.com/go-oauth2/oauth2/v4/generates"
10+
"github.com/go-oauth2/oauth2/v4/models"
1111

1212
. "github.com/smartystreets/goconvey/convey"
1313
)

0 commit comments

Comments
 (0)