Skip to content

[stable12] Improve OAuth - #9546

Merged
MorrisJobke merged 9 commits into
stable12from
backport/9517/stable12
May 23, 2018
Merged

[stable12] Improve OAuth#9546
MorrisJobke merged 9 commits into
stable12from
backport/9517/stable12

Conversation

@rullzer

Copy link
Copy Markdown
Member

@rullzerrullzer added enhancement 3. to review Waiting for reviews labels May 23, 2018
@rullzerrullzer added this to the Nextcloud 14 milestone May 23, 2018
@rullzer

Copy link
Copy Markdown
MemberAuthor

I have no idea why the test fail it seems unrelated.

@ChristophWurstChristophWurst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I just found one spot where it could make sense to add some logging 👍

$appToken->setExpires($this->time->getTime() + 3600);
$this->tokenProvider->updateToken($appToken);
} catch (InvalidTokenException $e) {
//Skip this token

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't see this in the original PR, but wouldn't it make sense to at least have a debug log statement for this in case we have to trace bugs in this code?

@MorrisJobke

Copy link
Copy Markdown
Member

With this there is an endless login loop on the first authorization of an app.

cc @rullzer as discussed

@MorrisJobkeMorrisJobke added 2. developing Work in progress and removed 3. to review Waiting for reviews labels May 23, 2018
rullzer added 9 commits May 23, 2018 17:02
This for example will allow rotating the apptoken for oauth
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
However due to the nature of what we store in the token (encrypted
passwords etc). We can't just delete the tokens because that would make
the oauth refresh useless.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
On a refresh token request:
* rorate
* reset expire
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzer
rullzerforce-pushed the backport/9517/stable12 branch from 884d76f to 3e57666CompareMay 23, 2018 15:02
@codecov

codecovBot commented May 23, 2018

Copy link
Copy Markdown

Codecov Report

Merging #9546 into stable12 will increase coverage by 0.05%.
The diff coverage is 70.27%.

@@ Coverage Diff @@## stable12 #9546 +/- ##
==============================================
+ Coverage 53.91% 53.96% +0.05% - Complexity 22786 22815 +29 
==============================================
Files 1387 1389 +2 Lines 87302 87437 +135 Branches 1331 1331 ==============================================
+ Hits 47066 47185 +119 - Misses 40236 40252 +16
Impacted FilesCoverage ΔComplexity Δ
apps/oauth2/lib/Migration/SetTokenExpiration.php0% <0%> (ø)5 <5> (?)
version.php0% <0%> (ø)0 <0> (ø)⬇️
...rivate/Authentication/Token/DefaultTokenMapper.php100% <100%> (ø)11 <0> (ø)⬇️
core/Controller/ClientFlowLoginController.php78.87% <100%> (ø)20 <0> (ø)⬇️
...uthentication/Exceptions/ExpiredTokenException.php100% <100%> (ø)2 <2> (?)
...vate/Authentication/Token/DefaultTokenProvider.php98.01% <100%> (+3.7%)32 <2> (+6)⬆️
lib/private/Authentication/Token/DefaultToken.php89.58% <100%> (+2.74%)17 <4> (+4)⬆️
...auth2/lib/Controller/LoginRedirectorController.php71.42% <60%> (+0.84%)3 <0> (+1)⬆️
apps/oauth2/lib/Controller/OauthApiController.php81.53% <82%> (+2.37%)11 <10> (+9)⬆️
... and 4 more

@MorrisJobkeMorrisJobke added 3. to review Waiting for reviews and removed 2. developing Work in progress labels May 23, 2018

@MorrisJobkeMorrisJobke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works now 👍

@MorrisJobkeMorrisJobke added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels May 23, 2018
@MorrisJobke
MorrisJobke merged commit 6b5fea4 into stable12May 23, 2018
@MorrisJobke
MorrisJobke deleted the backport/9517/stable12 branch May 23, 2018 17:03
@MorrisJobkeMorrisJobke mentioned this pull request May 31, 2018
2 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to releaseReady to be released and/or waiting for tests to finishenhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@rullzer@MorrisJobke@ChristophWurst