Skip to content

Commit

Permalink
Merge branch 'release/v0.31.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhartstonge committed Jan 9, 2023
2 parents fe22a27 + 7e94a22 commit 7e9c30f
Show file tree
Hide file tree
Showing 12 changed files with 683 additions and 195 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: go
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19' ]
mongo: [ '4.2', '4.4', '5.0', '6.0' ]

name: Go ${{ matrix.go }} with MongoDB ${{ matrix.mongo }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.7.0
with:
mongodb-version: ${{ matrix.mongo }}

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

- name: Go Test
run: |
go version
go test -v ./...
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [v0.31.0] - 2023-01-10
### Changed
- deps: updates to `github.com/google/uuid@v1.3.0`.
- deps: updates to `github.com/sirupsen/logrus@v1.8.1`.
- deps: updates to `github.com/stretchr/testify@v1.7.0`.
- deps: updates to `go.mongodb.org/mongo-driver@v1.11.1`.
- deps: updates `examples/mongo` to `github.com/sirupsen/logrus@v1.8.1`.
- deps: updates `examples/mongo` to `golang.org/x/net@v0.0.0-20220926192436-02166a98028e`.
- deps: updates `examples/mongo` to `golang.org/x/oauth2@v0.0.0-20220909003341-f21342109be1`.
- deps: updates `examples/mongo` to `go.mongodb.org/mongo-driver@v1.11.1`.
- examples/mongo/authorizationserver: migrates deprecated use of `Exact()` to `ExactOne()`.
- storage: gofmts the project with go@1.19.

### Fixed
- examples/mongo/authorizationserver: sets session subject and username. fixes [#65](https://github.com/matthewhartstonge/storage/issues/65).
- examples/mongo/authorizationserver: properly logs out the generated user id.
- mongo/mongo: reduces read errors occurring in a mongo replica set. fixes [#68](https://github.com/matthewhartstonge/storage/issues/68).

## [v0.30.1] - 2022-08-08
### Added
- user_manager: adds support for filtering users given a list of people ids.
Expand Down Expand Up @@ -672,6 +690,7 @@ clear out the password field before sending the response.
- General pre-release!

[Unreleased]: https://github.com/matthewhartstonge/storage/tree/master
[v0.31.0]: https://github.com/matthewhartstonge/storage/tree/v0.31.0
[v0.30.1]: https://github.com/matthewhartstonge/storage/tree/v0.30.1
[v0.30.0]: https://github.com/matthewhartstonge/storage/tree/v0.30.0
[v0.29.0]: https://github.com/matthewhartstonge/storage/tree/v0.29.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# fosite-storage-mongo
[![Coverage Status](https://coveralls.io/repos/github/matthewhartstonge/storage/badge.svg?branch=main)](https://coveralls.io/github/matthewhartstonge/storage?branch=main) [![Go Report Card](https://goreportcard.com/badge/github.com/matthewhartstonge/storage)](https://goreportcard.com/report/github.com/matthewhartstonge/storage) [![Build Status](https://travis-ci.com/matthewhartstonge/storage.svg?branch=main)](https://travis-ci.com/matthewhartstonge/storage) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmatthewhartstonge%2Fstorage.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmatthewhartstonge%2Fstorage?ref=badge_shield)
[![Build Status](https://github.com/matthewhartstonge/storage/actions/workflows/go.yaml/badge.svg?branch=development)](https://github.com/matthewhartstonge/storage/actions/workflows/go.yaml) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmatthewhartstonge%2Fstorage.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmatthewhartstonge%2Fstorage?ref=badge_shield) [![Go Report Card](https://goreportcard.com/badge/github.com/matthewhartstonge/storage)](https://goreportcard.com/report/github.com/matthewhartstonge/storage)

fosite-storage-mongo provides a native Go based [Mongo backed database storage][mongo-driver]
that conforms to *all the interfaces!* required by [fosite][fosite].
Expand All @@ -17,11 +17,11 @@ know what versions you are successfully paired with.

| storage version | minimum fosite version | maximum fosite version |
|----------------:|-----------------------:|-----------------------:|
| `v0.31.X` | `v0.33.X` | `v0.34.X` |
| `v0.30.X` | `v0.33.X` | `v0.34.X` |
| `v0.29.X` | `v0.32.X` | `v0.34.X` |
| `v0.28.X` | `v0.32.X` | `v0.34.X` |
| `v0.27.X` | `v0.32.X` | `v0.34.X` |
| `v0.26.X` | `v0.32.X` | `v0.34.X` |

## Development
To start hacking:
Expand Down
4 changes: 2 additions & 2 deletions examples/mongo/authorizationserver/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ func createUsers(ctx context.Context, store *mongo.Store, users []storage.User)
}

// Create the new user!
_, err = store.UserManager.Create(ctx, user)
user, err = store.UserManager.Create(ctx, user)
if err != nil {
// err, it broke... ?
panic(err)
}
logger.Info("new user created!")
logger.WithField("id", user.ID).Info("new user created!")
}
}
2 changes: 2 additions & 0 deletions examples/mongo/authorizationserver/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,7 @@ func newSession(user string) *openid.DefaultSession {
Headers: &jwt.Headers{
Extra: make(map[string]interface{}),
},
Subject: user,
Username: user,
}
}
2 changes: 1 addition & 1 deletion examples/mongo/authorizationserver/oauth2_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func tokenEndpoint(rw http.ResponseWriter, req *http.Request) {
}

// If this is a client_credentials grant, grant all scopes the client is allowed to perform.
if accessRequest.GetGrantTypes().Exact("client_credentials") {
if accessRequest.GetGrantTypes().ExactOne("client_credentials") {
for _, scope := range accessRequest.GetRequestedScopes() {
if fosite.HierarchicScopeStrategy(accessRequest.GetClient().GetScopes(), scope) {
accessRequest.GrantScope(scope)
Expand Down
6 changes: 3 additions & 3 deletions examples/mongo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ replace github.com/matthewhartstonge/storage => ../../../storage
require (
github.com/matthewhartstonge/storage v0.0.0
github.com/ory/fosite v0.33.0
github.com/sirupsen/logrus v1.4.2
golang.org/x/net v0.0.0-20200625001655-4c5254603344
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
github.com/sirupsen/logrus v1.8.1
golang.org/x/net v0.0.0-20220926192436-02166a98028e
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1
)
Loading

0 comments on commit 7e9c30f

Please sign in to comment.