-
Notifications
You must be signed in to change notification settings - Fork 17
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
OP#40534 only allow user to connect via OAuth #35
Conversation
I've not adjusted also the documentation |
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.
Very nice.
A few minor inline comments.
* please note that the state parameter is still missing, that needs to be generated dynamically | ||
* and saved to the DB before calling the OAuth URI | ||
*/ | ||
public static function getOpenProjectOauthURL(IConfig $config, IURLGenerator $urlGenerator): string { |
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.
IURLGenerator
could be injected in the constructor of OpenProjectAPIService
instead of passing it as a parameter to getOpenProjectOauthURL
. This would avoid having to inject IURLGenerator
in every class calling this method.
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, but then every class that calls the method would have to initiate the complete OpenProjectAPIService
and by that need to get injected even more
e..g from OpenProjectWidget
we would need the logger, usermanager, avatarmanager etc.
Or maybe we want to place that function somewhere else? A helper class?
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 I agree. As long as getOpenProjectOauthURL
is a static method, let's keep it that way.
If you feel like it belongs in a new class/file, feel free to move it 😁.
@eneiluj could you re-review and give your opinion on my comment here #35 (comment) ? |
2796780
to
ac920d8
Compare
ac920d8
to
aff7051
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.
👍
One last small change and we're good to go.
return $oauthUrl . | ||
'/oauth/authorize' . | ||
'?client_id=' . $clientID . | ||
'&redirect_uri=' . $redirectUri . |
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.
'&redirect_uri=' . $redirectUri . | |
'&redirect_uri=' . urlencode($redirectUri) . |
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.
good point, I've adjusted that and also squashed all commits
* please note that the state parameter is still missing, that needs to be generated dynamically | ||
* and saved to the DB before calling the OAuth URI | ||
*/ | ||
public static function getOpenProjectOauthURL(IConfig $config, IURLGenerator $urlGenerator): string { |
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 I agree. As long as getOpenProjectOauthURL
is a static method, let's keep it that way.
If you feel like it belongs in a new class/file, feel free to move it 😁.
and only allow oAuth connection for user Signed-off-by: Artur Neumann <artur@jankaritech.com>
aff7051
to
4063751
Compare
Signed-off-by: Artur Neumann <artur@jankaritech.com>
I found an other issue that I've missed before. The url to openproject was still taken from the user settings |
PHP Code CoverageCoverage after merging oauthConnectFromDashboardAdnFiles into master will be
Coverage Report
|
the user should not have any option to connect via api tokens to OpenProject. This PR is part of that
in following PR more work needs to be done:
https://community.openproject.org/projects/817/work_packages/40534/activity