Changes:
- Move defaults to options package (#32)
- Change echojwt from using jwt.Token to map[string]interface{} (#33)
Breaking change:
oidcechojwt
now returns a map[string]interface{}
instead of jwt.Token
.
Previously, you had to use the following:
func newClaimsHandler(c echo.Context) error {
token, ok := c.Get("user").(jwt.Token)
if !ok {
return echo.NewHTTPError(http.StatusUnauthorized, "invalid token")
}
claims, err := token.AsMap(c.Request().Context())
if err != nil {
return echo.NewHTTPError(http.StatusUnauthorized, "invalid token")
}
return c.JSON(http.StatusOK, claims)
}
Now you you instead get the claims directly:
func newClaimsHandler(c echo.Context) error {
claims, ok := c.Get("user").(map[string]interface{})
if !ok {
return echo.NewHTTPError(http.StatusUnauthorized, "invalid token")
}
return c.JSON(http.StatusOK, claims)
}