Skip to content

Commit

Permalink
Merge pull request #276 from XenitAB/forgotten-changelogs
Browse files Browse the repository at this point in the history
Pointing out breaking changelogs for v0.0.41 and v0.0.42
  • Loading branch information
bittrance committed Jun 29, 2023
2 parents 0d8f58d + 7b4c760 commit 59fcaf8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
28 changes: 17 additions & 11 deletions README.md
Expand Up @@ -10,6 +10,14 @@ This is a middleware for http to make it easy to use OpenID Connect.

Below, large (breaking) changes will be documented:

### v0.0.42

Error handlers now have access to the request and have full control over the HTTP response sent to the client. Among other things, this can be used to return structured error responses a la [RFC7807](https://datatracker.ietf.org/doc/html/rfc7807). However, this comes with a breaking interface change: error handler contract changes from `type ErrorHandler func(description ErrorDescription, err error)` to `errorHandler(ctx context.Context, oidcErr *options.OidcError) *options.Response`. To retain the behavior of your error handler, update your error handler signature accordingly, change `description` to `oidcErr.Status`, `err` to `oidcErr.Error` and add an explicit `return nil`.

### v0.0.41

The `oidcechojwt` adapter is replaced by `oidcecho` which brings in line with the other adapters in that it operates as a ordinary middleware. This makes all adapters full HTTP middlewares. That makes it easier to add new features, such as the the upcoming error handling changes. The new adapter provides identical features.

### v0.0.37

From `v0.0.37` and forward, the `options.WithRequiredClaims()` has been deprecated and generics are used to provide the claims type. A new validation function can be provided instead of `options.WithRequiredClaims()`. If you don't need claims validation, you can pass `nil` instead of a `ClaimsValidationFn`.
Expand All @@ -30,7 +38,7 @@ This library is under active development and the api will have breaking changes
- [net/http](https://pkg.go.dev/net/http), [mux](https://github.com/gorilla/mux) & [chi](https://github.com/go-chi/chi)
- [gin](https://github.com/gin-gonic/gin)
- [fiber](https://github.com/gofiber/fiber)
- [Echo (JWT ParseTokenFunc)](https://echo.labstack.com/middleware/jwt/#custom-configuration)
- [Echo](https://echo.labstack.com/)
- Build your own middleware

### Using options
Expand Down Expand Up @@ -202,7 +210,7 @@ func newClaimsHandler() fiber.Handler {
}
```

### Echo (JWT ParseTokenFunc)
### Echo

**Import**

Expand All @@ -211,15 +219,13 @@ func newClaimsHandler() fiber.Handler {
**Middleware**

```go
e.Use(middleware.JWTWithConfig(middleware.JWTConfig{
ParseTokenFunc: oidcecho.New(
GetAzureADClaimsValidationFn(cfg.TenantID),
options.WithIssuer(cfg.Issuer),
options.WithRequiredTokenType("JWT"),
options.WithRequiredAudience(cfg.Audience),
options.WithFallbackSignatureAlgorithm(cfg.FallbackSignatureAlgorithm),
),
}))
oidcHandler := oidcecho.New(
GetAzureADClaimsValidationFn(cfg.TenantID),
options.WithIssuer(cfg.Issuer),
options.WithRequiredTokenType("JWT"),
options.WithRequiredAudience(cfg.Audience),
options.WithFallbackSignatureAlgorithm(cfg.FallbackSignatureAlgorithm),
)
```

**Handler**
Expand Down
4 changes: 2 additions & 2 deletions oidcecho/go.sum
Expand Up @@ -78,8 +78,8 @@ github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/xenitab/dispans v0.0.10 h1:S+gSUM14rDJWK7MYNrjb8JbjeQPip6mlNJyLX+g7Agc=
github.com/xenitab/go-oidc-middleware v0.0.42 h1:j7+tWjVF2h3oyzp/jdlp5R8EWezaWc1jtT0/x5LC3oQ=
github.com/xenitab/go-oidc-middleware v0.0.42/go.mod h1:+menF2rCe5yqS4jpVEtR0JgQS3dPZHuwty+4PQ4BbrE=
github.com/xenitab/go-oidc-middleware v0.0.43 h1:OlgxrvvRacgae40D1fxGVptDEfcWmuyhcHtZkN9/SO4=
github.com/xenitab/go-oidc-middleware v0.0.43/go.mod h1:+menF2rCe5yqS4jpVEtR0JgQS3dPZHuwty+4PQ4BbrE=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/ratelimit v0.2.0 h1:UQE2Bgi7p2B85uP5dC2bbRtig0C+OeNRnNEafLjsLPA=
Expand Down
4 changes: 2 additions & 2 deletions oidcfiber/go.sum
Expand Up @@ -98,8 +98,8 @@ github.com/valyala/fasthttp v1.44.0/go.mod h1:f6VbjjoI3z1NDOZOv17o6RvtRSWxC77seB
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/xenitab/dispans v0.0.10 h1:S+gSUM14rDJWK7MYNrjb8JbjeQPip6mlNJyLX+g7Agc=
github.com/xenitab/go-oidc-middleware v0.0.42 h1:j7+tWjVF2h3oyzp/jdlp5R8EWezaWc1jtT0/x5LC3oQ=
github.com/xenitab/go-oidc-middleware v0.0.42/go.mod h1:+menF2rCe5yqS4jpVEtR0JgQS3dPZHuwty+4PQ4BbrE=
github.com/xenitab/go-oidc-middleware v0.0.43 h1:OlgxrvvRacgae40D1fxGVptDEfcWmuyhcHtZkN9/SO4=
github.com/xenitab/go-oidc-middleware v0.0.43/go.mod h1:+menF2rCe5yqS4jpVEtR0JgQS3dPZHuwty+4PQ4BbrE=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
Expand Down
4 changes: 2 additions & 2 deletions oidcgin/go.sum
Expand Up @@ -90,8 +90,8 @@ github.com/tidwall/tinyqueue v0.1.1 h1:SpNEvEggbpyN5DIReaJ2/1ndroY8iyEGxPYxoSaym
github.com/ugorji/go/codec v1.2.9 h1:rmenucSohSTiyL09Y+l2OCk+FrMxGMzho2+tjr5ticU=
github.com/ugorji/go/codec v1.2.9/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/xenitab/dispans v0.0.10 h1:S+gSUM14rDJWK7MYNrjb8JbjeQPip6mlNJyLX+g7Agc=
github.com/xenitab/go-oidc-middleware v0.0.42 h1:j7+tWjVF2h3oyzp/jdlp5R8EWezaWc1jtT0/x5LC3oQ=
github.com/xenitab/go-oidc-middleware v0.0.42/go.mod h1:+menF2rCe5yqS4jpVEtR0JgQS3dPZHuwty+4PQ4BbrE=
github.com/xenitab/go-oidc-middleware v0.0.43 h1:OlgxrvvRacgae40D1fxGVptDEfcWmuyhcHtZkN9/SO4=
github.com/xenitab/go-oidc-middleware v0.0.43/go.mod h1:+menF2rCe5yqS4jpVEtR0JgQS3dPZHuwty+4PQ4BbrE=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/ratelimit v0.2.0 h1:UQE2Bgi7p2B85uP5dC2bbRtig0C+OeNRnNEafLjsLPA=
Expand Down
4 changes: 2 additions & 2 deletions oidchttp/go.sum
Expand Up @@ -60,8 +60,8 @@ github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/rtred v0.1.2 h1:exmoQtOLvDoO8ud++6LwVsAMTu0KPzLTUrMln8u1yu8=
github.com/tidwall/tinyqueue v0.1.1 h1:SpNEvEggbpyN5DIReaJ2/1ndroY8iyEGxPYxoSaymYE=
github.com/xenitab/dispans v0.0.10 h1:S+gSUM14rDJWK7MYNrjb8JbjeQPip6mlNJyLX+g7Agc=
github.com/xenitab/go-oidc-middleware v0.0.42 h1:j7+tWjVF2h3oyzp/jdlp5R8EWezaWc1jtT0/x5LC3oQ=
github.com/xenitab/go-oidc-middleware v0.0.42/go.mod h1:+menF2rCe5yqS4jpVEtR0JgQS3dPZHuwty+4PQ4BbrE=
github.com/xenitab/go-oidc-middleware v0.0.43 h1:OlgxrvvRacgae40D1fxGVptDEfcWmuyhcHtZkN9/SO4=
github.com/xenitab/go-oidc-middleware v0.0.43/go.mod h1:+menF2rCe5yqS4jpVEtR0JgQS3dPZHuwty+4PQ4BbrE=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/ratelimit v0.2.0 h1:UQE2Bgi7p2B85uP5dC2bbRtig0C+OeNRnNEafLjsLPA=
Expand Down

0 comments on commit 59fcaf8

Please sign in to comment.