-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(auth): added jwt logic to the auth #86
Conversation
👷 Deploy Preview for infallible-rosalind-15c59f processing. 🔨 Explore the source changes: 6306947 🔍 Inspect the deploy log: https://app.netlify.com/sites/infallible-rosalind-15c59f/deploys/61a14c938960da000787eeee |
backend/app/router.go
Outdated
// IsAuthorized This function will check the authorization from a given token in Bearer | ||
func IsAuthorized(endpoint func(c *gin.Context)) gin.HandlerFunc { | ||
fn := func(c *gin.Context) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These news lines are unecessary. this will fail during linting.
Delete it
fn := func(c *gin.Context) {
if c.GetHeader("Authorization") != "" {
token, err := jwt.Parse(c.GetHeader("Authorization"), func(token *jwt.Token) (interface{}, error) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't get it... what is unecessary ?
which lines ?
the linting check notice that the file are format with go fmt. $> make fmt |
backend/app/router.go
Outdated
tokenString, err := token.SignedString(jwtSigningKey) | ||
|
||
if err != nil { | ||
fmt.Errorf("Something Went Wrong: %s", err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you nedd to recupere 🤣
the value returned by fmt.Errorf()
if err != nil {
err = fmt.Errorf("Something Went Wrong: %s", err.Error())
return "", err
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated based on the return of the method :
if err != nil {
return "", err
}
6306947
to
ff4da5f
Compare
…ade dependencies to their latest versions
* feat(ui): WIP: Banner component, chakra ui setup and translation * feat(ui): WIP: Home page integration * feat(ui): Done home page integration for big screens * fix(ui): remove top level package.json
b5539e7
to
8525643
Compare
What
impact
In the future, to protect a route with the jwt token, we're going to use
app.IsAuthorized(targethandler)