-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implemented Authentication Middelware #21
Conversation
* Made gh action trigger on PRs also to get around stuck status checks (#19) * Made gh action trigger on PRs also to get around stuck status checks * Modified to trigger only on PRs * Renamed check * Add Token to Queue (#18) * implemented add token for queue store * implemented create token route * Fix code style issues with gofmt * read tokens in the queue in readqueue * Fix code style issues with gofmt * implemented token number * Fix code style issues with gofmt * added read token route * Fix code style issues with gofmt * separated name length constants * log insert error for add token * Fix code style issues with gofmt * refactoring mongo store * Fix code style issues with gofmt Co-authored-by: Lint Action <[email protected]> Co-authored-by: Nithin <[email protected]> Co-authored-by: Lint Action <[email protected]>
@@ -21,5 +21,5 @@ build/ | |||
# temporary build files create by air | |||
tmp/ | |||
|
|||
# dotenv variables | |||
# env file | |||
.env |
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.
Why should this be gitignored?
If it's okay, let's checkin the default .env file, it will be easier for others to run the code my making minimal edits.
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.
It shouldn't be a problem right now. But since we also store secrets as env variables, I just added it to gitignore. Also, I think generally most projects keep .env
in .gitignore
.
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.
I think it would be better to store these values as constants inside a go file instead of committing the .env
file to git.
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.
Thanks!
Implemented an authentication middleware.
Anonymous <anonymous-uuid>
then,<anonymous-uuid>
is used as the ID for the userBearer <jwt-token>
then,<jwt-token>
is decoded using auth0 and the "sub" claim from the decoded token is used as the ID for the useruid
in the contextWe can then use the
uid
as the owner of the queue inCreateQueue
etc.The following environment variables need to be set in order for the middlware to work
I am making use of
godotenv
to load these variables from a.env
file for development purposes. When deploying we will need to set these variables accordingly.