-
Notifications
You must be signed in to change notification settings - Fork 100
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
Stores the jwt token in a http cookie #354
Conversation
35d46a5
to
7b628d3
Compare
7b628d3
to
8b442f8
Compare
8b442f8
to
da61bf3
Compare
8fba34e
to
dcc8c89
Compare
dcc8c89
to
915a437
Compare
module.exports = function (app) { | ||
app.use( | ||
createProxyMiddleware(['/auth', '/user'], { | ||
target: 'http://localhost:4200', |
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.
What will happen in case of production ?
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 we can use the env value of REDIRECT_URI
instead of hard coding this value
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.
yes ,we should get it from env
); | ||
app.use( | ||
createProxyMiddleware(['/resource/**/rating'], { | ||
target: 'http://localhost:8000', |
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.
same as above
@@ -62,6 +62,20 @@ type Service interface { | |||
HubAuthenticate(res http.ResponseWriter, req *http.Request) | |||
} | |||
|
|||
type cookie struct { |
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.
Can you move this struct to app.go
api/pkg/auth/service/auth.go
Outdated
@@ -192,6 +206,27 @@ func (s *service) HubAuthenticate(res http.ResponseWriter, req *http.Request) { | |||
return | |||
} | |||
|
|||
//Add cookie and response and send it to in header | |||
|
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.
nit: can you please delete this blank line
db: s.DB(ctx), | ||
log: s.Logger(ctx), | ||
userID: validator.UserID(ctx), | ||
db: s.DB(newctx), |
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 can't we use the same 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.
It was not adding userID in the context while doing jwtAuth validation
"github.com/tektoncd/hub/api/pkg/testutils" | ||
goa "goa.design/goa/v3/pkg" | ||
) | ||
|
||
func GetChecker(tc *testutils.TestConfig) *goahttpcheck.APIChecker { | ||
service := validator.NewService(tc.APIConfig, "rating") | ||
// service := validator.NewService(tc.APIConfig, "rating") |
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.
Do we need this anymore ?
@@ -195,11 +194,11 @@ func TestGet_Http_ResourceNotFound(t *testing.T) { | |||
} | |||
|
|||
func UpdateChecker(tc *testutils.TestConfig) *goahttpcheck.APIChecker { | |||
service := validator.NewService(tc.APIConfig, "rating") | |||
// service := validator.NewService(tc.APIConfig, "rating") |
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.
nit
/approve if I want to curl the rating api .. how can i pass the token now? |
@pratap0007: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Issues go stale after 90d of inactivity. /lifecycle stale Send feedback to tektoncd/plumbing. |
Stale issues rot after 30d of inactivity. /lifecycle rotten Send feedback to tektoncd/plumbing. |
Rotten issues close after 30d of inactivity. /close Send feedback to tektoncd/plumbing. |
@tekton-robot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/reopen |
@piyush-garg: Reopened this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sm43 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@pratap0007: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/remove-lifecycle rotten |
Issues go stale after 90d of inactivity. /lifecycle stale Send feedback to tektoncd/plumbing. |
/remove-lifecycle stale |
Stale issues rot after 30d of inactivity. /lifecycle rotten Send feedback to tektoncd/plumbing. |
Rotten issues close after 30d of inactivity. /close Send feedback to tektoncd/plumbing. |
@tekton-robot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Adds a proxy to proxy the auth and rating endpoints
in the client on ui side so that server can access it from .
Updates rating design to adds cookie and removes header
Adds implementation to manage http cookie on server
Updates rating api and use manual validation of jwt which
is fetched from cookie
Adds api endpoints in UI to fetch access token and logout
/user/accesstoken
endpoint on UI to get the accesstoke for user to show it on user profile
/user/logout
to delete the http cookie on serverSubmitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make api-check
make ui-check
See the contribution guide for more details.