-
Notifications
You must be signed in to change notification settings - Fork 102
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
Migrate User API's to auth server #325
Migrate User API's to auth server #325
Conversation
9024c7e
to
ef0ae21
Compare
api/pkg/oauth/auth/service/auth.go
Outdated
Where("code = ?", code) | ||
|
||
err := q.First(&User).Error | ||
if err != nil { |
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.
if err != nil { | |
if err:=r.db.Model(&model.User{}).Where("code = ?", code).First(&User).Error; err != nil { |
@PuneetPunamiya In case of expired refresh token |
4959d36
to
665608d
Compare
return nil, err | ||
} | ||
|
||
if user.RefreshTokenChecksum != createChecksum(token) { |
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.
token contains Header along with token value and needs to split the token 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.
You mean Bearer + token
??
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
} | ||
|
||
// Get the user Info | ||
func (s *UserService) Info(res http.ResponseWriter, req *http.Request) { |
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.
should we validate the access token here ?
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.
Since we are using a middleware it verifies and validates the access token whenever a request is made to the endpoint
665608d
to
d7827d8
Compare
d7827d8
to
15202e6
Compare
api/pkg/user/base.go
Outdated
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package base |
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.
package user
?
15202e6
to
02f86b6
Compare
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: 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 |
- This patch removes the user design from Hub Api server and the corresponding service logic for user endpoints Signed-off-by: Puneet Punamiya <[email protected]>
Signed-off-by: Puneet Punamiya <[email protected]>
This patch - Adds `/user/info` api which returns user related information in new auth server - Adds a middleware which implements the authorization logic for services - Adds test for `/user/info` api in auth server Signed-off-by: Puneet Punamiya <[email protected]>
This patch - Adds `/user/refresh/accesstoken` api to get new refresh access token for the user - Adds test for `/user/refresh/accesstoken` api in auth server Signed-off-by: Puneet Punamiya <[email protected]>
This patch - Adds `/user/refresh/refreshtoken` api to get new refresh token for the user - Adds test for `/user/refresh/refreshtoken` api in auth server Signed-off-by: Puneet Punamiya <[email protected]>
02f86b6
to
31edc86
Compare
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.
/lgtm
/test pull-tekton-hub-integration-tests |
Removes user design from Hub Api Server
server and the corresponding service logic for
user endpoints
Adds implementation and test for user info in auth server
Adds
/user/info
api which returns user relatedinformation in new auth server
Adds a middleware which implements the authorization
logic for services
Adds test for
/user/info
api in auth serverAdds implementation for User Refresh Access Token in auth server
Adds
/user/refresh/accesstoken
api to get new refresh accesstoken for the user
Adds test for
/user/refresh/accesstoken
api in auth serverAdds implementation for New Refresh Token for User in auth server
Adds
/user/refresh/refreshtoken
api to get new refreshtoken for the user
Adds test for
/user/refresh/refreshtoken
api in auth serverSigned-off-by: Puneet Punamiya [email protected]
Changes
Submitter 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.