-
Notifications
You must be signed in to change notification settings - Fork 130
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
[GH-971] Support Jira migration to Oauth #995
Changes from 1 commit
aad0dbb
13dcb55
7e27ce0
5614754
1055626
18f2deb
cdd9d2a
cf7e02a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,12 +98,12 @@ func (ci *cloudOAuthInstance) GetClient(connection *Connection) (Client, error) | |
func (ci *cloudOAuthInstance) getClientForConnection(connection *Connection) (*jira.Client, *http.Client, error) { | ||
oauth2Conf := ci.GetOAuthConfig() | ||
ctx := context.Background() | ||
tokenSource := oauth2Conf.TokenSource(ctx, connection.OAuth2Token) | ||
if ci.JWTInstance != nil && tokenSource == nil { | ||
ci.Plugin.API.LogDebug("Returning a JWT token client in case the stored JWT instance is not nil and the user's oauth token is nil") | ||
if ci.JWTInstance != nil && connection.OAuth2Token == nil { | ||
ci.Plugin.API.LogDebug("Returning a JWT token client since the stored JWT instance is not nil and the user's oauth token is nil") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you thinking we should remove log statements like this in a following release? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mickmister Yes, we will remove these in a later release. These are just to check if the code executed as we expected it to. |
||
return ci.JWTInstance.getClientForConnection(connection) | ||
} | ||
|
||
tokenSource := oauth2Conf.TokenSource(ctx, connection.OAuth2Token) | ||
client := oauth2.NewClient(ctx, tokenSource) | ||
|
||
// Get a new token, if Access Token has expired | ||
|
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 I understand correctly, the
connection
variable here is ambiguous whether the user's connection iscloud
orcloud-oauth
. Maybe put a comment here that says "Checking if this user's connection is for a JWT instance"Something else comes to mind. If the user disconnects their account, we should make sure we do proper cleanup of anything related to JWT instance type, in case that was their connection
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.
@mickmister We are deleting the user's connection when a user is disconnecting. So, I think that should cover what you are suggesting here.
We cannot wipe the JWT instance data completely because even if a user has disconnected their account, there might be other users who are still using JWT.
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.
Right, I worded "we should make sure we do proper cleanup of anything related to JWT instance type" a bit misleadingly. I really meant cleaning up the connection itself, and not the centralized JWT instance data. LGTM 👍