Skip to content

feat: Added auth middleware and NewId utility function - #50

Merged
deanefrati merged 1 commit into
mainfrom
auth_middleware
Jul 23, 2025
Merged

feat: Added auth middleware and NewId utility function#50
deanefrati merged 1 commit into
mainfrom
auth_middleware

Conversation

@deanefrati

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread middlewares/auth.go
@deanefrati

Copy link
Copy Markdown
Contributor Author

@Lutherwaves The errors your update is returning don't exist do you have the code for them? ErrTokenExpired ErrTokenNotValidYet

@Lutherwaves

Copy link
Copy Markdown
Contributor

@Lutherwaves The errors your update is returning don't exist do you have the code for them? ErrTokenExpired ErrTokenNotValidYet

Yeah this was just a suggestion based on my AIsstant. If you'd like, you can start off with something like

import (
  "errors"
)

var (
    ErrTokenExpired    = errors.New("token has expired")
    ErrTokenNotValidYet = errors.New("token is not valid yet")
)

@Lutherwaves

Lutherwaves commented Jul 23, 2025

Copy link
Copy Markdown
Contributor

@Lutherwaves The errors your update is returning don't exist do you have the code for them? ErrTokenExpired ErrTokenNotValidYet

Yeah this was just a suggestion based on my AIsstant. If you'd like, you can start off with something like

import (
  "errors"
)

var (
    ErrTokenExpired    = errors.New("token has expired")
    ErrTokenNotValidYet = errors.New("token is not valid yet")
)

We can add the whole method as a subsequent PR

@deanefrati

Copy link
Copy Markdown
Contributor Author

actually now that i'm thinking about it this isn't needed since this validator only validates custom claims not the standard ones like nbf and exp those are validated by the jwtValidator already which is why i didn't do anything with this validator it's really just a placeholder for if we ever want to validate custom claims (roles, groups, email, tenant etc.) going to change it back to a no-op

@Lutherwaves

Copy link
Copy Markdown
Contributor

actually now that i'm thinking about it this isn't needed since this validator only validates custom claims not the standard ones like nbf and exp those are validated by the jwtValidator already which is why i didn't do anything with this validator it's really just a placeholder for if we ever want to validate custom claims (roles, groups, email, tenant etc.) going to change it back to a no-op

Agreed.

@deanefrati
deanefrati merged commit fc4edc1 into main Jul 23, 2025
3 checks passed
@deanefrati
deanefrati deleted the auth_middleware branch July 23, 2025 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants